1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-18 08:52:26 +02:00
This commit is contained in:
gorhill 2016-11-05 14:48:42 -04:00
parent 9b1846749e
commit 446d7fad2e
13 changed files with 185 additions and 159 deletions

View File

@ -6,7 +6,6 @@ div > p:last-child {
} }
.userFilters { .userFilters {
box-sizing: border-box; box-sizing: border-box;
font-size: small;
height: 60vh; height: 60vh;
text-align: left; text-align: left;
white-space: pre; white-space: pre;

View File

@ -41,7 +41,6 @@ body[dir=rtl] #lists {
display: none; display: none;
} }
li.listEntry { li.listEntry {
font-size: 14px;
margin: 0 auto 0 auto; margin: 0 auto 0 auto;
margin-left: 3em; margin-left: 3em;
margin-right: 0em; margin-right: 0em;
@ -67,7 +66,7 @@ li.listEntry > a:nth-of-type(2):hover {
opacity: 1; opacity: 1;
} }
li.listEntry > a:nth-of-type(3) { li.listEntry > a:nth-of-type(3) {
font-size: 13px; font-size: smaller;
opacity: 0.5; opacity: 0.5;
} }
.dim { .dim {
@ -121,7 +120,6 @@ body[dir=rtl] #externalListsDiv {
} }
#externalLists { #externalLists {
box-sizing: border-box; box-sizing: border-box;
font-size: smaller;
height: 10em; height: 10em;
white-space: pre; white-space: pre;
width: 100%; width: 100%;

View File

@ -6,7 +6,6 @@ div > p:last-child {
} }
textarea { textarea {
box-sizing: border-box; box-sizing: border-box;
font-size: smaller;
height: 60vh; height: 60vh;
text-align: left; text-align: left;
white-space: pre; white-space: pre;

View File

@ -15,7 +15,10 @@
body { body {
background-color: white; background-color: white;
color: black; color: black;
font: 14px/1.3 sans-serif; font: 14px "Noto Sans",sans-serif;
}
textarea {
font-size: 90%;
} }
/* I designed the button with: http://charliepark.org/bootstrap_buttons/ */ /* I designed the button with: http://charliepark.org/bootstrap_buttons/ */
button.custom { button.custom {

View File

@ -9,7 +9,6 @@ html, body {
} }
#dashboard-nav { #dashboard-nav {
border: 0; border: 0;
font-size: 16px;
margin: 0; margin: 0;
padding: 0; padding: 0;
top: 0; top: 0;
@ -36,7 +35,7 @@ html, body {
color: black; color: black;
cursor: pointer; cursor: pointer;
display: inline-block; display: inline-block;
font: inherit; font-size: 110%;
margin: 0; margin: 0;
padding: 4px; padding: 4px;
position: relative; position: relative;

View File

@ -15,13 +15,12 @@ code {
margin: 0; margin: 0;
padding: 0.5em 0 0 0; padding: 0.5em 0 0 0;
white-space: nowrap; white-space: nowrap;
font-size: 0; /* otherwise spaces between inline-blocks will be rendered */
} }
#diff .pane { #diff .pane {
border: 0; border: 0;
box-sizing: border-box; box-sizing: border-box;
display: inline-block; display: inline-block;
font: 12px/1.8 monospace; font: 90%/180% "Noto Mono",monospace;
margin: 0; margin: 0;
padding: 0; padding: 0;
position: relative; position: relative;
@ -143,27 +142,26 @@ body[dir="rtl"] #commitButton:before {
#diff textarea { #diff textarea {
background-color: #f8f8ff; background-color: #f8f8ff;
border: 0; border: 0;
color: black;
margin: 0;
border-top: 1px solid #eee; border-top: 1px solid #eee;
box-sizing: border-box;
color: black;
direction: ltr; direction: ltr;
font: 12px monospace; font: inherit;
line-height: 1.8; height: 100%;
left: 0;
margin: 0;
overflow: hidden; overflow: hidden;
overflow-y: auto; overflow-y: auto;
padding: 1em 0 0 3px; /* same left and top padding as ul/li */ padding: 1em 0 0 3px; /* same left and top padding as ul/li */
position: absolute; position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-sizing: border-box;
resize: none; resize: none;
top: 0;
visibility: hidden; visibility: hidden;
white-space: pre; /* this implies nowrap; break only on \n and <br>. white-space: pre; /* this implies nowrap; break only on \n and <br>.
nowrap doesn't consistently nowrap doesn't consistently
respect \n's (example: Safari) per the CSS spec: respect \n's (example: Safari) per the CSS spec:
http://www.w3.org/wiki/CSS/Properties/white-space */ http://www.w3.org/wiki/CSS/Properties/white-space */
width: 100%;
word-wrap: normal; word-wrap: normal;
} }
#diff.edit textarea { #diff.edit textarea {

View File

@ -23,10 +23,11 @@ h2 {
background-color: #eee; background-color: #eee;
border: 0; border: 0;
color: #666; color: #666;
font-size: 14px; cursor: pointer;
font-size: 100%;
font-weight: normal; font-weight: normal;
margin: 1em 0 0.5em 0; margin: 1em 0 0.8em 0;
padding: 2px 0; padding: 0.2em;
text-align: center; text-align: center;
} }
h2:nth-of-type(1) { h2:nth-of-type(1) {
@ -45,20 +46,22 @@ a {
color: #bbb; color: #bbb;
cursor: pointer; cursor: pointer;
display: block; display: block;
font-size: 12px; font-size: 85%;
line-height: 12px; line-height: 1.2;
margin: 0; margin: 0;
padding: 3px 0; padding: calc(0.1em + 1px) 0;
position: relative; position: relative;
text-align: center; text-align: center;
} }
#version { #version {
font-size: 10px; font-size: 90%;
font-weight: normal; font-weight: normal;
} }
#gotoPrefs > span:nth-of-type(3) { #gotoPrefs > span:nth-of-type(3) {
opacity: 0.5; opacity: 0.5;
position: absolute; position: absolute;
top: 50%;
transform: translate(0, -50%);
} }
body[dir="ltr"] #gotoPrefs > span:nth-of-type(3) { body[dir="ltr"] #gotoPrefs > span:nth-of-type(3) {
left: 3px; left: 3px;
@ -94,7 +97,7 @@ body[dir="rtl"] #panes > div {
#panes > div:nth-of-type(2) { #panes > div:nth-of-type(2) {
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
width: 320px; width: 24em;
} }
/** /**
Scroll bar to the left. Scroll bar to the left.
@ -118,20 +121,23 @@ body.portrait[dir="ltr"] #panes > div:nth-of-type(2) {
display: none; display: none;
} }
#panes > div:nth-of-type(1) { #panes > div:nth-of-type(1) {
min-width: 160px; min-width: 11em;
padding: 0; padding: 0;
} }
p { p {
text-align: center; text-align: center;
white-space: nowrap; white-space: nowrap;
} }
.fa {
font-size: 120%;
}
#switch { #switch {
margin: 8px 0; margin: 8px 0;
} }
#switch .fa { #switch .fa {
color: #0046ff; color: #0046ff;
cursor: pointer; cursor: pointer;
font-size: 96px; font-size: 700%;
margin: 0; margin: 0;
} }
#switch .fa:hover { #switch .fa:hover {
@ -141,16 +147,15 @@ body.off #switch .fa {
color: #ccc; color: #ccc;
} }
#page-blocked { #page-blocked {
font-size: 20px; font-size: 1.25em;
} }
.statName { .statName {
color: #888; color: #888;
font-size: small; font-size: 85%;
margin: 1em 0.2em 0.2em 0.2em; margin: 0.8em 0.2em 0.1em 0.2em;
text-align: center; text-align: center;
} }
.statValue { .statValue {
font-size: 14px;
margin: 0; margin: 0;
text-align: center; text-align: center;
} }
@ -158,7 +163,6 @@ body.off #switch .fa {
color: #aaa; color: #aaa;
cursor: pointer; cursor: pointer;
display: none; display: none;
font-size: 14px;
unicode-bidi: embed; unicode-bidi: embed;
} }
.tool.enabled { .tool.enabled {
@ -171,21 +175,20 @@ body.off #switch .fa {
background-color: #eee; background-color: #eee;
border: 0; border: 0;
color: #aaa; color: #aaa;
font-weight: normal; margin: 0.8em 0 0 0;
margin: 1em 0 0 0; padding: 4px 0;
padding: 4px 0 2px 0;
text-align: center; text-align: center;
} }
#extraTools > span { #extraTools > span {
cursor: pointer; cursor: pointer;
font-size: 18px; font-size: 1.2em;
margin: 0 0.45em; margin: 0 0.4em;
position: relative; position: relative;
} }
#extraTools > span > span.badge { #extraTools > span > span.badge {
color: #222; color: #222;
bottom: -1px; bottom: -1px;
font: 10.5px sans-serif; font: x-small sans-serif;
position: absolute; position: absolute;
} }
body[dir="ltr"] #extraTools > span > span.badge { body[dir="ltr"] #extraTools > span > span.badge {
@ -196,7 +199,7 @@ body[dir="rtl"] #extraTools > span > span.badge {
} }
#extraTools > span.on > span:last-of-type { #extraTools > span.on > span:last-of-type {
color: #e00; color: #e00;
font-size: 20px; font-size: 1.1em;
left: 0; left: 0;
position: absolute; position: absolute;
text-align: center; text-align: center;
@ -210,17 +213,6 @@ body[dir="rtl"] #extraTools > span > span.badge {
color: #444; color: #444;
} }
body.advancedUser h2 {
cursor: pointer;
}
body.advancedUser h2:before {
color: #aaa;
content: '+ ';
}
body.advancedUser #panes.dfEnabled h2:before {
content: '\2212 ';
}
#refresh { #refresh {
background-color: #ffe; background-color: #ffe;
border: 1px solid #ddc; border: 1px solid #ddc;
@ -278,7 +270,7 @@ body[dir="rtl"] #tooltip {
#firewallContainer { #firewallContainer {
border: 0; border: 0;
font-size: 13px; font-size: 85%;
margin: 0; margin: 0;
padding: 0; padding: 0;
text-align: right; text-align: right;
@ -286,7 +278,6 @@ body[dir="rtl"] #tooltip {
#firewallContainer > div { #firewallContainer > div {
background-color: #e6e6e6; background-color: #e6e6e6;
border: 0; border: 0;
border-bottom: 1px solid white;
direction: ltr; direction: ltr;
margin: 0; margin: 0;
padding: 0; padding: 0;
@ -294,54 +285,46 @@ body[dir="rtl"] #tooltip {
#firewallContainer > div:hover { #firewallContainer > div:hover {
background-color: #f0f0f0; background-color: #f0f0f0;
} }
#firewallContainer > div:first-child ~ div:not([class]) {
display: none;
}
#firewallContainer.minimized > div.isSubDomain { #firewallContainer.minimized > div.isSubDomain {
display: none; display: none;
} }
#firewallContainer > div > span { #firewallContainer > div > span {
background-color: transparent; background-color: transparent;
border: none; border: none;
border-bottom: 1px solid white;
box-sizing: border-box; box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
color: #000; color: #000;
display: inline-block; display: inline-block;
height: 22px; height: 1.9em;
line-height: 22px; line-height: 1.9em;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
vertical-align: middle; vertical-align: top;
}
#firewallContainer > div:nth-of-type(1) > span {
height: 18px;
line-height: 20px;
} }
#firewallContainer > div:nth-of-type(1) > span:nth-of-type(1) { #firewallContainer > div:nth-of-type(1) > span:nth-of-type(1) {
cursor: pointer; cursor: pointer;
} }
#firewallContainer > div > span:nth-of-type(1) { #firewallContainer > div > span:nth-of-type(1) {
border-right: 1px solid white;
padding-right: 2px; padding-right: 2px;
position: relative; position: relative;
text-overflow: ellipsis; text-overflow: ellipsis;
width: 70%; width: calc(100% - 4em);
} }
#firewallContainer > div > span:nth-of-type(2), #firewallContainer > div > span:nth-of-type(2) {
#firewallContainer > div > span:nth-of-type(3), display: none;
#firewallContainer > div > span:nth-of-type(4) {
cursor: pointer;
width: 15%;
} }
#firewallContainer > div > span:nth-of-type(3), #firewallContainer > div > span:nth-of-type(1) ~ span {
#firewallContainer > div > span:nth-of-type(4) {
border-left: 1px solid white; border-left: 1px solid white;
color: #444; width: 4em;
font-family: monospace;
font-size: 11.5px;
text-align: center;
} }
body.portrait #firewallContainer > div > span:nth-of-type(3), #firewallContainer > div > span:nth-of-type(3),
body.portrait #firewallContainer > div > span:nth-of-type(4) { #firewallContainer > div > span:nth-of-type(4) {
font-family: monospace; color: #444;
font-size: 9px; text-align: center;
} }
#firewallContainer > div > span:nth-of-type(4) { #firewallContainer > div > span:nth-of-type(4) {
display: none; display: none;
@ -363,6 +346,50 @@ body.portrait #firewallContainer > div > span:nth-of-type(4) {
#firewallContainer.minimized > div.isDomain > span:nth-of-type(4) { #firewallContainer.minimized > div.isDomain > span:nth-of-type(4) {
display: inline-block; display: inline-block;
} }
#firewallContainer > div > span[data-acount]:before,
#firewallContainer > div > span[data-bcount]:after {
font-family: "Noto Mono",monospace;
position: absolute;
top: 50%;
transform: translate(0, -50%);
}
#firewallContainer > div > span[data-acount]:before {
left: 0.1em;
}
#firewallContainer > div > span[data-acount="1"]:before {
content: '+';
}
#firewallContainer > div > span[data-acount="2"]:before {
content: '++';
}
#firewallContainer > div > span[data-acount="3"]:before {
content: '+++';
}
#firewallContainer > div > span[data-bcount]:after {
right: 0.1em;
}
#firewallContainer > div > span[data-bcount="1"]:after {
content: '\2212';
}
#firewallContainer > div > span[data-bcount="2"]:after {
content: '\2212\2212';
}
#firewallContainer > div > span[data-bcount="3"]:after {
content: '\2212\2212\2212';
}
body.advancedUser #firewallContainer > div > span:nth-of-type(1) {
width: calc(100% - 8em);
}
body.advancedUser #firewallContainer > div > span:nth-of-type(2) {
display: inline-block;
}
body.advancedUser #firewallContainer > div:first-child ~ div:not([class]) {
display: block;
}
body.advancedUser #firewallContainer > div > span:nth-of-type(1) ~ span {
cursor: pointer;
}
/** /**
Small coloured label at the left of a row Small coloured label at the left of a row
@ -405,40 +432,40 @@ body.portrait #firewallContainer > div > span:nth-of-type(4) {
background-color: rgb(192, 160, 0); background-color: rgb(192, 160, 0);
} }
/* Rule cells */ /* Rule cells */
#firewallContainer > div > span.aRule { body.advancedUser #firewallContainer > div > span.aRule {
background-color: rgba(0, 160, 0, 0.3); background-color: rgba(0, 160, 0, 0.3);
} }
#firewallContainer.colorBlind > div > span.aRule { body.advancedUser #firewallContainer.colorBlind > div > span.aRule {
background-color: rgba(255, 194, 57, 0.4); background-color: rgba(255, 194, 57, 0.4);
} }
#firewallContainer > div > span.bRule { body.advancedUser #firewallContainer > div > span.bRule {
background-color: rgba(192, 0, 0, 0.3); background-color: rgba(192, 0, 0, 0.3);
} }
#firewallContainer.colorBlind > div > span.bRule { body.advancedUser #firewallContainer.colorBlind > div > span.bRule {
background-color: rgba(0, 19, 110, 0.4); background-color: rgba(0, 19, 110, 0.4);
} }
#firewallContainer > div > span.nRule { body.advancedUser #firewallContainer > div > span.nRule {
background-color: rgba(108, 108, 108, 0.3); background-color: rgba(108, 108, 108, 0.3);
} }
#firewallContainer.colorBlind > div > span.nRule { body.advancedUser #firewallContainer.colorBlind > div > span.nRule {
background-color: rgba(96, 96, 96, 0.4); background-color: rgba(96, 96, 96, 0.4);
} }
#firewallContainer > div > span.ownRule { body.advancedUser #firewallContainer > div > span.ownRule {
color: white; color: white;
} }
#firewallContainer > div > span.aRule.ownRule { body.advancedUser #firewallContainer > div > span.aRule.ownRule {
background-color: rgba(0, 160, 0, 1); background-color: rgba(0, 160, 0, 1);
} }
#firewallContainer.colorBlind > div > span.aRule.ownRule { body.advancedUser #firewallContainer.colorBlind > div > span.aRule.ownRule {
background-color: rgba(255, 194, 57, 1); background-color: rgba(255, 194, 57, 1);
} }
#firewallContainer > div > span.bRule.ownRule { body.advancedUser #firewallContainer > div > span.bRule.ownRule {
background-color: rgba(192, 0, 0, 1); background-color: rgba(192, 0, 0, 1);
} }
#firewallContainer.colorBlind > div > span.bRule.ownRule { body.advancedUser #firewallContainer.colorBlind > div > span.bRule.ownRule {
background-color: rgba(0, 19, 110, 1); background-color: rgba(0, 19, 110, 1);
} }
#firewallContainer > div > span.nRule.ownRule { body.advancedUser #firewallContainer > div > span.nRule.ownRule {
background-color: rgba(108, 108, 108, 1); background-color: rgba(108, 108, 108, 1);
} }
@ -446,14 +473,23 @@ body.portrait #firewallContainer > div > span:nth-of-type(4) {
bottom: 0; bottom: 0;
left: 0; left: 0;
position: absolute; position: absolute;
right: 0;
top: 0; top: 0;
width: 4em;
z-index: 1;
} }
#actionSelector > span { #actionSelector > span {
display: inline-block; display: inline-block;
height: 22px; height: 100%;
opacity: 0.2; opacity: 0.2;
width: 33.33%; }
#actionSelector > span:nth-of-type(1) {
width: 33%;
}
#actionSelector > span:nth-of-type(2) {
width: 33.5%;
}
#actionSelector > span:nth-of-type(3) {
width: 33.5%;
} }
#actionSelector > span:hover { #actionSelector > span:hover {
opacity: 0.75; opacity: 0.75;
@ -490,7 +526,7 @@ body.portrait #firewallContainer > div > span:nth-of-type(4) {
border-radius: 4px; border-radius: 4px;
cursor: pointer; cursor: pointer;
display: inline-block; display: inline-block;
font-size: 1.7em; font-size: 1.8em;
line-height: 1.0; line-height: 1.0;
margin: 0; margin: 0;
margin-right: 0.1em; margin-right: 0.1em;

