summaryrefslogtreecommitdiff
path: root/.uzbl/scripts/adblock.js
diff options
context:
space:
mode:
Diffstat (limited to '.uzbl/scripts/adblock.js')
-rwxr-xr-x.uzbl/scripts/adblock.js28
1 files changed, 28 insertions, 0 deletions
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);