1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00

minor code review re. 8b5a7aa398

This commit is contained in:
Raymond Hill 2018-09-07 10:52:10 -04:00
parent 8b1c39507e
commit 1d108082b7
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 9 additions and 9 deletions

View File

@ -325,7 +325,7 @@ var popupDataFromTabId = function(tabId, tabTitle) {
r.hostnameDict = getHostnameDict(pageStore.hostnameToCountMap); r.hostnameDict = getHostnameDict(pageStore.hostnameToCountMap);
r.contentLastModified = pageStore.contentLastModified; r.contentLastModified = pageStore.contentLastModified;
r.firewallRules = getFirewallRules(rootHostname, r.hostnameDict); r.firewallRules = getFirewallRules(rootHostname, r.hostnameDict);
r.canElementPicker = µb.URI.isNetworkURI(r.rawURL) && r.netFilteringSwitch; r.canElementPicker = µb.URI.isNetworkURI(r.rawURL);
r.noPopups = µb.sessionSwitches.evaluateZ('no-popups', rootHostname); r.noPopups = µb.sessionSwitches.evaluateZ('no-popups', rootHostname);
r.popupBlockedCount = pageStore.popupBlockedCount; r.popupBlockedCount = pageStore.popupBlockedCount;
r.noCosmeticFiltering = µb.sessionSwitches.evaluateZ('no-cosmetic-filtering', rootHostname); r.noCosmeticFiltering = µb.sessionSwitches.evaluateZ('no-cosmetic-filtering', rootHostname);

View File

@ -418,25 +418,25 @@ let updateHnSwitches = function() {
// Assume everything has to be done incrementally. // Assume everything has to be done incrementally.
var renderPopup = function() { var renderPopup = function() {
var elem, text;
if ( popupData.tabTitle ) { if ( popupData.tabTitle ) {
document.title = popupData.appName + ' - ' + popupData.tabTitle; document.title = popupData.appName + ' - ' + popupData.tabTitle;
} }
elem = document.body; let elem = document.body;
elem.classList.toggle('advancedUser', popupData.advancedUserEnabled); elem.classList.toggle('advancedUser', popupData.advancedUserEnabled);
elem.classList.toggle( elem.classList.toggle(
'off', 'off',
popupData.pageURL === '' || !popupData.netFilteringSwitch popupData.pageURL === '' || !popupData.netFilteringSwitch
); );
// If you think the `=== true` is pointless, you are mistaken let canElementPicker = popupData.canElementPicker &&
uDom.nodeFromId('gotoPick').classList.toggle('enabled', popupData.canElementPicker === true); popupData.netFilteringSwitch;
uDom.nodeFromId('gotoZap').classList.toggle('enabled', popupData.canElementPicker === true); uDom.nodeFromId('gotoPick').classList.toggle('enabled', canElementPicker);
uDom.nodeFromId('gotoZap').classList.toggle('enabled', canElementPicker);
var blocked = popupData.pageBlockedRequestCount, let blocked = popupData.pageBlockedRequestCount,
total = popupData.pageAllowedRequestCount + blocked; total = popupData.pageAllowedRequestCount + blocked,
text;
if ( total === 0 ) { if ( total === 0 ) {
text = formatNumber(0); text = formatNumber(0);
} else { } else {