Created
March 30, 2010 19:16
-
-
Save pawelz/349466 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
/* | |
* Script that makes points on http//bash.org.pl visible before voting, and | |
* kills some ads. | |
* | |
* I tested it with UZBL <http://uzbl.org>, it should be easy to modify this | |
* script for browsers that support userscripts. For example Opera or Firefox | |
* with Greasemonkey. | |
* | |
* If you are using UZBL add following line to your uzbl config: | |
* @on_event LOAD_FINISH sh 'echo $6 | grep -qF bash.org.pl && echo script /path/to/bash.js > $4' | |
* | |
* This program is free software. It comes without any warranty, to the extent | |
* permitted by applicable law. You can redistribute it and/or modify it under | |
* the terms of the Do What The Fuck You Want To Public License, Version 2, as | |
* published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more | |
* details. | |
* | |
* by Paweł Zuzelski <pawelz@pld-linux.org> | |
*/ | |
function kill(el) { | |
p = el.parentNode; | |
p.removeChild(el); | |
} | |
function killByXpath(s) { | |
applyByXpath(s, kill); | |
} | |
function applyByXpath(s, f) { | |
var kl = []; | |
var hell=document.evaluate(s, document.documentElement, null, XPathResult.ANY_TYPE,null); | |
while(evil=hell.iterateNext()) kl.push(evil); | |
while(evil=kl.pop()) f(evil); | |
} | |
(function () { | |
var span; | |
applyByXpath("//span", (function(a){a.style.visibility = "visible"})); | |
killByXpath("//a[@class='fbshare']"); | |
killByXpath("//div[@id='side_ads']"); | |
killByXpath("//div[@id='banner1']"); | |
killByXpath("//iframe"); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment