From 574c1407d0c3253547b552f98952b1665e4f2cb1 Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Mon, 28 Sep 2015 09:35:21 +0100 Subject: Add various changes --- .uzbl/scripts/adblock.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 .uzbl/scripts/adblock.js (limited to '.uzbl/scripts') diff --git a/.uzbl/scripts/adblock.js b/.uzbl/scripts/adblock.js new file mode 100755 index 0000000..b581f9b --- /dev/null +++ b/.uzbl/scripts/adblock.js @@ -0,0 +1,28 @@ +var blocklist = new Array(); +blocklist["IMG"] = [["src", /.*doubleclick.net.*/], + ["src", /.*last.fm\/adserver.*/]]; + +blocklist["SCRIPT"] = [["src", /.*doubleclick.net.*/]]; + +blocklist["IFRAME"] = [["name", /.*google_ads.*/], + ["id", /.*ad-google.*/]]; + + + + +function adblock(event) +{ + var tag = event.target.tagName; + if (!blocklist[tag]) + return; + for(var i = 0; i < blocklist[tag].length; i++) { + if (event.target.getAttribute(blocklist[tag][i][0])) { + if (event.target.getAttribute(blocklist[tag][i][0]).match(blocklist[tag][i][1])) { + event.preventDefault(); + return; + } + } + } +} + +document.addEventListener("beforeload", adblock, true); -- cgit v1.2.3