View File

@ -6,7 +6,6 @@ div > p:last-child {
} }
#whitelist { #whitelist {
box-sizing: border-box; box-sizing: border-box;
font-size: small;
height: 60vh; height: 60vh;
text-align: left; text-align: left;
white-space: pre; white-space: pre;

View File

@ -56,7 +56,7 @@ return {
collapseBlocked: true, collapseBlocked: true,
colorBlindFriendly: false, colorBlindFriendly: false,
contextMenuEnabled: true, contextMenuEnabled: true,
dynamicFilteringEnabled: true, dynamicFilteringEnabled: false,
externalLists: defaultExternalLists, externalLists: defaultExternalLists,
firewallPaneMinimized: true, firewallPaneMinimized: true,
hyperlinkAuditingDisabled: true, hyperlinkAuditingDisabled: true,

View File

@ -90,9 +90,6 @@ var scopeToSrcHostnameMap = {
'/': '*', '/': '*',
'.': '' '.': ''
}; };
var threePlus = '+++';
var threeMinus = '';
var sixSpace = '\u2007\u2007\u2007\u2007\u2007\u2007';
var dfHotspots = null; var dfHotspots = null;
var hostnameToSortableTokenMap = {}; var hostnameToSortableTokenMap = {};
var allDomains = {}; var allDomains = {};
@ -226,17 +223,15 @@ var addFirewallRow = function(des) {
var updateFirewallCell = function(scope, des, type, rule) { var updateFirewallCell = function(scope, des, type, rule) {
var selector = '#firewallContainer span[data-src="' + scope + '"][data-des="' + des + '"][data-type="' + type + '"]'; var selector = '#firewallContainer span[data-src="' + scope + '"][data-des="' + des + '"][data-type="' + type + '"]';
var cell = uDom(selector); var cells = uDom(selector);
if ( cells.length === 0 ) {
// This should not happen
if ( cell.length === 0 ) {
return; return;
} }
cell.removeClass(); cells.removeClass();
var action = rule.charAt(1); var action = rule.charAt(1);
if ( action !== '' ) { if ( action !== '' ) {
cell.toggleClass(action + 'Rule', true); cells.toggleClass(action + 'Rule', true);
} }
// Use dark shade visual cue if the rule is specific to the cell. // Use dark shade visual cue if the rule is specific to the cell.
@ -247,54 +242,47 @@ var updateFirewallCell = function(scope, des, type, rule) {
(matches[2] === des) && (matches[2] === des) &&
(matches[1] === scopeToSrcHostnameMap[scope]); (matches[1] === scopeToSrcHostnameMap[scope]);
} }
cell.toggleClass('ownRule', ownRule); cells.toggleClass('ownRule', ownRule);
if ( scope !== '.' || des === '*' ) { if ( scope !== '.' || des === '*' ) {
return; return;
} }
// IMPORTANT: It is completely assumed the first node is a TEXT_NODE, so
// ensure this in the HTML file counterpart when you make
// changes
var textNode = cell.nodeAt(0).firstChild;
// Remember this may be a cell from a reused row, we need to clear text // Remember this may be a cell from a reused row, we need to clear text
// content if we can't compute request counts. // content if we can't compute request counts.
if ( popupData.hostnameDict.hasOwnProperty(des) === false ) { if ( popupData.hostnameDict.hasOwnProperty(des) === false ) {
textNode.nodeValue = ' '; cells.removeAttr('data-acount');
cells.removeAttr('data-acount');
return; return;
} }
var hnDetails = popupData.hostnameDict[des]; var hnDetails = popupData.hostnameDict[des],
var aCount = hnDetails.allowCount; cell = cells.nodeAt(0);
var bCount = hnDetails.blockCount; if ( hnDetails.allowCount !== 0 ) {
if ( aCount !== 0 || bCount !== 0 ) { cell.setAttribute('data-acount', Math.min(Math.ceil(Math.log(hnDetails.allowCount + 1) / Math.LN10), 3));
// https://github.com/chrisaljoudi/uBlock/issues/471
aCount = Math.min(Math.ceil(Math.log(aCount + 1) / Math.LN10), 3);
bCount = Math.min(Math.ceil(Math.log(bCount + 1) / Math.LN10), 3);
textNode.nodeValue = threePlus.slice(0, aCount) +
sixSpace.slice(aCount + bCount) +
threeMinus.slice(0, bCount);
} else { } else {
textNode.nodeValue = ' '; cell.removeAttribute('data-acount');
}
if ( hnDetails.blockCount !== 0 ) {
cell.setAttribute('data-bcount', Math.min(Math.ceil(Math.log(hnDetails.blockCount + 1) / Math.LN10), 3));
} else {
cell.removeAttribute('data-bcount');
} }
if ( hnDetails.domain !== des ) { if ( hnDetails.domain !== des ) {
return; return;
} }
textNode = cell.nodeAt(1).firstChild; cell = cells.nodeAt(1);
aCount = hnDetails.totalAllowCount; if ( hnDetails.totalAllowCount !== 0 ) {
bCount = hnDetails.totalBlockCount; cell.setAttribute('data-acount', Math.min(Math.ceil(Math.log(hnDetails.totalAllowCount + 1) / Math.LN10), 3));
if ( aCount !== 0 || bCount !== 0 ) {
// https://github.com/chrisaljoudi/uBlock/issues/471
aCount = Math.min(Math.ceil(Math.log(aCount + 1) / Math.LN10), 3);
bCount = Math.min(Math.ceil(Math.log(bCount + 1) / Math.LN10), 3);
textNode.nodeValue = threePlus.slice(0, aCount) +
sixSpace.slice(aCount + bCount) +
threeMinus.slice(0, bCount);
} else { } else {
textNode.nodeValue = ' '; cell.removeAttribute('data-acount');
}
if ( hnDetails.totalBlockCount !== 0 ) {
cell.setAttribute('data-bcount', Math.min(Math.ceil(Math.log(hnDetails.totalBlockCount + 1) / Math.LN10), 3));
} else {
cell.removeAttribute('data-bcount');
} }
}; };
@ -342,7 +330,7 @@ var buildAllFirewallRows = function() {
addFirewallRow(allHostnameRows[i]); addFirewallRow(allHostnameRows[i]);
} }
if ( dfPaneBuilt !== true ) { if ( dfPaneBuilt !== true && popupData.advancedUserEnabled ) {
uDom('#firewallContainer') uDom('#firewallContainer')
.on('click', 'span[data-src]', unsetFirewallRuleHandler) .on('click', 'span[data-src]', unsetFirewallRuleHandler)
.on('mouseenter', '[data-src]', mouseenterCellHandler) .on('mouseenter', '[data-src]', mouseenterCellHandler)
@ -388,16 +376,6 @@ var renderPrivacyExposure = function() {
desHostnameDone[des] = true; desHostnameDone[des] = true;
} }
// Domain of the page must always be included (if there is one)
if (
allDomains.hasOwnProperty(popupData.pageDomain) === false &&
reNetworkRelatedURL.test(popupData.rawURL)
) {
allHostnameRows.push(popupData.pageDomain);
allDomains[popupData.pageDomain] = false;
allDomainCount += 1;
}
var summary = domainsHitStr.replace('{{count}}', touchedDomainCount.toLocaleString()) var summary = domainsHitStr.replace('{{count}}', touchedDomainCount.toLocaleString())
.replace('{{total}}', allDomainCount.toLocaleString()); .replace('{{total}}', allDomainCount.toLocaleString());
uDom.nodeFromId('popupHitDomainCount').textContent = summary; uDom.nodeFromId('popupHitDomainCount').textContent = summary;
@ -482,7 +460,7 @@ var renderPopup = function() {
// https://github.com/chrisaljoudi/uBlock/issues/470 // https://github.com/chrisaljoudi/uBlock/issues/470
// This must be done here, to be sure the popup is resized properly // This must be done here, to be sure the popup is resized properly
var dfPaneVisible = popupData.dfEnabled && popupData.advancedUserEnabled; var dfPaneVisible = popupData.dfEnabled;
// https://github.com/chrisaljoudi/uBlock/issues/1068 // https://github.com/chrisaljoudi/uBlock/issues/1068
// Remember the last state of the firewall pane. This allows to // Remember the last state of the firewall pane. This allows to
@ -590,9 +568,6 @@ var gotoURL = function(ev) {
/******************************************************************************/ /******************************************************************************/
var toggleFirewallPane = function() { var toggleFirewallPane = function() {
if ( popupData.advancedUserEnabled === false ) {
return;
}
popupData.dfEnabled = !popupData.dfEnabled; popupData.dfEnabled = !popupData.dfEnabled;
messaging.send( messaging.send(

View File

@ -19,12 +19,13 @@
Home: https://github.com/gorhill/uBlock Home: https://github.com/gorhill/uBlock
*/ */
'use strict';
/******************************************************************************/
/******************************************************************************/ /******************************************************************************/
(function(){ (function(){
'use strict';
/******************************************************************************/ /******************************************************************************/
// https://github.com/chrisaljoudi/uBlock/issues/405 // https://github.com/chrisaljoudi/uBlock/issues/405
@ -153,6 +154,11 @@ var matchWhitelistDirective = function(url, hostname, directive) {
/******************************************************************************/ /******************************************************************************/
})();
/******************************************************************************/
/******************************************************************************/
µBlock.stringFromWhitelist = function(whitelist) { µBlock.stringFromWhitelist = function(whitelist) {
var r = {}; var r = {};
var i, bucket; var i, bucket;
@ -266,14 +272,18 @@ var matchWhitelistDirective = function(url, hostname, directive) {
} }
// Change -- but only if the user setting actually exists. // Change -- but only if the user setting actually exists.
var mustSave = us.hasOwnProperty(name) && var mustSave = us.hasOwnProperty(name) && value !== us[name];
value !== us[name];
if ( mustSave ) { if ( mustSave ) {
us[name] = value; us[name] = value;
} }
// Post-change // Post-change
switch ( name ) { switch ( name ) {
case 'advancedUserEnabled':
if ( value === true ) {
us.dynamicFilteringEnabled = true;
}
break;
case 'collapseBlocked': case 'collapseBlocked':
if ( value === false ) { if ( value === false ) {
this.cosmeticFilteringEngine.removeFromSelectorCache('*', 'net'); this.cosmeticFilteringEngine.removeFromSelectorCache('*', 'net');
@ -533,5 +543,3 @@ var matchWhitelistDirective = function(url, hostname, directive) {
})(); })();
/******************************************************************************/ /******************************************************************************/
})();

View File

@ -22,6 +22,8 @@
/* global DOMTokenList */ /* global DOMTokenList */
/* exported uDom */ /* exported uDom */
'use strict';
/******************************************************************************/ /******************************************************************************/
// It's just a silly, minimalist DOM framework: this allows me to not rely // It's just a silly, minimalist DOM framework: this allows me to not rely
@ -32,8 +34,6 @@
var uDom = (function() { var uDom = (function() {
'use strict';
/******************************************************************************/ /******************************************************************************/
var DOMList = function() { var DOMList = function() {
@ -499,6 +499,16 @@ DOMList.prototype.attr = function(attr, value) {
/******************************************************************************/ /******************************************************************************/
DOMList.prototype.removeAttr = function(attr) {
var i = this.nodes.length;
while ( i-- ) {
this.nodes[i].removeAttribute(attr);
}
return this;
};
/******************************************************************************/
DOMList.prototype.prop = function(prop, value) { DOMList.prototype.prop = function(prop, value) {
var i = this.nodes.length; var i = this.nodes.length;
if ( value === undefined ) { if ( value === undefined ) {

View File

@ -22,7 +22,9 @@
</p> </p>
<p class="statValue" id="page-blocked">?</p> <p class="statValue" id="page-blocked">?</p>
<div id="refresh" class="fa">&#xf021;</div> <div id="refresh" class="fa">&#xf021;</div>
<p class="statName" data-i18n="popupBlockedSinceInstallPrompt">&nbsp;</p> <p class="statName">
<span data-i18n="popupBlockedSinceInstallPrompt">&nbsp;</span>
</p>
<p class="statValue" id="total-blocked">?</p> <p class="statValue" id="total-blocked">?</p>
<h2 data-i18n="popupHitDomainCountPrompt">&nbsp;</h2> <h2 data-i18n="popupHitDomainCountPrompt">&nbsp;</h2>
<p class="statValue" id="popupHitDomainCount">&nbsp;</p> <p class="statValue" id="popupHitDomainCount">&nbsp;</p>
@ -46,7 +48,7 @@
</div> </div>
<div id="templates" style="display: none"> <div id="templates" style="display: none">
<div><span></span><span data-src="/" data-des="" data-type="*"> </span><span data-src="." data-des="" data-type="*"> </span><span data-src="." data-des="" data-type="*"> </span></div> <div><span></span><span data-src="/" data-des="" data-type="*"></span><span data-src="." data-des="" data-type="*"></span><span data-src="." data-des="" data-type="*"></span></div>
<div id="actionSelector"><span id="dynaAllow"></span><span id="dynaNoop"></span><span id="dynaBlock"></span></div> <div id="actionSelector"><span id="dynaAllow"></span><span id="dynaNoop"></span><span id="dynaBlock"></span></div>
<div id="hotspotTip"></div> <div id="hotspotTip"></div>
<div id="tooltip"></div> <div id="tooltip"></div>