Created
June 15, 2015 20:02
-
-
Save anonymous/eacc75524d9f425a8265 to your computer and use it in GitHub Desktop.
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 CensoringAlert | |
// @namespace konfu1 | |
// @include http://comment-cdn.9gag.com/* | |
// @version 1 | |
// @grant GM_addStyle | |
// @require http://code.jquery.com/jquery-2.1.4.min.js | |
// ==/UserScript== | |
(function ($, undefined) { | |
function matches(regexp) { | |
return function (str) { | |
return regexp.test(str); | |
}; | |
} | |
function any() { | |
var args = arguments; | |
return function (str) { | |
for (var i = 0; i < args.length; ++i) { | |
if (args[i](str)) | |
return true; | |
} | |
return false; | |
}; | |
} | |
var isBlocked = any( | |
//matches(/c[o|0]m/), // produce lots of false-positives. need more testing | |
matches(/4ch[a|4]n/), | |
//matches(/9g[a|4]g/), // produce lots of false-positives. need more testing | |
matches(/[a|4]dm[i|l]?n/), | |
matches(/b[o|0]t/), | |
matches(/buzzf[e|3][e|3]d/), | |
matches(/funnyjunk/), | |
matches(/h[o|0]t[o|0]n[i|l]?nt[e|3]rn[e|3]t/), | |
matches(/[i|l]?mgur/), | |
matches(/m[e|3]m[e|3]c[e|3]nt[e|3]r/), | |
matches(/r[e|3]dd[i|l]?t/), | |
matches(/r[e|3]p[o|0]st/), | |
matches(/st[o|0][l|i][e|3]n/), | |
matches(/tr[e|3]nd[i|l]?ng/), | |
matches(/tumb[l|i]r/), | |
matches(/www/) | |
); | |
function run() { | |
$('.comment-entry').each(function (index, element) { | |
var $element = $(element); | |
var text = $element.find('.content').text(); | |
text = text.replace(/\W/g, ''); | |
text = text.toLowerCase(); | |
if (isBlocked(text)) | |
$element.addClass('forbidden-comment'); | |
}); | |
} | |
console.log('9gag CensoringAlert loaded'); | |
GM_addStyle('.forbidden-comment {border: 3px solid red;}'); | |
setInterval(run, 2000); | |
})(jQuery.noConflict()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment