mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-18 17:02:27 +02:00
code review re advanced settings + added popupFontSize
This commit is contained in:
parent
bc379a123e
commit
ee4fc2aed6
@ -73,6 +73,7 @@ return {
|
|||||||
hiddenSettingsDefault: {
|
hiddenSettingsDefault: {
|
||||||
ignoreRedirectFilters: false,
|
ignoreRedirectFilters: false,
|
||||||
ignoreScriptInjectFilters: false,
|
ignoreScriptInjectFilters: false,
|
||||||
|
popupFontSize: 'unset',
|
||||||
suspendTabsUntilReady: false
|
suspendTabsUntilReady: false
|
||||||
},
|
},
|
||||||
// This will be filled ASAP:
|
// This will be filled ASAP:
|
||||||
|
@ -282,8 +282,8 @@ var getFirewallRules = function(srcHostname, desHostnames) {
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var popupDataFromTabId = function(tabId, tabTitle) {
|
var popupDataFromTabId = function(tabId, tabTitle) {
|
||||||
var tabContext = µb.tabContextManager.mustLookup(tabId);
|
var tabContext = µb.tabContextManager.mustLookup(tabId),
|
||||||
var rootHostname = tabContext.rootHostname;
|
rootHostname = tabContext.rootHostname;
|
||||||
var r = {
|
var r = {
|
||||||
advancedUserEnabled: µb.userSettings.advancedUserEnabled,
|
advancedUserEnabled: µb.userSettings.advancedUserEnabled,
|
||||||
appName: vAPI.app.name,
|
appName: vAPI.app.name,
|
||||||
@ -294,6 +294,7 @@ var popupDataFromTabId = function(tabId, tabTitle) {
|
|||||||
firewallPaneMinimized: µb.userSettings.firewallPaneMinimized,
|
firewallPaneMinimized: µb.userSettings.firewallPaneMinimized,
|
||||||
globalAllowedRequestCount: µb.localSettings.allowedRequestCount,
|
globalAllowedRequestCount: µb.localSettings.allowedRequestCount,
|
||||||
globalBlockedRequestCount: µb.localSettings.blockedRequestCount,
|
globalBlockedRequestCount: µb.localSettings.blockedRequestCount,
|
||||||
|
fontSize: µb.hiddenSettings.popupFontSize,
|
||||||
netFilteringSwitch: false,
|
netFilteringSwitch: false,
|
||||||
rawURL: tabContext.rawURL,
|
rawURL: tabContext.rawURL,
|
||||||
pageURL: tabContext.normalURL,
|
pageURL: tabContext.normalURL,
|
||||||
|
@ -29,6 +29,11 @@
|
|||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
var popupFontSize = vAPI.localStorage.getItem('popupFontSize');
|
||||||
|
if ( typeof popupFontSize === 'string' && popupFontSize !== 'unset' ) {
|
||||||
|
document.body.style.setProperty('font-size', popupFontSize);
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure the popup is properly sized as soon as possible. It is assume the DOM
|
// Ensure the popup is properly sized as soon as possible. It is assume the DOM
|
||||||
// content is ready at this point, which should be the case given where this
|
// content is ready at this point, which should be the case given where this
|
||||||
// script file is included in the HTML file.
|
// script file is included in the HTML file.
|
||||||
@ -100,7 +105,6 @@ var rowsToRecycle = uDom();
|
|||||||
var cachedPopupHash = '';
|
var cachedPopupHash = '';
|
||||||
var statsStr = vAPI.i18n('popupBlockedStats');
|
var statsStr = vAPI.i18n('popupBlockedStats');
|
||||||
var domainsHitStr = vAPI.i18n('popupHitDomainCount');
|
var domainsHitStr = vAPI.i18n('popupHitDomainCount');
|
||||||
var reNetworkRelatedURL = /^(?:ftps?|https?|wss?):\/\//;
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
@ -386,6 +390,17 @@ var renderPrivacyExposure = function() {
|
|||||||
// Assume everything has to be done incrementally.
|
// Assume everything has to be done incrementally.
|
||||||
|
|
||||||
var renderPopup = function() {
|
var renderPopup = function() {
|
||||||
|
if ( popupData.fontSize !== popupFontSize ) {
|
||||||
|
popupFontSize = popupData.fontSize;
|
||||||
|
if ( popupFontSize !== 'unset' ) {
|
||||||
|
document.body.style.setProperty('font-size', popupFontSize);
|
||||||
|
vAPI.localStorage.setItem('popupFontSize', popupFontSize);
|
||||||
|
} else {
|
||||||
|
document.body.style.removeProperty('font-size');
|
||||||
|
vAPI.localStorage.removeItem('popupFontSize');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( popupData.tabTitle ) {
|
if ( popupData.tabTitle ) {
|
||||||
document.title = popupData.appName + ' - ' + popupData.tabTitle;
|
document.title = popupData.appName + ' - ' + popupData.tabTitle;
|
||||||
}
|
}
|
||||||
|
@ -282,18 +282,23 @@ var onAdminSettingsRestored = function() {
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
µb.hiddenSettings = (function() {
|
µb.hiddenSettings = (function() {
|
||||||
var json = vAPI.localStorage.getItem('hiddenSettings');
|
var out = objectAssign({}, µb.hiddenSettingsDefault),
|
||||||
|
json = vAPI.localStorage.getItem('hiddenSettings');
|
||||||
if ( typeof json === 'string' ) {
|
if ( typeof json === 'string' ) {
|
||||||
try {
|
try {
|
||||||
var out = JSON.parse(json);
|
var o = JSON.parse(json);
|
||||||
if ( out instanceof Object ) {
|
if ( o instanceof Object ) {
|
||||||
return out;
|
for ( var k in o ) {
|
||||||
|
if ( out.hasOwnProperty(k) ) {
|
||||||
|
out[k] = o[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(ex) {
|
catch(ex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return objectAssign({}, µb.hiddenSettingsDefault);
|
return out;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -101,6 +101,9 @@
|
|||||||
out[name] = false;
|
out[name] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'string':
|
||||||
|
out[name] = value;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user