From f3dd2ff748ad53e5086ad2140c439b04109d4dd1 Mon Sep 17 00:00:00 2001 From: gorhill Date: Mon, 27 Oct 2014 12:14:57 -0400 Subject: [PATCH] this fixes #340 --- js/popup.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/popup.js b/js/popup.js index 28d3c2f17..158f57937 100644 --- a/js/popup.js +++ b/js/popup.js @@ -53,7 +53,16 @@ var syncDynamicFilter = function(scope, i, result) { var matches = reResultParser.exec(result) || []; var blocked = matches.length !== 0 && matches[1] !== '@@'; el.toggleClass('blocked', blocked); - var ownFilter = matches[3] !== undefined && matches[3] === stats.pageHostname; + + // https://github.com/gorhill/uBlock/issues/340 + // Use dark shade visual cue if the filter is specific to the page hostname + // or one of the ancestor hostname. + var ownFilter = false; + var filterHostname = matches[3] || '*'; + if ( stats.pageHostname.slice(0 - filterHostname.length) === filterHostname ) { + ownFilter = (stats.pageHostname.length === filterHostname.length) || + (stats.pageHostname.substr(0 - filterHostname.length - 1, 1) === '.'); + } el.toggleClass('ownFilter', ownFilter); };