diff --git a/src/document-blocked.html b/src/document-blocked.html index 8ca604b29..a687fec26 100644 --- a/src/document-blocked.html +++ b/src/document-blocked.html @@ -18,6 +18,9 @@ body > div > p { body > div > p:first-child { margin: 1.5em 0 0 0; } +a { + text-decoration: none; + } .code { background-color: rgba(0, 0, 0, 0.1); display: inline-block; @@ -43,6 +46,16 @@ button { color: #f2a500; font-size: 180px; } +#whyex { + font-size: smaller; + opacity: 0.6; + } +#whyex:hover { + opacity: 1; + } +#whyex a { + white-space: nowrap; +} .proceedChoice { display: inline-block; text-align: left; @@ -61,7 +74,8 @@ select {

-

+

diff --git a/src/js/document-blocked.js b/src/js/document-blocked.js index c04644542..dc0b145be 100644 --- a/src/js/document-blocked.js +++ b/src/js/document-blocked.js @@ -42,6 +42,43 @@ var details = {}; /******************************************************************************/ +(function() { + var onReponseReady = function(response) { + var lists = response.matches; + if ( Array.isArray(lists) === false || lists.length === 0 ) { + return; + } + var parent = uDom.nodeFromSelector('#whyex > span'); + var separator = ''; + var entry, url, node; + for ( var i = 0; i < lists.length; i++ ) { + entry = lists[i]; + if ( separator !== '' ) { + parent.appendChild(document.createTextNode(separator)); + } + url = entry.supportURL; + if ( typeof url === 'string' && url !== '' ) { + node = document.createElement('a'); + node.textContent = entry.title; + node.setAttribute('href', url); + node.setAttribute('target', '_blank'); + } else { + node = document.createTextNode(entry.title); + } + parent.appendChild(node); + separator = ' \u2022 '; + } + uDom.nodeFromId('whyex').style.removeProperty('display'); + }; + + messager.send({ + what: 'reverseLookupFilter', + filter: details.fc + }, onReponseReady); +})(); + +/******************************************************************************/ + var getTargetHostname = function() { var hostname = details.hn; var elem = document.querySelector('#proceed select'); @@ -103,8 +140,8 @@ var proceedPermanent = function() { /******************************************************************************/ -uDom('.what').text(details.url); -uDom('#why').text(details.why); +uDom.nodeFromSelector('.what').textContent = details.url; +uDom.nodeFromId('why').textContent = details.fs; if ( window.history.length > 1 ) { uDom('#back').on('click', function() { window.history.back(); }); diff --git a/src/js/traffic.js b/src/js/traffic.js index 164eeefc8..9a1969c01 100644 --- a/src/js/traffic.js +++ b/src/js/traffic.js @@ -219,12 +219,15 @@ var onBeforeRootFrameRequest = function(details) { return; } + var compiled = result.slice(3); + // Blocked var query = btoa(JSON.stringify({ url: requestURL, hn: requestHostname, dn: requestDomain, - why: µb.staticNetFilteringEngine.filterStringFromCompiled(result.slice(3)) + fc: compiled, + fs: µb.staticNetFilteringEngine.filterStringFromCompiled(compiled) })); vAPI.tabs.replace(tabId, vAPI.getURL('document-blocked.html?details=') + query);