Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Hide Crack Emcee
- // @version 1.0
- // @description Hide The Crack Emcee's comments on Althouse's blog
- // @include http://althouse.blogspot.com/*
- // @copyright 2014+, Matt Lewis
- // ==/UserScript==
- var allCrackLinks, commentId, crackComments, i, j, crackLink, crackComment, originalComment, commentBodies;
- allCrackLinks = document.evaluate(
- "//a[@href='http://www.blogger.com/profile/08366101526773588864']", // Crack Emcee's profile link
- document,
- null,
- XPathResult.ORDERED_NODE_ITERATOR_TYPE,
- null );
- crackLink = allCrackLinks.iterateNext();
- commentBodies = new Array();
- while( typeof crackLink != "undefined" && crackLink ){
- commentId = crackLink.parentNode.parentNode.parentNode.id.slice(1);
- crackComments = document.evaluate(
- "//dd[@class='comment-body' and contains(@id, '" + commentId + "')]",
- document,
- null,
- XPathResult.ORDERED_NODE_ITERATOR_TYPE,
- null );
- if (typeof crackComments != "undefined") {
- crackComment = crackComments.iterateNext();
- while( crackComment ){
- crackComment.crackId = commentId;
- commentBodies[commentBodies.length] = crackComment;
- crackComment = crackComments.iterateNext();
- }
- }
- crackLink = allCrackLinks.iterateNext();
- }
- for( i = 0; i < commentBodies.length; ++i ){
- crackComment = commentBodies[i];
- originalComment = crackComment.innerHTML;
- crackComment.innerHTML = '<i>stupid racist comment has been hidden...<a onclick="document.getElementById(\'crack' + crackComment.crackId + '\').style.display=\'inline\';return false;">click to show</a>' +
- '</i><span style="display:none" id="crack' + crackComment.crackId + '">' +
- '<br><i><a onclick="document.getElementById(\'crack' + crackComment.crackId + '\').style.display=\'none\';return false;">click to hide this racist ass comment</a></i>' +
- originalComment +
- '</span>';
- }
Add Comment
Please, Sign In to add comment