Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Go SOPA Yourself
(function (w, d, a) {
var $ = w[a.k] = {
"a": a, "w": w, "d": d,
"s": {},
"v": {'el': []},
"f": ( function () {
return {
listen : function (el, ev, fn) {
if(typeof $.w.addEventListener !== 'undefined') {
el.addEventListener(ev, fn, false);
} else if(typeof $.w.attachEvent !== 'undefined') {
el.attachEvent('on' + ev, fn);
}
},
redact: function (str) {
var n = str.length;
var r = ~~(Math.random() * n);
var f = str.substr(0, r - 1);
var b = str.substr(r, n);
return f + '\u2588' + b;
},
loop: function () {
$.w.setTimeout( function () {
var el = $.v.el[~~(Math.random() * $.v.el.length)];
var t = '';
if (el.textContent) {
el.textContent = $.f.redact(el.textContent);
} else {
if (el.innerText) {
el.innerText = $.f.redact(el.innerText);
}
}
$.f.loop();
}, 10);
},
init : function () {
var i = 0, j = 0, k = $.a.t.length, el = [], n = 0;
for (j = 0; j < k; j = j + 1) {
el = $.d.getElementsByTagName($.a.t[j]);
for (i = 0, n = el.length; i < n; i = i + 1) {
if (el[i].className !== 'nokilli') {
$.v.el.push(el[i]);
}
}
}
$.f.loop();
}
};
}())
};
$.f.listen($.w, 'load', $.f.init);
}(window, document, {
'k': 'X' + '_' + new Date().getTime(),
't': [
'p', 'a'
]
}
));
@kentbrew
Owner

This little guy will gradually black out individual words appearing in the HTML tags listed in $.a.r. Quick, dirty, and non-standard-compliant, but then again: so is SOPA.

To run, add this SCRIPT tag:

<script src="go_sopa_yourself.js" type="text/javascript"></script>

... at the very bottom of your BODY tag, with the path to the script set appropriately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.