Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Nuke anonymous cowards
- // @description Since people post so offensively so often, let's just hide the anons
- // @include http://slashdot.org/*
- // @include http://*.slashdot.org/*
- // @include https://slashdot.org/*
- // @include https://*.slashdot.org/*
- // @grant none
- // ==/UserScript==
- /************************************************
- * Stash some info about comments
- ************************************************/
- var arrayOfCommentDivs = [];
- var toRemoveComment = [];
- var toRemoveReplyButtons = [];
- /************************************************
- * Fetch the list of anonymous posters
- ************************************************/
- var elements = document.getElementsByClassName("by");
- for(var i = 0; i < elements.length; i++) {
- var text = elements[i].innerHTML.toString();
- if(text.contains("Anonymous Coward")) {
- var theComment = elements[i].parentElement.parentElement.parentElement;
- arrayOfCommentDivs.push( theComment );
- toRemoveComment.push( theComment.getElementsByClassName("commentBody")[0] );
- toRemoveReplyButtons.push( theComment.getElementsByClassName("commentSub")[0] );
- }
- }
- /************************************************
- * Act on the list of anonymous posters
- ************************************************/
- for(var i = toRemoveComment.length - 1; i >= 0; i--) {
- toRemoveComment[i].style.display = "none";
- toRemoveReplyButtons[i].style.display = "none";
- arrayOfCommentDivs[i].style.display = "none";
- // do something more advanced if you wish (arrayOfCommentDivs[i])
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement