diff --git a/_locales/de/messages.json b/_locales/de/messages.json index 1b0214c1..9ac911ff 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -70,5 +70,21 @@ "generateRuleSetTitle": { "message": "Generiere Regelsätze für uBlock oder uMatrix", "description": "Generate rule set title." + }, + "loggingTitle": { + "message": "Aktiviere das loggen in die Browser-Konsole", + "description": "Aktiviere das loggen in die Browser-Konsole." + }, + "loggingDescription": { + "message": "Öffne die \"Browser-Konsole\" ( STRG + UMSCHALT + J ) um fehlende Resourcen anzuzeigen.", + "description": "Öffne die \"Browser-Konsole\" ( STRG + UMSCHALT + J ) um fehlende Resourcen anzuzeigen." + }, + "hideReleaseNotesTitle": { + "message": "Versionshinweise deaktivieren", + "description": "Versionshinweise deaktivieren" + }, + "hideReleaseNotesDescription": { + "message": "Falls aktivert, erhälst du keine Hinweise über Neuerungen in LocalCDN. Dazu gehören auch Informationen über neue uBlock/uMatrix-Regeln.", + "description": "Falls aktivert, erhälst du keine Hinweise über Neuerungen in LocalCDN. Dazu gehören auch Informationen über neue uBlock/uMatrix-Regeln." } } diff --git a/_locales/en_US/messages.json b/_locales/en_US/messages.json index 06520775..07968a28 100644 --- a/_locales/en_US/messages.json +++ b/_locales/en_US/messages.json @@ -77,6 +77,14 @@ }, "loggingDescription": { "message": "Open \"Browser Console\" ( CTRL + SHIFT + J ) to show missing resources", - "description": "Generate rule set title." + "description": "Open \"Browser Console\" ( CTRL + SHIFT + J ) to show missing resources." + }, + "hideReleaseNotesTitle": { + "message": "Disable release notes", + "description": "Disable release notes" + }, + "hideReleaseNotesDescription": { + "message": "If enabled, you wont receive any information about new features in LocalCDN. This includes information about new uBlock/uMatrix rules.", + "description": "If enabled, you wont receive any information about new features in LocalCDN. This includes information about new uBlock/uMatrix rules." } } diff --git a/core/constants.js b/core/constants.js index 34ec3154..b65439a5 100644 --- a/core/constants.js +++ b/core/constants.js @@ -60,7 +60,7 @@ const Setting = { 'DISABLE_PREFETCH': 'disablePrefetch', 'ENFORCE_STAGING': 'enforceStaging', 'SHOW_ICON_BADGE': 'showIconBadge', - 'SHOW_RELEASE_NOTES': 'showReleaseNotes', + 'HIDE_RELEASE_NOTES': 'hideReleaseNotes', 'STRIP_METADATA': 'stripMetadata', 'LAST_MAPPING_UPDATE': 'lastMappingUpdate', 'WHITELISTED_DOMAINS': 'whitelistedDomains', diff --git a/core/main.js b/core/main.js index 441327d2..ecfd86e6 100644 --- a/core/main.js +++ b/core/main.js @@ -31,8 +31,8 @@ main._initializeSettings = function () { [Setting.BLOCK_MISSING]: false, [Setting.DISABLE_PREFETCH]: true, [Setting.ENFORCE_STAGING]: false, + [Setting.HIDE_RELEASE_NOTES]: false, [Setting.STRIP_METADATA]: true, - [Setting.LAST_MAPPING_UPDATE]: "2020-01-01", [Setting.WHITELISTED_DOMAINS]: {}, [Setting.LOGGING]: false }; @@ -69,41 +69,55 @@ main._showReleaseNotes = function (details) { if (details.reason === chrome.runtime.OnInstalledReason.INSTALL) { - previousVersion = details.previousVersion; + chrome.storage.local.set({ + [Setting.LAST_MAPPING_UPDATE]: lastMappingUpdate + }, function() { - if (previousVersion && previousVersion.charAt(0) === '2') { - return; // Do not show release notes after minor updates. - } + previousVersion = details.previousVersion; - if (details.temporary !== true) { + if (previousVersion && previousVersion.charAt(0) === '2') { + return; // Do not show release notes after minor updates. + } - chrome.storage.local.get({ - [Setting.SHOW_RELEASE_NOTES]: true - }, function (items) { + if (details.temporary !== true) { - if (items.showReleaseNotes === true) { + chrome.storage.local.get([Setting.HIDE_RELEASE_NOTES], function (items) { - chrome.tabs.create({ - 'url': location, - 'active': false - }); - } - }); - } - } else if (details.reason === chrome.runtime.OnInstalledReason.UPDATE) { - // If add-on update true, check last update of mappings.js - chrome.storage.local.get({[Setting.LAST_MAPPING_UPDATE]: lastMappingUpdate}, function (items) { - if (items.lastMappingUpdate !== lastMappingUpdate) { - // Updated mappings.js - chrome.tabs.create({ - 'url': updateAdBlockerRules, - 'active': true + if (items.hideReleaseNotes !== true) { + + chrome.tabs.create({ + 'url': location, + 'active': false + }); + } }); + } + }); + } else if (details.reason === chrome.runtime.OnInstalledReason.UPDATE) { + + let newValue = lastMappingUpdate; + let oldValue = ""; + + // If add-on update true, check last update of mappings.js + chrome.storage.local.get([Setting.LAST_MAPPING_UPDATE, Setting.HIDE_RELEASE_NOTES], function (items) { + + oldValue = items.lastMappingUpdate; + + if (oldValue !== newValue) { + // Updated mappings.js chrome.storage.local.set({ - [Setting.LAST_MAPPING_UPDATE]: lastMappingUpdate + [Setting.LAST_MAPPING_UPDATE]: newValue + }, function() { + if (!items.hideReleaseNotes) { + chrome.tabs.create({ + 'url': updateAdBlockerRules, + 'active': true + }); + } }); } else { // No mappings.js update + return; } }); } diff --git a/pages/options/options.html b/pages/options/options.html index 2a488bf4..ab09383b 100644 --- a/pages/options/options.html +++ b/pages/options/options.html @@ -138,6 +138,23 @@ +
+ +
+ + + +
+ +
+ +
+
diff --git a/pages/options/options.js b/pages/options/options.js index 21a18673..5cfeccc2 100644 --- a/pages/options/options.js +++ b/pages/options/options.js @@ -45,6 +45,7 @@ options._renderOptionsPanel = function () { elements.blockMissing.checked = options._optionValues.blockMissing; elements.disablePrefetch.checked = options._optionValues.disablePrefetch; elements.stripMetadata.checked = options._optionValues.stripMetadata; + elements.hideReleaseNotes.checked = options._optionValues.hideReleaseNotes; elements.enableLogging.checked = options._optionValues.enableLogging; elements.whitelistedDomains.value = domainWhitelist; @@ -87,6 +88,7 @@ options._registerOptionChangedEventListeners = function (elements) { elements.disablePrefetch.addEventListener('change', options._onOptionChanged); elements.stripMetadata.addEventListener('change', options._onOptionChanged); elements.enableLogging.addEventListener('change', options._onOptionChanged); + elements.hideReleaseNotes.addEventListener('change', options._onOptionChanged); elements.whitelistedDomains.addEventListener('keyup', options._onOptionChanged); let type = elements.ruleSets; for(let i = 0; i < type.length; i++) { @@ -134,6 +136,7 @@ options._getOptionElements = function () { [Setting.DISABLE_PREFETCH]: options._getOptionElement(Setting.DISABLE_PREFETCH), [Setting.STRIP_METADATA]: options._getOptionElement(Setting.STRIP_METADATA), [Setting.WHITELISTED_DOMAINS]: options._getOptionElement(Setting.WHITELISTED_DOMAINS), + [Setting.HIDE_RELEASE_NOTES]: options._getOptionElement(Setting.HIDE_RELEASE_NOTES), [Setting.LOGGING]: options._getOptionElement(Setting.LOGGING), ['ruleSets']: document.getElementsByName("rule-sets"), ['copyRuleSet']: document.getElementById("button-copy-rule-set")