Advertisement
Guest User

cutDaChz

a guest
Jul 7th, 2015
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. I created this bookmarklet (https://en.wikipedia.org/wiki/Bookmarklet) to remove cow42 from the cheeseheadtv comments section. I've updated it to remove our new troll 'Thompson tWins'.
  2.  
  3. basically it just injects some javascript into the page that deletes the html elements containing those posts.
  4.  
  5. (function(){
  6. var comments = document.getElementsByClassName("comment-submitted");
  7. for (var i = 0; i < comments.length; i++) {
  8.     var data = comments[i].getElementsByTagName("a");
  9.     if (data[0].innerHTML === 'Thompson tWins') {
  10.     data[0].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.removeChild(data[0].parentNode.parentNode.parentNode.parentNode.parentNode);
  11.     }
  12. }})()
  13.  
  14. In order to use it in the browser it has to be url encoded and pasted into a bookmark. I've pasted the url encoded javascript below, but since it is hard for humans to read you can decode it here (http://meyerweb.com/eric/tools/dencoder/) to make sure the code not doing something shady in your browser, or modify it and re-encode it to your liking. Hell, delete my comments if you want to ignore me, IDK.
  15.  
  16. To use it, create a bookmark of any page and edit the bookmark so the url encoded text below is in the URL: field like so. https://www.dropbox.com/s/to75mboakla7gkq/Screenshot%202015-07-07%2008.18.20.png?dl=0 and name it what you like. I named mine cutDaChz as you can see. Enjoy cheeseheadtv again!
  17.  
  18.  
  19. javascript:(function()%7B%0Avar comments %3D document.getElementsByClassName("comment-submitted")%3B%0Afor (var i %3D 0%3B i < comments.length%3B i%2B%2B) %7B%0A%09var data %3D comments%5Bi%5D.getElementsByTagName("a")%3B%0A%09if (data%5B0%5D.innerHTML %3D%3D%3D %27Thompson tWins%27) %7B%0A%09%09data%5B0%5D.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.removeChild(data%5B0%5D.parentNode.parentNode.parentNode.parentNode.parentNode)%3B%0A    %7D%0A%7D%7D)()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement