Advertisement
Guest User

joyreactor tag redirect

a guest
Nov 4th, 2023
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.64 KB | Software | 0 0
  1. // ==UserScript==
  2. // @name     Joyreactor tag editor
  3. // @version  1
  4. // @grant    none
  5. // @include https://reactor.cc/*
  6. // @include http://reactor.cc/*
  7. // @include https://*reactor.cc/*
  8. // @include http://*reactor.cc/*
  9. // ==/UserScript==
  10.  
  11.   var tags;
  12. var timeout = 500;
  13. setInterval(go, timeout);
  14.  
  15. function go()
  16. {
  17.   tags = document.getElementsByClassName("taglist");
  18.     if (tags.length == 0)
  19.   {
  20.     var newtags;
  21.     newtags = document.getElementsByClassName("post-tags");
  22.     if (newtags.length > 0)
  23.         {
  24.         tags = Array();
  25.          for (var i=0; i<newtags.length; i++)
  26.           {
  27.           tags.push(newtags[i].children[0])
  28.           }
  29.         }
  30.   }
  31.   if (tags.length > 0)
  32.   {
  33.     startChange()
  34.   }
  35. }
  36. function startChange()
  37. {
  38.  
  39.     for (var i=0; i<tags.length; i++)
  40.       {
  41.         var thisTag = tags[i].children;
  42.        
  43.         for (var u=0; u<thisTag.length; u++)
  44.             {
  45.             ChangeLink(thisTag[u]);
  46.             ChangeLink(thisTag[u].children[0]);  
  47.           }
  48.       }
  49. }
  50. function ChangeLink(link)
  51. {
  52.   if (link != undefined && link.getAttribute("href") != undefined)
  53.                     {
  54.                 var urlstring = link.getAttribute("href");
  55.                
  56.                 if (!urlstring.endsWith("/all") && !urlstring.endsWith("rating"))
  57.                     {
  58.                     if (!urlstring.endsWith("/"))
  59.                     {
  60.                                             urlstring = urlstring+"/all";
  61.                     }
  62.                     else
  63.                     {
  64.                       urlstring = urlstring+"all";
  65.                     }
  66.                                         link.setAttribute("href", urlstring);
  67.                  }
  68.               }
  69. }
Tags: joyreactor
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement