summaryrefslogtreecommitdiff
path: root/.uzbl/scripts
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2015-09-28 09:35:21 +0100
committerUrbain Vaes <urbain@vaes.uk>2015-09-28 09:35:21 +0100
commit574c1407d0c3253547b552f98952b1665e4f2cb1 (patch)
tree8b749f84c6d478dd1623fbc6feef0f8701d6e3c1 /.uzbl/scripts
parentba730c6dc0d7202ad3204827f768ed78f01584f5 (diff)
Add various changes
Diffstat (limited to '.uzbl/scripts')
-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);