summaryrefslogtreecommitdiff
path: root/.uzbl/scripts/adblock.js
blob: b581f9bba8a3fb63c8cb82b042f363cf01036420 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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);