Created
January 10, 2012 21:28
-
-
Save DoggettCK/1591307 to your computer and use it in GitHub Desktop.
GamersWithJobs.com Ignore Users Chrome User Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name I Didn't Hear Anything | |
// @namespace gamerswithjobs | |
// @description Increases the number of potential Tannhauserings | |
// @include http://www.gamerswithjobs.com/node/* | |
// @author Chris Doggett | |
// ==/UserScript== | |
// Special thanks to Jeremy Banks at http://stackoverflow.com/a/6834930/64203 | |
var load,execute,loadAndExecute;load=function(a,b,c){var d;d=document.createElement("script"),d.setAttribute("src",a),b!=null&&d.addEventListener("load",b),c!=null&&d.addEventListener("error",c),document.body.appendChild(d);return d},execute=function(a){var b,c;typeof a=="function"?b="("+a+")();":b=a,c=document.createElement("script"),c.textContent=b,document.body.appendChild(c);return c},loadAndExecute=function(a,b){return load(a,function(){return execute(b)})}; | |
loadAndExecute("//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", main); | |
function main() { | |
// Add or remove users to this array to ignore/unignore them on the forums. Still working on a way to store these permanently, but without GM_setvalue/GM_getvalue, it's difficult. | |
var usersToIgnore = [ | |
"Floomi", | |
"Bonus_Eruptus" | |
]; | |
// strip out newlines from class names, as they appear to screw with jQuery's selectors | |
$("*").each(function(){ | |
var node = $(this).get(0); | |
node.className = node.className.replace(/\s+/, ' ').replace(/(^\s+|\s+$)/, ''); | |
}); | |
$(".gwj_unignore").live('click', function() { | |
var linksDiv = $(this).closest("div.links"); | |
linksDiv.next("div.comment").show(); | |
linksDiv.remove(); | |
}); | |
$.each(usersToIgnore, function(i, val) { | |
$("div.author-name:contains('" + val + "')").closest("div.comment").each(function() { | |
var comment = $(this); | |
comment.hide(); | |
comment.before('<div class="links"><ul class="links"><li><a class="gwj_unignore"><strong>Did ' + val + ' Tannhauser me?</strong></a></li></ul></div>'); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FYI, I forked and updated this to hide quotes of ignored users as well. https://gist.github.com/noahm/5272551