Created
October 2, 2008 03:20
-
-
Save robbyrussell/14264 to your computer and use it in GitHub Desktop.
greasemonkey script to protect you from palin videos on youtube
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 SaveYourselfFromPalin | |
// @namespace http://www.youtube.com/ | |
// @description saves you from the emotion that you feel after seeing another sarah palin clip | |
// @include http://www.youtube.com/* | |
// ==/UserScript== | |
var sarah = /(palin)/; | |
function pitbull_exists(lipstick) { | |
for (var tx = document.evaluate('//text()[normalize-space(.)!=""]', document, null, 6, null), t, i = 0; t = tx.snapshotItem(i); i++) { | |
var before = t.textContent, st, matched = false; | |
if (t.parentNode.tagName == 'STYLE' || t.parentNode.tagName == 'SCRIPT') continue; | |
while ((st = before.search( lipstick )) != -1) { return true; } | |
} return false; | |
} | |
if (pitbull_exists(sarah)) { | |
alert('WARNING!!!!!\nThis contents of this youtube video might include Sarah Palin. You might want to go punch yourself in the face instead of watching it....'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment