diff --git a/src/js/background.js b/src/js/background.js index e2f699711..496a1b5db 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -73,6 +73,7 @@ return { hiddenSettingsDefault: { ignoreRedirectFilters: false, ignoreScriptInjectFilters: false, + popupFontSize: 'unset', suspendTabsUntilReady: false }, // This will be filled ASAP: diff --git a/src/js/messaging.js b/src/js/messaging.js index 625dc183d..f2140b9bf 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -282,8 +282,8 @@ var getFirewallRules = function(srcHostname, desHostnames) { /******************************************************************************/ var popupDataFromTabId = function(tabId, tabTitle) { - var tabContext = µb.tabContextManager.mustLookup(tabId); - var rootHostname = tabContext.rootHostname; + var tabContext = µb.tabContextManager.mustLookup(tabId), + rootHostname = tabContext.rootHostname; var r = { advancedUserEnabled: µb.userSettings.advancedUserEnabled, appName: vAPI.app.name, @@ -294,6 +294,7 @@ var popupDataFromTabId = function(tabId, tabTitle) { firewallPaneMinimized: µb.userSettings.firewallPaneMinimized, globalAllowedRequestCount: µb.localSettings.allowedRequestCount, globalBlockedRequestCount: µb.localSettings.blockedRequestCount, + fontSize: µb.hiddenSettings.popupFontSize, netFilteringSwitch: false, rawURL: tabContext.rawURL, pageURL: tabContext.normalURL, diff --git a/src/js/popup.js b/src/js/popup.js index e8774e972..50eddd781 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -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 // content is ready at this point, which should be the case given where this // script file is included in the HTML file. @@ -100,7 +105,6 @@ var rowsToRecycle = uDom(); var cachedPopupHash = ''; var statsStr = vAPI.i18n('popupBlockedStats'); var domainsHitStr = vAPI.i18n('popupHitDomainCount'); -var reNetworkRelatedURL = /^(?:ftps?|https?|wss?):\/\//; /******************************************************************************/ @@ -386,6 +390,17 @@ var renderPrivacyExposure = function() { // Assume everything has to be done incrementally. 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 ) { document.title = popupData.appName + ' - ' + popupData.tabTitle; } diff --git a/src/js/start.js b/src/js/start.js index a07cd4e0a..f068262ca 100644 --- a/src/js/start.js +++ b/src/js/start.js @@ -282,18 +282,23 @@ var onAdminSettingsRestored = function() { /******************************************************************************/ µb.hiddenSettings = (function() { - var json = vAPI.localStorage.getItem('hiddenSettings'); + var out = objectAssign({}, µb.hiddenSettingsDefault), + json = vAPI.localStorage.getItem('hiddenSettings'); if ( typeof json === 'string' ) { try { - var out = JSON.parse(json); - if ( out instanceof Object ) { - return out; + var o = JSON.parse(json); + if ( o instanceof Object ) { + for ( var k in o ) { + if ( out.hasOwnProperty(k) ) { + out[k] = o[k]; + } + } } } catch(ex) { } } - return objectAssign({}, µb.hiddenSettingsDefault); + return out; })(); /******************************************************************************/ diff --git a/src/js/storage.js b/src/js/storage.js index 6a4e4a568..db079f5ac 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -101,6 +101,9 @@ out[name] = false; } break; + case 'string': + out[name] = value; + break; default: break; }