aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/_locales/en/messages.json4
-rw-r--r--src/js/dynamic-net-filtering.js13
-rw-r--r--src/js/messaging.js2
-rw-r--r--src/js/popup.js16
-rw-r--r--src/popup.html3
5 files changed, 18 insertions, 20 deletions
diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json
index cd83832..84666bc 100644
--- a/src/_locales/en/messages.json
+++ b/src/_locales/en/messages.json
@@ -151,6 +151,10 @@
"message":"3rd-party frames are <b>blocked<\/b> everywhere by default",
"description":""
},
+ "popupAnyRulePrompt":{
+ "message":"all",
+ "description":""
+ },
"popupImageRulePrompt":{
"message":"images",
"description":""
diff --git a/src/js/dynamic-net-filtering.js b/src/js/dynamic-net-filtering.js
index 071d414..e776f8c 100644
--- a/src/js/dynamic-net-filtering.js
+++ b/src/js/dynamic-net-filtering.js
@@ -39,7 +39,6 @@ var Matrix = function() {
/******************************************************************************/
var supportedDynamicTypes = {
- '*': true,
'inline-script': true,
'1p-script': true,
'3p-script': true,
@@ -243,21 +242,15 @@ Matrix.prototype.evaluateCellZ = function(srcHostname, desHostname, type) {
Matrix.prototype.evaluateCellZY = function(srcHostname, desHostname, type) {
this.r = 0;
- this.type = '*';
// Specific-destination + any type
- this.y = desHostname;
- this.r = this.evaluateCellZ(srcHostname, desHostname, '*');
- if ( this.r !== 0 ) { return this; }
+ this.type = '*';
var d = desHostname;
- for (;;) {
- d = toBroaderHostname(d);
- if ( d === '*' ) {
- break;
- }
+ while ( d !== '*' ) {
this.y = d;
this.r = this.evaluateCellZ(srcHostname, d, '*');
if ( this.r !== 0 ) { return this; }
+ d = toBroaderHostname(d);
}
// Any destination + specific-type
diff --git a/src/js/messaging.js b/src/js/messaging.js
index 8bebbc1..acb20f9 100644
--- a/src/js/messaging.js
+++ b/src/js/messaging.js
@@ -145,6 +145,7 @@ var getHostnameDict = function(hostnameToCountMap) {
var getDynamicFilterRules = function(srcHostname, desHostnames) {
var r = {};
var dFiltering = µb.dynamicNetFilteringEngine;
+ r['/ * *'] = dFiltering.evaluateCellZY('*', '*', '*').toFilterString();
r['/ * image'] = dFiltering.evaluateCellZY('*', '*', 'image').toFilterString();
r['/ * inline-script'] = dFiltering.evaluateCellZY('*', '*', 'inline-script').toFilterString();
r['/ * 1p-script'] = dFiltering.evaluateCellZY('*', '*', '1p-script').toFilterString();
@@ -154,6 +155,7 @@ var getDynamicFilterRules = function(srcHostname, desHostnames) {
return r;
}
+ r['. * *'] = dFiltering.evaluateCellZY(srcHostname, '*', '*').toFilterString();
r['. * image'] = dFiltering.evaluateCellZY(srcHostname, '*', 'image').toFilterString();
r['. * inline-script'] = dFiltering.evaluateCellZY(srcHostname, '*', 'inline-script').toFilterString();
r['. * 1p-script'] = dFiltering.evaluateCellZY(srcHostname, '*', '1p-script').toFilterString();
diff --git a/src/js/popup.js b/src/js/popup.js
index 58003ff..6144b95 100644
--- a/src/js/popup.js
+++ b/src/js/popup.js
@@ -33,7 +33,7 @@ var popupData;
var dfPaneBuilt = false;
var popupHeight;
var reIP = /^\d+(?:\.\d+){1,3}$/;
-var reSrcHostnameFromRule = /^d[abn]:([^ ]+) ([^ ]+)/;
+var reSrcHostnameFromRule = /^d[abn]:([^ ]+) ([^ ]+) ([^ ]+)/;
var scopeToSrcHostnameMap = {
'/': '*',
'.': ''
@@ -200,12 +200,13 @@ var updateDynamicFilterCell = function(scope, des, type, rule) {
var ownRule = false;
var matches = reSrcHostnameFromRule.exec(rule);
if ( matches !== null ) {
- ownRule = matches[2] === des &&
- matches[1] === scopeToSrcHostnameMap[scope];
+ ownRule = matches[2] === des &&
+ matches[3] === type &&
+ matches[1] === scopeToSrcHostnameMap[scope];
}
cell.toggleClass('ownRule', ownRule);
- if ( scope !== '.' || type !== '*' ) {
+ if ( scope !== '.' || des === '*' ) {
return;
}
if ( popupData.hostnameDict.hasOwnProperty(des) === false ) {
@@ -269,12 +270,9 @@ var buildAllDynamicFilters = function() {
var key, des;
for ( var i = 0; i < keys.length; i++ ) {
key = keys[i];
- // Specific-type rules -- these are built-in
- if ( key.slice(-1) !== '*' ) {
- continue;
- }
des = key.slice(2, key.indexOf(' ', 2));
- if ( desHostnameDone.hasOwnProperty(des) ) {
+ // Specific-type rules -- these are built-in
+ if ( des === '*' || desHostnameDone.hasOwnProperty(des) ) {
continue;
}
addDynamicFilterRow(des);
diff --git a/src/popup.html b/src/popup.html
index 61ccfbb..4aa4361 100644
--- a/src/popup.html
+++ b/src/popup.html
@@ -26,12 +26,13 @@
<div id="refresh" class="fa">&#xf021;</div>
</div><!-- DO NOT REMOVE --><div>
<div id="dynamicFilteringContainer">
+ <div><span data-i18n="popupAnyRulePrompt"></span><span data-src="/" data-des="*" data-type="*"> </span><span data-src="." data-des="*" data-type="*"></span></div>
<div><span data-i18n="popupImageRulePrompt"></span><span data-src="/" data-des="*" data-type="image"> </span><span data-src="." data-des="*" data-type="image"></span></div>
<div><span data-i18n="popupInlineScriptRulePrompt"></span><span data-src="/" data-des="*" data-type="inline-script"> </span><span data-src="." data-des="*" data-type="inline-script"> </span></div>
<div><span data-i18n="popup1pScriptRulePrompt"></span><span data-src="/" data-des="*" data-type="1p-script"> </span><span data-src="." data-des="*" data-type="1p-script"> </span></div>
<div><span data-i18n="popup3pScriptRulePrompt"></span><span data-src="/" data-des="*" data-type="3p-script"> </span><span data-src="." data-des="*" data-type="3p-script"> </span></div>
<div><span data-i18n="popup3pFrameRulePrompt"></span><span data-src="/" data-des="*" data-type="3p-frame"> </span><span data-src="." data-des="*" data-type="3p-frame"> </span></div>
- <div id="privacyInfo"></div>
+ <div id="privacyInfo" style="display: none;"></div>
</div>
</div>
</div>