1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-14 23:12:28 +02:00
This commit is contained in:
gorhill 2015-06-11 19:33:30 -04:00
parent 2619d31e63
commit 5d4f96314a
3 changed files with 58 additions and 4 deletions

View File

@ -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 {
<div>
<p data-i18n="docblockedPrompt2"></p>
<p id="why" class="code"></p>
<p id="why" class="code"></p><!--
--><span id="whyex" style="display: none;"><br>&#x2022; <span></span> &#x2022;</span>
</div>
<div>

View File

@ -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(); });

View File

@ -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);