Tumblrisms

Scroll to end and then Like all (Gab.ai bookmarklet)

Nov 7th, 2016
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Go to http://mrcoles.com/bookmarklet/ and put the below script, LESS this comment, into the box. Don't check the option to include jQuery. The site will then give you a button ("this link") you can drag into your browser's UI and use anytime. Note that this is sluggish on profiles with a lot of posts because, obviously, it loads them all. Also note that if the script is activated on a hashtag page or something like that, it will still work, but obviously just keep loading posts ad infinitum and your computer will probably turn into syrup before it gets to the end to start the Like spamming.
  2.  
  3. var process;
  4. var lastHit = 0;
  5. var doneLikes = false;
  6.  
  7. function ScrollToEndAndLikeAll()
  8. {
  9.     if (lastHit == 0 || (new Date().getTime() / 1000) - lastHit < 10)
  10.     {
  11.         var nodes = document.evaluate('.//a[@class="post post--load"]//span[contains(text(),"Load more")]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  12.  
  13.         if (nodes.snapshotLength > 0)
  14.         {
  15.             lastHit = new Date().getTime() / 1000;
  16.            
  17.             for (var i = 0; i < nodes.snapshotLength; i++)
  18.             {
  19.                 if (nodes.snapshotItem(i).style.display != "none")
  20.                 {
  21.                     nodes.snapshotItem(i).click();
  22.                 }
  23.             }
  24.         }
  25.     }
  26.     else
  27.     {
  28.         if (doneLikes == false)
  29.         {
  30.             doneLikes = true;
  31.             clearInterval(process);
  32.            
  33.             var nodes2 = document.evaluate(".//a[not(@class) or @class!='active']/i[@class='ion-chevron-up']", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  34.            
  35.             for (var i = 0; i < nodes2.snapshotLength; i++)
  36.             {
  37.                 if (nodes2.snapshotItem(i).style.display != "none")
  38.                 {
  39.                     nodes2.snapshotItem(i).click();
  40.                 }
  41.             }
  42.            
  43.             alert("Done.");
  44.         }
  45.     }
  46. }
  47.  
  48. process = setInterval(ScrollToEndAndLikeAll, 500);
Advertisement
Add Comment
Please, Sign In to add comment