diff --git a/src/css/document-blocked.css b/src/css/document-blocked.css
new file mode 100644
index 000000000..1fb56fc05
--- /dev/null
+++ b/src/css/document-blocked.css
@@ -0,0 +1,153 @@
+/**
+ uBlock Origin - a browser extension to block requests.
+ Copyright (C) 2018-present Raymond Hill
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see {http://www.gnu.org/licenses/}.
+
+ Home: https://github.com/gorhill/uBlock
+*/
+
+body {
+ font-size: large;
+ text-align: center;
+ }
+
+@media (max-height: 640px) {
+ body {
+ font-size: small;
+ }
+}
+body > div {
+ margin: 1.5em 0;
+ }
+body > div > p,
+body > div > div {
+ margin: 4px 0;
+ }
+body > div > p:first-child {
+ margin: 1.5em 0 0 0;
+ }
+a {
+ text-decoration: none;
+ }
+button {
+ cursor: pointer;
+ margin: 0 1em 0.25em 1em;
+ padding: 0.25em 0.5em;
+ font-size: inherit;
+ }
+select {
+ font: inherit;
+ padding: 2px;
+ }
+.code {
+ background-color: rgba(0, 0, 0, 0.1);
+ font-family: monospace;
+ font-size: large;
+ line-height: 1;
+ padding: 4px;
+ word-break: break-all;
+ }
+#warningSign {
+ opacity: 1;
+ pointer-events: none;
+ width: 100%;
+ }
+#warningSign > span {
+ color: #f2a500;
+ font-size: 10em;
+ }
+#theURL {
+ padding: 0;
+ }
+#theURL > * {
+ margin: 0;
+ }
+#theURL > p {
+ position: relative;
+ z-index: 10;
+ }
+#theURL > p > span {
+ background-color: transparent;
+ top: 100%;
+ box-sizing: border-box;
+ cursor: pointer;
+ opacity: 0.5;
+ padding: 0.2em;
+ position: absolute;
+ transform: translate(0, -50%);
+ }
+body[dir="ltr"] #theURL > p > span {
+ right: 0;
+ }
+body[dir="rtl"] #theURL > p > span {
+ left: 0;
+ }
+#theURL > p:hover > span {
+ opacity: 1;
+ }
+#theURL > p > span:before {
+ content: '\f010';
+ }
+#theURL.collapsed > p > span:before {
+ content: '\f00e';
+ }
+#parsed {
+ background-color: #f8f8f8;
+ border: 1px solid rgba(0, 0, 0, 0.1);
+ border-top: none;
+ color: gray;
+ font-size: small;
+ overflow-x: hidden;
+ padding: 4px;
+ text-align: initial;
+ text-overflow: ellipsis;
+ }
+#theURL.collapsed > #parsed {
+ display: none;
+ }
+#parsed ul, #parsed li {
+ list-style-type: none;
+ }
+#parsed li {
+ white-space: nowrap;
+ }
+#parsed span {
+ display: inline-block;
+ }
+#parsed span:first-of-type {
+ font-weight: bold;
+ }
+#whyex {
+ font-size: smaller;
+ }
+#whyex a {
+ white-space: nowrap;
+}
+.proceedChoice {
+ text-align: left;
+ }
+
+.filterList a {
+ opacity: 0.8;
+ }
+.filterList a:hover {
+ opacity: 1;
+ }
+.filterList:first-child .filterListSeparator {
+ display: none;
+ }
+.filterList .filterListSupport[href=""] {
+ display: none;
+ }
diff --git a/src/document-blocked.html b/src/document-blocked.html
index 156ea6b15..26dccd2cb 100644
--- a/src/document-blocked.html
+++ b/src/document-blocked.html
@@ -2,128 +2,10 @@
+
-
+
@@ -152,8 +34,8 @@
-
-
+
+
-
+
+ •
+
+
+
diff --git a/src/js/document-blocked.js b/src/js/document-blocked.js
index 6657a027f..b7a44e7be 100644
--- a/src/js/document-blocked.js
+++ b/src/js/document-blocked.js
@@ -1,7 +1,7 @@
/*******************************************************************************
- uBlock - a browser extension to block requests.
- Copyright (C) 2015 Raymond Hill
+ uBlock Origin - a browser extension to block requests.
+ Copyright (C) 2015-present Raymond Hill
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,12 +21,12 @@
/* global uDom */
+'use strict';
+
/******************************************************************************/
(function() {
-'use strict';
-
/******************************************************************************/
var messaging = vAPI.messaging;
@@ -44,14 +44,11 @@ var details = {};
(function() {
var onReponseReady = function(response) {
- if ( typeof response !== 'object' ) {
- return;
- }
- var lists;
- for ( var rawFilter in response ) {
- if ( response.hasOwnProperty(rawFilter) === false ) {
- continue;
- }
+ if ( response instanceof Object === false ) { return; }
+
+ let lists;
+ for ( let rawFilter in response ) {
+ if ( response.hasOwnProperty(rawFilter) === false ) { continue; }
lists = response[rawFilter];
break;
}
@@ -59,25 +56,22 @@ var details = {};
if ( Array.isArray(lists) === false || lists.length === 0 ) {
return;
}
- var parent = uDom.nodeFromSelector('#whyex > span:nth-of-type(2)');
- 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);
+
+ let parent = uDom.nodeFromSelector('#whyex > span:nth-of-type(2)');
+ for ( let list of lists ) {
+ let elem = document.querySelector('#templates .filterList')
+ .cloneNode(true);
+ let source = elem.querySelector('.filterListSource');
+ source.href += encodeURIComponent(list.assetKey);
+ source.textContent = list.title;
+ if (
+ typeof list.supportURL === 'string' &&
+ list.supportURL !== ''
+ ) {
+ elem.querySelector('.filterListSupport')
+ .setAttribute('href', list.supportURL);
}
- parent.appendChild(node);
- separator = ' \u2022 ';
+ parent.appendChild(elem);
}
uDom.nodeFromId('whyex').style.removeProperty('display');
};
@@ -146,7 +140,7 @@ var proceedPermanent = function() {
if ( matches === null ) {
return;
}
- var proceed = uDom('#proceedTemplate').clone();
+ var proceed = uDom('#templates .proceed').clone();
proceed.descendants('span:nth-of-type(1)').text(matches[1]);
proceed.descendants('span:nth-of-type(4)').text(matches[2]);
diff --git a/src/js/reverselookup-worker.js b/src/js/reverselookup-worker.js
index 52679ab5b..2f847a1ca 100644
--- a/src/js/reverselookup-worker.js
+++ b/src/js/reverselookup-worker.js
@@ -1,7 +1,7 @@
/*******************************************************************************
uBlock Origin - a browser extension to block requests.
- Copyright (C) 2015-2017 Raymond Hill
+ Copyright (C) 2015-present Raymond Hill
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -51,21 +51,20 @@ var extractBlocks = function(content, begId, endId) {
var fromNetFilter = function(details) {
var lists = [],
- compiledFilter = details.compiledFilter,
- entry, content, pos, notFound;
+ compiledFilter = details.compiledFilter;
- for ( var assetKey in listEntries ) {
- entry = listEntries[assetKey];
+ for ( let assetKey in listEntries ) {
+ let entry = listEntries[assetKey];
if ( entry === undefined ) { continue; }
- content = extractBlocks(entry.content, 0, 1000);
- pos = 0;
+ let content = extractBlocks(entry.content, 0, 1000);
+ let pos = 0;
for (;;) {
pos = content.indexOf(compiledFilter, pos);
if ( pos === -1 ) { break; }
// We need an exact match.
// https://github.com/gorhill/uBlock/issues/1392
// https://github.com/gorhill/uBlock/issues/835
- notFound = pos !== 0 && content.charCodeAt(pos - 1) !== 0x0A;
+ let notFound = pos !== 0 && content.charCodeAt(pos - 1) !== 0x0A;
pos += compiledFilter.length;
if (
notFound ||
@@ -74,6 +73,7 @@ var fromNetFilter = function(details) {
continue;
}
lists.push({
+ assetKey: assetKey,
title: entry.title,
supportURL: entry.supportURL
});
@@ -81,7 +81,7 @@ var fromNetFilter = function(details) {
}
}
- var response = {};
+ let response = {};
response[details.rawFilter] = lists;
postMessage({
diff --git a/src/js/reverselookup.js b/src/js/reverselookup.js
index ebe73d56c..d407f853e 100644
--- a/src/js/reverselookup.js
+++ b/src/js/reverselookup.js
@@ -1,7 +1,7 @@
/*******************************************************************************
uBlock Origin - a browser extension to block requests.
- Copyright (C) 2015-2017 Raymond Hill
+ Copyright (C) 2015-present Raymond Hill
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by