1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-03 01:29:39 +02:00

code review + removal of obsolete exception filters

This commit is contained in:
gorhill 2015-11-25 19:38:05 -05:00
parent 05476e9fd3
commit 80c2ef47bc
4 changed files with 61 additions and 30 deletions

View File

@ -1,5 +1,5 @@
d25ad715e4fdf47684422131b2377e1e assets/ublock/unbreak.txt
e65fbcaa573c028770f1d0afada55672 assets/ublock/redirect-resources.txt
a65d3b35ba116f897c7ef5db2046da73 assets/ublock/unbreak.txt
56b94e0f8a6b0d010d358ba4f7b7d5c9 assets/ublock/redirect-resources.txt
7a04294b44b88baa34cf3e4bfe0e59db assets/ublock/privacy.txt
b2dbf435507aa0262b289c67cbef2142 assets/ublock/filters.txt
146704ad1c0393e342afdb416762c183 assets/ublock/badware.txt

View File

@ -8,17 +8,55 @@
# If the encoding is absent, the data will be converted to base64, and the
# encoding will be set to `;base64`.
hd-main.js application/javascript
var L = (function(){
var l = {};
var fn = function(){};
var props = ["pf","ed","Qe","fd","xh","Uc","ef","zd","Ad","Qc","Ri","Wc","Vc","Xc","Wg","rd","qd","sd","Pe","Id","Hd","Jd","fg","Fd","Ed","Gd","ek","Cd","Bd","Dd","Nj","Sc","Rc","Tc","wg","xd","wd","yd","fh","ld","md","nd","Re","cd","Pc","ke","Yc","Xg","jd","kd","oh","ad","bd","mi","gd","hd","ae","dd","fk","ij","ud","td","vd","ig","od","pd","Yd","$j","Oc","bf"];
for ( var i = 0; i < props.length; i++ ) {
l[props[i]] = fn;
}
return l;
var l = {};
var noopfn = function() {};
var props = ["pf", "ed", "Qe", "fd", "xh", "Uc", "ef", "zd", "Ad", "Qc", "Ri", "Wc", "Vc", "Xc", "Wg", "rd", "qd", "sd", "Pe", "Id", "Hd", "Jd", "fg", "Fd", "Ed", "Gd", "ek", "Cd", "Bd", "Dd", "Nj", "Sc", "Rc", "Tc", "wg", "xd", "wd", "yd", "fh", "ld", "md", "nd", "Re", "cd", "Pc", "ke", "Yc", "Xg", "jd", "kd", "oh", "ad", "bd", "mi", "gd", "hd", "ae", "dd", "fk", "ij", "ud", "td", "vd", "ig", "od", "pd", "Yd", "$j", "Oc", "bf"];
for (var i = 0; i < props.length; i++) {
l[props[i]] = noopfn;
}
return l;
})();
# http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever
handtinytrans.gif image/gif;base64
R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
# To neutralize GA scripts. The goal is to provide the minimal API
# expected by clients of these scripts so that the end users are able
# to wholly block GA while minimizing risks of page breakage.
# Test cases (need way more):
# - https://github.com/chrisaljoudi/uBlock/issues/119
#www.google-analytics.com/ga.js application/javascript
#(function() {
# var noopfn = function() {};
# //
# var gaq = function() {};
# gaq.push = function(a) {
# if ( typeof a === 'function' ) {
# a();
# }
# };
# //
# var tracker = function() {};
# tracker._getLinkerUrl = function(a) { return a; };
# //
# var gat = function() {};
# gat._getTrackerByName = function() { return tracker; };
# window._gat = gat;
# //
# (function() {
# var aa = window._gaq || [];
# if ( Array.isArray(aa) ) {
# while ( aa[0] ) {
# gaq.push(aa.shift());
# }
# }
# })();
# window._gaq = gaq;
#})();

View File

@ -3,20 +3,15 @@
# https://twitter.com/JarkkoRytkonen/status/540052376015888385
# https://github.com/chrisaljoudi/uBlock/issues/119
# https://github.com/chrisaljoudi/uBlock/issues/822
# https://github.com/chrisaljoudi/uBlock/issues/940
# To counter `google-analytics.com` in Peter Lowe's list
@@||google-analytics.com^$domain=avianca.com|jackbox.tv|musixmatch.com|bikstok.sonymusicshop.dk
@@||google-analytics.com^$domain=avianca.com|jackbox.tv|bikstok.sonymusicshop.dk
# From Chrome store: "Go to site http://www.vd.nl/ ... links from dropdown top menu do not work"
# To counter Dan Pollock's, hpHosts, MVPS, Peter Lowe's
@@||google-analytics.com/analytics.js$script,domain=www.vd.nl
@@||google-analytics.com/plugins/ua/ec.js$script,domain=www.vd.nl
# https://github.com/chrisaljoudi/uBlock/issues/821
# => blocking counterpart in Peter Lowe's Ad Server
@@||google-analytics.com/ga.js^$script,domain=zie.nl
# https://github.com/gorhill/uBlock/issues/939
@@||google-analytics.com/urchin.js$script,domain=live.euroleague.net
@ -93,10 +88,6 @@
# To counter `2mdn.net` in Peter Lowe's, `s0.2mdn.net` in hpHosts
@@||s0.2mdn.net/instream/*$object,script,domain=wsmv.com
# Videos broken on weather.com
# To counter `www.googletagservices.com` in MVPS, hpHosts, Dan Pollock's
@@||www.googletagservices.com/tag/js/gpt.js^$script,domain=weather.com
# https://github.com/chrisaljoudi/uBlock/issues/409
@@||c.speedtest.net^$~third-party

View File

@ -222,14 +222,14 @@ RedirectEngine.prototype.supportedTypes = (function() {
RedirectEngine.prototype.resourcesFromString = function(text) {
var textEnd = text.length;
var lineBeg = 0, lineEnd;
var line, fields;
var line, fields, encoded;
var reNonEmptyLine = /\S/;
var resourceFromFields = function(fields) {
var encoded = fields[1].indexOf(';') !== -1;
var resourceFromFields = function(fields, encoded) {
var data = fields.slice(2).join(encoded ? '' : '\n');
this.resources[fields[0]] =
'data:' +
fields[1] +
fields[1] +
(encoded ? '' : ';base64') +
',' +
(encoded ? data : btoa(data));
@ -245,7 +245,7 @@ RedirectEngine.prototype.resourcesFromString = function(text) {
lineEnd = textEnd;
}
}
line = text.slice(lineBeg, lineEnd).trim();
line = text.slice(lineBeg, lineEnd);
lineBeg = lineEnd + 1;
if ( line.charAt(0) === '#' ) {
@ -253,27 +253,29 @@ RedirectEngine.prototype.resourcesFromString = function(text) {
}
if ( fields === undefined ) {
fields = line.split(/\s+/);
if ( fields.length !== 2 ) {
fields = line.trim().split(/\s+/);
if ( fields.length === 2 ) {
encoded = fields[1].indexOf(';') !== -1;
} else {
fields = undefined;
}
continue;
}
if ( line !== '' ) {
fields.push(line);
if ( reNonEmptyLine.test(line) ) {
fields.push(encoded ? line.trim() : line);
continue;
}
// No more data, add the resource.
resourceFromFields(fields);
resourceFromFields(fields, encoded);
fields = undefined;
}
// Process pending resource data.
if ( fields !== undefined ) {
resourceFromFields(fields);
resourceFromFields(fields, encoded);
}
};