mirror of https://github.com/gorhill/uBlock.git
allow to view list content from blocked-document page
This commit is contained in:
parent
e3870fa64a
commit
8e9fe020b5
|
@ -4,126 +4,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title></title>
|
<title></title>
|
||||||
<link rel="stylesheet" href="css/common.css" type="text/css">
|
<link rel="stylesheet" href="css/common.css" type="text/css">
|
||||||
<style>
|
<link rel="stylesheet" type="text/css" href="css/document-blocked.css">
|
||||||
body {
|
|
||||||
font-size: large;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
opacity: 0.6;
|
|
||||||
}
|
|
||||||
#whyex:hover {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
#whyex a {
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
.proceedChoice {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<a href="https://github.com/gorhill/uBlock/wiki/Strict-blocking" target="_blank"><div id="warningSign"><span class="fa"></span></div></a>
|
<a href="https://github.com/gorhill/uBlock/wiki/Strict-blocking" target="_blank"><div id="warningSign"><span class="fa"></span></div></a>
|
||||||
|
@ -152,8 +33,8 @@ body[dir="rtl"] #theURL > p > span {
|
||||||
<button id="proceedPermanent" data-i18n="docblockedDisablePermanent" type="button"></button></p>
|
<button id="proceedPermanent" data-i18n="docblockedDisablePermanent" type="button"></button></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="display: none;">
|
<div id="templates" style="display: none;">
|
||||||
<span id="proceedTemplate">
|
<span class="proceed">
|
||||||
<span></span>
|
<span></span>
|
||||||
<span class="proceedChoice">
|
<span class="proceedChoice">
|
||||||
<select>
|
<select>
|
||||||
|
@ -164,7 +45,12 @@ body[dir="rtl"] #theURL > p > span {
|
||||||
<span class="proceedChoice code hn"></span>
|
<span class="proceedChoice code hn"></span>
|
||||||
<span></span>
|
<span></span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
<span class="filterList">
|
||||||
|
<span class="filterListSeparator">•</span>
|
||||||
|
<a class="filterListSource" href="" target="_blank"></a> <!--
|
||||||
|
--><a class="fa filterListSupport" href="" target="_blank"></a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script src="js/vapi.js"></script>
|
<script src="js/vapi.js"></script>
|
||||||
<script src="js/vapi-common.js"></script>
|
<script src="js/vapi-common.js"></script>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
||||||
uBlock - a browser extension to block requests.
|
uBlock Origin - a browser extension to block requests.
|
||||||
Copyright (C) 2015 Raymond Hill
|
Copyright (C) 2015-present Raymond Hill
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -59,25 +59,21 @@ var details = {};
|
||||||
if ( Array.isArray(lists) === false || lists.length === 0 ) {
|
if ( Array.isArray(lists) === false || lists.length === 0 ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var parent = uDom.nodeFromSelector('#whyex > span:nth-of-type(2)');
|
let parent = uDom.nodeFromSelector('#whyex > span:nth-of-type(2)');
|
||||||
var separator = '';
|
for ( let i = 0; i < lists.length; i++ ) {
|
||||||
var entry, url, node;
|
let entry = lists[i];
|
||||||
for ( var i = 0; i < lists.length; i++ ) {
|
let elem = document.querySelector('#templates .filterList').cloneNode(true);
|
||||||
entry = lists[i];
|
let source = elem.querySelector('.filterListSource');
|
||||||
if ( separator !== '' ) {
|
source.href = 'asset-viewer.html?url=' + entry.assetKey;
|
||||||
parent.appendChild(document.createTextNode(separator));
|
source.textContent = entry.title;
|
||||||
|
if (
|
||||||
|
typeof entry.supportURL === 'string' &&
|
||||||
|
entry.supportURL !== ''
|
||||||
|
) {
|
||||||
|
elem.querySelector('.filterListSupport')
|
||||||
|
.setAttribute('href', entry.supportURL);
|
||||||
}
|
}
|
||||||
url = entry.supportURL;
|
parent.appendChild(elem);
|
||||||
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');
|
uDom.nodeFromId('whyex').style.removeProperty('display');
|
||||||
};
|
};
|
||||||
|
@ -146,7 +142,7 @@ var proceedPermanent = function() {
|
||||||
if ( matches === null ) {
|
if ( matches === null ) {
|
||||||
return;
|
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(1)').text(matches[1]);
|
||||||
proceed.descendants('span:nth-of-type(4)').text(matches[2]);
|
proceed.descendants('span:nth-of-type(4)').text(matches[2]);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
||||||
uBlock Origin - a browser extension to block requests.
|
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
|
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
|
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 fromNetFilter = function(details) {
|
||||||
var lists = [],
|
var lists = [],
|
||||||
compiledFilter = details.compiledFilter,
|
compiledFilter = details.compiledFilter;
|
||||||
entry, content, pos, notFound;
|
|
||||||
|
|
||||||
for ( var assetKey in listEntries ) {
|
for ( let assetKey in listEntries ) {
|
||||||
entry = listEntries[assetKey];
|
let entry = listEntries[assetKey];
|
||||||
if ( entry === undefined ) { continue; }
|
if ( entry === undefined ) { continue; }
|
||||||
content = extractBlocks(entry.content, 0, 1000);
|
let content = extractBlocks(entry.content, 0, 1000);
|
||||||
pos = 0;
|
let pos = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
pos = content.indexOf(compiledFilter, pos);
|
pos = content.indexOf(compiledFilter, pos);
|
||||||
if ( pos === -1 ) { break; }
|
if ( pos === -1 ) { break; }
|
||||||
// We need an exact match.
|
// We need an exact match.
|
||||||
// https://github.com/gorhill/uBlock/issues/1392
|
// https://github.com/gorhill/uBlock/issues/1392
|
||||||
// https://github.com/gorhill/uBlock/issues/835
|
// 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;
|
pos += compiledFilter.length;
|
||||||
if (
|
if (
|
||||||
notFound ||
|
notFound ||
|
||||||
|
@ -74,6 +73,7 @@ var fromNetFilter = function(details) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
lists.push({
|
lists.push({
|
||||||
|
assetKey: assetKey,
|
||||||
title: entry.title,
|
title: entry.title,
|
||||||
supportURL: entry.supportURL
|
supportURL: entry.supportURL
|
||||||
});
|
});
|
||||||
|
@ -81,7 +81,7 @@ var fromNetFilter = function(details) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var response = {};
|
let response = {};
|
||||||
response[details.rawFilter] = lists;
|
response[details.rawFilter] = lists;
|
||||||
|
|
||||||
postMessage({
|
postMessage({
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
||||||
uBlock Origin - a browser extension to block requests.
|
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
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
Loading…
Reference in New Issue