Chrome stuff removed (#1274)

This commit is contained in:
nobody 2023-02-09 06:10:56 +01:00
parent b30a0b922d
commit 6fabde4c11
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
24 changed files with 183 additions and 256 deletions

View File

@ -194,69 +194,69 @@ const Allowlist = {
};
const BrowserType = {
'CHROMIUM': chrome.runtime.getURL('/').startsWith('chrome-extension'),
'FIREFOX': chrome.runtime.getURL('/').startsWith('moz-extension')
'CHROMIUM': browser.runtime.getURL('/').startsWith('chrome-extension'),
'FIREFOX': browser.runtime.getURL('/').startsWith('moz-extension')
};
const IconType = {
'Default': {
'Enabled': {
'16': chrome.runtime.getURL('icons/action/default/icon16-default.png'),
'18': chrome.runtime.getURL('icons/action/default/icon18-default.png'),
'19': chrome.runtime.getURL('icons/action/default/icon19-default.png'),
'32': chrome.runtime.getURL('icons/action/default/icon32-default.png'),
'36': chrome.runtime.getURL('icons/action/default/icon36-default.png'),
'38': chrome.runtime.getURL('icons/action/default/icon38-default.png'),
'64': chrome.runtime.getURL('icons/action/default/icon64-default.png')
'16': browser.runtime.getURL('icons/action/default/icon16-default.png'),
'18': browser.runtime.getURL('icons/action/default/icon18-default.png'),
'19': browser.runtime.getURL('icons/action/default/icon19-default.png'),
'32': browser.runtime.getURL('icons/action/default/icon32-default.png'),
'36': browser.runtime.getURL('icons/action/default/icon36-default.png'),
'38': browser.runtime.getURL('icons/action/default/icon38-default.png'),
'64': browser.runtime.getURL('icons/action/default/icon64-default.png')
},
'Disabled': {
'16': chrome.runtime.getURL('icons/action/default/icon16-disabled.png'),
'18': chrome.runtime.getURL('icons/action/default/icon18-disabled.png'),
'19': chrome.runtime.getURL('icons/action/default/icon19-disabled.png'),
'32': chrome.runtime.getURL('icons/action/default/icon32-disabled.png'),
'36': chrome.runtime.getURL('icons/action/default/icon36-disabled.png'),
'38': chrome.runtime.getURL('icons/action/default/icon38-disabled.png'),
'64': chrome.runtime.getURL('icons/action/default/icon64-disabled.png')
'16': browser.runtime.getURL('icons/action/default/icon16-disabled.png'),
'18': browser.runtime.getURL('icons/action/default/icon18-disabled.png'),
'19': browser.runtime.getURL('icons/action/default/icon19-disabled.png'),
'32': browser.runtime.getURL('icons/action/default/icon32-disabled.png'),
'36': browser.runtime.getURL('icons/action/default/icon36-disabled.png'),
'38': browser.runtime.getURL('icons/action/default/icon38-disabled.png'),
'64': browser.runtime.getURL('icons/action/default/icon64-disabled.png')
}
},
'Light': {
'Enabled': {
'16': chrome.runtime.getURL('icons/action/light/icon16-default.png'),
'18': chrome.runtime.getURL('icons/action/light/icon18-default.png'),
'19': chrome.runtime.getURL('icons/action/light/icon19-default.png'),
'32': chrome.runtime.getURL('icons/action/light/icon32-default.png'),
'36': chrome.runtime.getURL('icons/action/light/icon36-default.png'),
'38': chrome.runtime.getURL('icons/action/light/icon38-default.png'),
'64': chrome.runtime.getURL('icons/action/light/icon64-default.png')
'16': browser.runtime.getURL('icons/action/light/icon16-default.png'),
'18': browser.runtime.getURL('icons/action/light/icon18-default.png'),
'19': browser.runtime.getURL('icons/action/light/icon19-default.png'),
'32': browser.runtime.getURL('icons/action/light/icon32-default.png'),
'36': browser.runtime.getURL('icons/action/light/icon36-default.png'),
'38': browser.runtime.getURL('icons/action/light/icon38-default.png'),
'64': browser.runtime.getURL('icons/action/light/icon64-default.png')
},
'Disabled': {
'16': chrome.runtime.getURL('icons/action/light/icon16-disabled.png'),
'18': chrome.runtime.getURL('icons/action/light/icon18-disabled.png'),
'19': chrome.runtime.getURL('icons/action/light/icon19-disabled.png'),
'32': chrome.runtime.getURL('icons/action/light/icon32-disabled.png'),
'36': chrome.runtime.getURL('icons/action/light/icon36-disabled.png'),
'38': chrome.runtime.getURL('icons/action/light/icon38-disabled.png'),
'64': chrome.runtime.getURL('icons/action/light/icon64-disabled.png')
'16': browser.runtime.getURL('icons/action/light/icon16-disabled.png'),
'18': browser.runtime.getURL('icons/action/light/icon18-disabled.png'),
'19': browser.runtime.getURL('icons/action/light/icon19-disabled.png'),
'32': browser.runtime.getURL('icons/action/light/icon32-disabled.png'),
'36': browser.runtime.getURL('icons/action/light/icon36-disabled.png'),
'38': browser.runtime.getURL('icons/action/light/icon38-disabled.png'),
'64': browser.runtime.getURL('icons/action/light/icon64-disabled.png')
}
},
'Grey': {
'Enabled': {
'16': chrome.runtime.getURL('icons/action/grey/icon16-default.png'),
'18': chrome.runtime.getURL('icons/action/grey/icon18-default.png'),
'19': chrome.runtime.getURL('icons/action/grey/icon19-default.png'),
'32': chrome.runtime.getURL('icons/action/grey/icon32-default.png'),
'36': chrome.runtime.getURL('icons/action/grey/icon36-default.png'),
'38': chrome.runtime.getURL('icons/action/grey/icon38-default.png'),
'64': chrome.runtime.getURL('icons/action/grey/icon64-default.png')
'16': browser.runtime.getURL('icons/action/grey/icon16-default.png'),
'18': browser.runtime.getURL('icons/action/grey/icon18-default.png'),
'19': browser.runtime.getURL('icons/action/grey/icon19-default.png'),
'32': browser.runtime.getURL('icons/action/grey/icon32-default.png'),
'36': browser.runtime.getURL('icons/action/grey/icon36-default.png'),
'38': browser.runtime.getURL('icons/action/grey/icon38-default.png'),
'64': browser.runtime.getURL('icons/action/grey/icon64-default.png')
},
'Disabled': {
'16': chrome.runtime.getURL('icons/action/grey/icon16-disabled.png'),
'18': chrome.runtime.getURL('icons/action/grey/icon18-disabled.png'),
'19': chrome.runtime.getURL('icons/action/grey/icon19-disabled.png'),
'32': chrome.runtime.getURL('icons/action/grey/icon32-disabled.png'),
'36': chrome.runtime.getURL('icons/action/grey/icon36-disabled.png'),
'38': chrome.runtime.getURL('icons/action/grey/icon38-disabled.png'),
'64': chrome.runtime.getURL('icons/action/grey/icon64-disabled.png')
'16': browser.runtime.getURL('icons/action/grey/icon16-disabled.png'),
'18': browser.runtime.getURL('icons/action/grey/icon18-disabled.png'),
'19': browser.runtime.getURL('icons/action/grey/icon19-disabled.png'),
'32': browser.runtime.getURL('icons/action/grey/icon32-disabled.png'),
'36': browser.runtime.getURL('icons/action/grey/icon36-disabled.png'),
'38': browser.runtime.getURL('icons/action/grey/icon38-disabled.png'),
'64': browser.runtime.getURL('icons/action/grey/icon64-disabled.png')
}
}
};
@ -282,17 +282,17 @@ const MaterialIcons = {
const Links = {
'CODEBERG_HTML_FILTER': 'https://codeberg.org/nobody/LocalCDN/wiki/Home#user-content-7-a-website-looks-weird-or-cannot-be-used-if-i-deactivate-localcdn-everything-works-what-is-the-problem',
'CODEBERG_RULESET': 'https://codeberg.org/nobody/LocalCDN/wiki/Home#user-content-6-why-do-i-need-this-rule-generator-i-use-an-adblocker-and-want-to-import-these-rules-how-does-it-work',
'WELCOME': chrome.runtime.getURL('pages/welcome/welcome.html'),
'DONATE': chrome.runtime.getURL('pages/donate/donate.html'),
'CHANGELOG': chrome.runtime.getURL('pages/updates/updates.html'),
'FAQ': chrome.runtime.getURL('pages/help/help.html'),
'FAQ_HTML_FILTER': chrome.runtime.getURL('pages/help/help.html#html-filter'),
'STATISTICS': chrome.runtime.getURL('pages/statistics/statistics.html'),
'WELCOME': browser.runtime.getURL('pages/welcome/welcome.html'),
'DONATE': browser.runtime.getURL('pages/donate/donate.html'),
'CHANGELOG': browser.runtime.getURL('pages/updates/updates.html'),
'FAQ': browser.runtime.getURL('pages/help/help.html'),
'FAQ_HTML_FILTER': browser.runtime.getURL('pages/help/help.html#html-filter'),
'STATISTICS': browser.runtime.getURL('pages/statistics/statistics.html'),
'LOCALCDN_TEST': 'https://www.localcdn.org/test',
'LOCALCDN_TEST_WEBSITE': 'https://www.localcdn.org/test/check',
'WEBLATE': 'https://hosted.weblate.org/projects/localcdn/localcdn/',
'LOGGING': chrome.runtime.getURL('pages/logging/logging.html'),
'FAQ_PERMISSION': chrome.runtime.getURL('pages/help/help.html#permission'),
'LOGGING': browser.runtime.getURL('pages/logging/logging.html'),
'FAQ_PERMISSION': browser.runtime.getURL('pages/help/help.html#permission'),
};
const CDNs = {

View File

@ -33,7 +33,7 @@ fileGuard._startListening = function () {
let randomHexString = helpers.generateRandomHexString(24);
fileGuard.secret = `?_=${randomHexString}`;
chrome.webRequest.onBeforeRequest.addListener(
browser.webRequest.onBeforeRequest.addListener(
fileGuard._verifyRequest,
{'urls': [fileGuard.path + Address.ANY_PATH]},
[WebRequest.BLOCKING]
@ -42,7 +42,7 @@ fileGuard._startListening = function () {
fileGuard._verifyRequest = function (requestDetails) {
let redirectUrl = chrome.runtime.getURL(Address.ROOT_PATH);
let redirectUrl = browser.runtime.getURL(Address.ROOT_PATH);
if (!requestDetails.url.endsWith(fileGuard.secret)) {
return {redirectUrl};
@ -54,7 +54,7 @@ fileGuard._verifyRequest = function (requestDetails) {
* Initializations
*/
fileGuard.path = chrome.runtime.getURL(Address.RESOURCE_PATH);
fileGuard.path = browser.runtime.getURL(Address.RESOURCE_PATH);
fileGuard.secret = '';
if (fileGuard.path.startsWith(Address.CHROME_EXTENSION)) {

View File

@ -56,7 +56,7 @@ interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
source = helpers.extractDomainFromUrl(tab.url, true);
resource = tab.url;
return {
'redirectUrl': chrome.runtime.getURL(`resources/blocked/index.html?source=${source}&resource=${resource}`)
'redirectUrl': browser.runtime.getURL(`resources/blocked/index.html?source=${source}&resource=${resource}`)
};
}
@ -92,13 +92,13 @@ interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
isGoogleFont = requestAnalyzer.isGoogleFont(targetDomain);
isGoogleMaterialIcons = requestAnalyzer.isGoogleMaterialIcons(requestDetails.url);
if (BrowserType.FIREFOX && isGoogleFont && !isGoogleMaterialIcons) {
if (isGoogleFont && !isGoogleMaterialIcons) {
initiatorDomain = helpers.extractDomainFromUrl(tab.url, true);
isListed = helpers.checkAllowlisted(initiatorDomain, interceptor.allowedDomainsGoogleFonts);
// Check if the website is allowed to load Google Fonts
if (interceptor.blockGoogleFonts === true && isListed === false) {
return {
'redirectUrl': chrome.runtime.getURL('resources/google-fonts-placeholder.css')
'redirectUrl': browser.runtime.getURL('resources/google-fonts-placeholder.css')
};
} else if (interceptor.blockGoogleFonts === false || isListed === true) {
return {
@ -118,7 +118,7 @@ interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
log.append(tab.url, requestDetails.url, targetDetails.path, false, iframe);
return {
'redirectUrl': chrome.runtime.getURL(targetDetails.path + fileGuard.secret)
'redirectUrl': browser.runtime.getURL(targetDetails.path + fileGuard.secret)
};
};
@ -192,4 +192,4 @@ interceptor._isBadResource = function (requestUrl) {
* Event Handlers
*/
chrome.storage.onChanged.addListener(interceptor._handleStorageChanged);
browser.storage.onChanged.addListener(interceptor._handleStorageChanged);

View File

@ -62,7 +62,7 @@ main._initializeSettings = function () {
}
if (items.disablePrefetch !== false) {
chrome.privacy.network.networkPredictionEnabled.set({
browser.privacy.network.networkPredictionEnabled.set({
'value': false
});
}
@ -96,18 +96,18 @@ main._initializeSettings = function () {
main._showReleaseNotes = function (details) {
storageManager.checkStorageType();
if (details.reason === chrome.runtime.OnInstalledReason.INSTALL) {
if (details.reason === browser.runtime.OnInstalledReason.INSTALL) {
storageManager.type.set({
[Setting.LAST_MAPPING_UPDATE]: mappings.lastMappingUpdate
}, function () {
if (details.temporary !== true) {
chrome.tabs.create({
'url': chrome.runtime.getURL('pages/welcome/welcome.html'),
browser.tabs.create({
'url': browser.runtime.getURL('pages/welcome/welcome.html'),
'active': true
});
}
});
} else if (details.reason === chrome.runtime.OnInstalledReason.UPDATE) {
} else if (details.reason === browser.runtime.OnInstalledReason.UPDATE) {
storageManager.type.get(null, function (items) {
let mappingUpdate = items.lastMappingUpdate !== mappings.lastMappingUpdate;
@ -138,8 +138,8 @@ main._showReleaseNotes = function (details) {
}
if ((mappingUpdate && items.updateNotification === 1) || items.updateNotification === 2) {
chrome.tabs.create({
'url': chrome.runtime.getURL(`pages/updates/updates.html?mappingupdate=${mappingUpdate}`),
browser.tabs.create({
'url': browser.runtime.getURL(`pages/updates/updates.html?mappingupdate=${mappingUpdate}`),
'active': false
});
} else {
@ -152,8 +152,8 @@ main._showReleaseNotes = function (details) {
main._permissionStatusListener = function (e) {
if (e.permissions.includes('<all_urls>')) {
chrome.tabs.create({
'url': chrome.runtime.getURL('pages/info/info.html'),
browser.tabs.create({
'url': browser.runtime.getURL('pages/info/info.html'),
'active': true
});
}
@ -163,6 +163,6 @@ main._permissionStatusListener = function (e) {
/**
* Initializations
*/
chrome.runtime.onInstalled.addListener(main._showReleaseNotes);
chrome.permissions.onRemoved.addListener(main._permissionStatusListener);
browser.runtime.onInstalled.addListener(main._showReleaseNotes);
browser.permissions.onRemoved.addListener(main._permissionStatusListener);
main._initializeSettings();

View File

@ -28,13 +28,6 @@ var manipulateDOM = {};
manipulateDOM._removeCrossOriginAndIntegrityAttr = function (details) {
if (!BrowserType.FIREFOX) {
// Chromium (and other) browsers do not support webRequest.filterResponseData
// https://bugs.chromium.org/p/chromium/issues/detail?id=487422
console.warn('[ LocalCDN ] browser.webRequest.filterResponseData not supported by your browser.');
log.append(details.url, '-', 'browser.webRequest.filterResponseData not supported by your browser', true);
return;
}
if (details.statusCode === 200) {
let initiatorDomain, header;
@ -172,7 +165,7 @@ let cdnDomainsRE = new RegExp(`//(${Object.keys(mappings.cdn).map((m) => m.repla
* Event Handlers
*/
chrome.webRequest.onHeadersReceived.addListener(
browser.webRequest.onHeadersReceived.addListener(
manipulateDOM._removeCrossOriginAndIntegrityAttr,
{'types': [WebRequestType.MAIN_FRAME, WebRequestType.SUB_FRAME], 'urls': [Address.ANY]},
[WebRequest.BLOCKING, WebRequest.RESPONSE_HEADERS]

View File

@ -1230,13 +1230,6 @@ mappings.cdn['cdn.bootcdn.net'] = mappings.cdn['cdnjs.cloudflare.com'];
mappings.cdn['fonts.gstatic.com'] = mappings.cdn['fonts.googleapis.com'];
// Remove Google Fonts Endpoints for Chromium browsers (https://codeberg.org/nobody/LocalCDN/issues/1085)
if (!BrowserType.FIREFOX) {
delete mappings.cdn['fonts.gstatic.com'];
delete mappings.cdn['fonts.googleapis.com'];
}
/**
* List of CNAME CDNs
* https://codeberg.org/nobody/LocalCDN/issues/816

View File

@ -121,4 +121,4 @@ messenger._handleMessageReceived = function (message, sender, sendResponse) {
* Event Handlers
*/
chrome.runtime.onMessage.addListener(messenger._handleMessageReceived);
browser.runtime.onMessage.addListener(messenger._handleMessageReceived);

View File

@ -50,16 +50,6 @@ requestAnalyzer.isValidCandidate = function (requestDetails, tabDetails) {
return false;
}
// Font Awesome injections in Chromium deactivated (https://gitlab.com/nobody42/localcdn/-/issues/67)
if (!BrowserType.FIREFOX) {
let requestType = requestAnalyzer.chromeSupport(requestDetails.url);
if (requestType !== '') {
console.warn(`${LogString.PREFIX} ${requestType} ${LogString.NOT_SUPPORTED}`);
log.append(tabDetails.url, requestDetails.url, `${requestType} ${LogString.NOT_SUPPORTED}`, true);
return false;
}
}
// Ignore requests if website is 'yandex.com' and CDN is 'yastatic.net', because website and CDN are the same.
if (tabDetails.url.includes('yandex.com') && requestDetails.url.includes('yastatic.net')) {
log.append(tabDetails.url, requestDetails.url, LogString.YANDEX, true);
@ -334,5 +324,5 @@ requestAnalyzer._applyManipulateDOMDomains();
* Event Handlers
*/
chrome.storage.onChanged.addListener(requestAnalyzer._applyAllowlistedDomains);
chrome.storage.onChanged.addListener(requestAnalyzer._applyManipulateDOMDomains);
browser.storage.onChanged.addListener(requestAnalyzer._applyAllowlistedDomains);
browser.storage.onChanged.addListener(requestAnalyzer._applyManipulateDOMDomains);

View File

@ -21,36 +21,24 @@
var requestSanitizer = {};
/**
* Preparation
* https://codeberg.org/nobody/LocalCDN/issues/442
*/
/* eslint-disable indent */
const ExtraInfoSpec = BrowserType.FIREFOX
? [WebRequest.BLOCKING, WebRequest.HEADERS]
: [WebRequest.BLOCKING, WebRequest.HEADERS, WebRequest.EXTRA_HEADERS];
/* eslint-enable indent */
/**
* Public Methods
*/
requestSanitizer.enable = function () {
let onBeforeSendHeaders = chrome.webRequest.onBeforeSendHeaders;
let onBeforeSendHeaders = browser.webRequest.onBeforeSendHeaders;
onBeforeSendHeaders.addListener(requestSanitizer._stripMetadata, {
'urls': stateManager.validHosts
}, ExtraInfoSpec);
}, [WebRequest.BLOCKING, WebRequest.HEADERS]);
};
requestSanitizer.disable = function () {
let onBeforeSendHeaders = chrome.webRequest.onBeforeSendHeaders;
let onBeforeSendHeaders = browser.webRequest.onBeforeSendHeaders;
onBeforeSendHeaders.removeListener(requestSanitizer._stripMetadata, {
'urls': stateManager.validHosts
}, ExtraInfoSpec);
}, [WebRequest.BLOCKING, WebRequest.HEADERS]);
};

View File

@ -46,7 +46,7 @@ stateManager.registerInjection = function (tabIdentifier, injection, url) {
missingCount = registeredTab.missing || 0;
if (injectionCount > 0) {
chrome.action.setTitle({
browser.action.setTitle({
'tabId': tabIdentifier,
'title': `LocalCDN (${injectionCount})`
});
@ -69,7 +69,7 @@ stateManager.registerInjection = function (tabIdentifier, injection, url) {
});
});
} else {
chrome.storage.local.set({
browser.storage.local.set({
[Setting.AMOUNT_INJECTED]: ++storageManager.amountInjected
});
}
@ -164,7 +164,7 @@ stateManager._createTab = function (tab) {
'urls': stateManager.validHosts
};
chrome.webRequest.onBeforeRequest.addListener(function (requestDetails) {
browser.webRequest.onBeforeRequest.addListener(function (requestDetails) {
tab = stateManager.tabs[tabIdentifier].details || {};
return interceptor.handleRequest(requestDetails, tabIdentifier, tab);
}, requestFilters, [WebRequest.BLOCKING]);
@ -185,14 +185,14 @@ stateManager._updateTab = function (details) {
return;
}
chrome.action.setTitle({
browser.action.setTitle({
'tabId': tabIdentifier,
'title': 'LocalCDN (0)'
});
if (domainIsAllowlisted) {
stateManager._setIconDisabled(tabIdentifier);
chrome.action.setTitle({
browser.action.setTitle({
'tabId': tabIdentifier,
'title': 'LocalCDN ()'
});
@ -212,7 +212,7 @@ stateManager._handleStorageChanged = function (changes) {
if (Setting.SHOW_ICON_BADGE in changes) {
stateManager.showIconBadge = changes.showIconBadge.newValue;
if (changes.showIconBadge.newValue !== true) {
chrome.tabs.query({}, function (tabs) {
browser.tabs.query({}, function (tabs) {
tabs.forEach(stateManager._removeIconBadgeFromTab);
});
}
@ -297,7 +297,7 @@ for (let mapping in mappings.cdn) {
stateManager.validHosts.push(supportedHost);
}
chrome.tabs.query({}, function (tabs) {
browser.tabs.query({}, function (tabs) {
tabs.forEach(stateManager._createTab);
});
@ -331,7 +331,7 @@ storageManager.type.get([
stateManager.amountInjected = items.amountInjected;
});
chrome.storage.local.get([Setting.INTERNAL_STATISTICS], function (items) {
browser.storage.local.get([Setting.INTERNAL_STATISTICS], function (items) {
stateManager.internalStatistics = items.internalStatistics;
});
@ -340,10 +340,10 @@ chrome.storage.local.get([Setting.INTERNAL_STATISTICS], function (items) {
* Event Handlers
*/
chrome.tabs.onCreated.addListener(stateManager._createTab);
chrome.tabs.onRemoved.addListener(stateManager._removeTab);
browser.tabs.onCreated.addListener(stateManager._createTab);
browser.tabs.onRemoved.addListener(stateManager._removeTab);
chrome.webRequest.onBeforeRequest.addListener(function (requestDetails) {
browser.webRequest.onBeforeRequest.addListener(function (requestDetails) {
if (requestDetails.tabId !== -1 && stateManager.tabs[requestDetails.tabId]) {
stateManager.tabs[requestDetails.tabId].details = {
'url': requestDetails.url
@ -351,17 +351,17 @@ chrome.webRequest.onBeforeRequest.addListener(function (requestDetails) {
}
}, {'types': [WebRequestType.MAIN_FRAME], 'urls': [Address.ANY]}, [WebRequest.BLOCKING]);
chrome.webNavigation.onCommitted.addListener(stateManager._updateTab, {
browser.webNavigation.onCommitted.addListener(stateManager._updateTab, {
'url': [{'urlContains': ':'}]
});
chrome.webRequest.onErrorOccurred.addListener(function (requestDetails) {
browser.webRequest.onErrorOccurred.addListener(function (requestDetails) {
if (stateManager.requests[requestDetails.requestId]) {
delete stateManager.requests[requestDetails.requestId];
}
}, {'urls': [Address.ANY]});
chrome.webRequest.onBeforeRedirect.addListener(function (requestDetails) {
browser.webRequest.onBeforeRedirect.addListener(function (requestDetails) {
let knownRequest = stateManager.requests[requestDetails.requestId];
if (knownRequest) {
stateManager.registerInjection(
@ -373,4 +373,4 @@ chrome.webRequest.onBeforeRedirect.addListener(function (requestDetails) {
}
}, {'urls': [Address.ANY]});
chrome.storage.onChanged.addListener(stateManager._handleStorageChanged);
browser.storage.onChanged.addListener(stateManager._handleStorageChanged);

View File

@ -34,11 +34,11 @@ var storageManager = {};
*/
storageManager.checkStorageType = function () {
chrome.storage.local.get([Setting.STORAGE_TYPE], function (items) {
browser.storage.local.get([Setting.STORAGE_TYPE], function (items) {
if (items.storageType === 'sync') {
storageManager.type = chrome.storage.sync;
storageManager.type = browser.storage.sync;
} else {
storageManager.type = chrome.storage.local;
storageManager.type = browser.storage.local;
}
});
};
@ -49,14 +49,14 @@ storageManager.migrateData = function (target) {
syncFetch = false;
if (target === 'local') {
storageSource = chrome.storage.sync;
storageDestination = chrome.storage.local;
storageSource = browser.storage.sync;
storageDestination = browser.storage.local;
} else if (target === 'sync') {
storageSource = chrome.storage.local;
storageDestination = chrome.storage.sync;
storageSource = browser.storage.local;
storageDestination = browser.storage.sync;
} else if (target === 'sync-fetch') {
storageSource = chrome.storage.sync;
storageDestination = chrome.storage.sync;
storageSource = browser.storage.sync;
storageDestination = browser.storage.sync;
target = 'sync';
syncFetch = true;
} else {
@ -64,7 +64,7 @@ storageManager.migrateData = function (target) {
}
storageSource.get(null, function (data) {
chrome.storage.local.set({
browser.storage.local.set({
[Setting.AMOUNT_INJECTED]: data.amountInjected,
[Setting.INTERNAL_STATISTICS]: data.internalStatistics,
[Setting.INTERNAL_STATISTICS_DATA]: data.internalStatisticsData,
@ -92,7 +92,7 @@ storageManager.migrateData = function (target) {
[Setting.BADGE_HTML_FILTER_TEXT_COLOR]: data.badgeHTMLfilterTextColor
});
if (syncFetch === true) {
chrome.runtime.reload();
browser.runtime.reload();
}
});
};
@ -145,9 +145,9 @@ storageManager.handleImportFilePicker = function () {
storageManager._handleStorageChanged = function (type) {
if (Setting.STORAGE_TYPE in type) {
if (type.storageType.newValue === 'sync') {
storageManager.type = chrome.storage.sync;
storageManager.type = browser.storage.sync;
} else {
storageManager.type = chrome.storage.local;
storageManager.type = browser.storage.local;
}
}
};
@ -196,15 +196,15 @@ storageManager._validation = function (content) {
// Set default if not existing in file
imported[key] = value;
} else {
alert(`${chrome.i18n.getMessage('dialogImportFailed')}\n\n${key}: ${content[key]}`);
alert(`${browser.i18n.getMessage('dialogImportFailed')}\n\n${key}: ${content[key]}`);
throw InvalidFile;
}
}
storageManager.type.set(imported);
alert(chrome.i18n.getMessage('dialogImportSuccessful'));
chrome.runtime.reload();
alert(browser.i18n.getMessage('dialogImportSuccessful'));
browser.runtime.reload();
};
storageManager._validateDomainsAndStatistics = function (type, obj) {
@ -216,7 +216,7 @@ storageManager._validateDomainsAndStatistics = function (type, obj) {
if (((/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,24}/).test(key) || key === '') && value === true) {
valid[key] = value;
} else {
alert(`${chrome.i18n.getMessage('dialogImportFailed')}: ${key}`);
alert(`${browser.i18n.getMessage('dialogImportFailed')}: ${key}`);
throw InvalidFile;
}
}
@ -228,7 +228,7 @@ storageManager._validateDomainsAndStatistics = function (type, obj) {
for (const [name, counter] of Object.entries(category)) {
// eslint-disable-next-line max-len
if (!(/resources\/[0-9a-z.-]+\/((?:\d{1,2}\.){1,3}\d{1,2})?.*\.(css|jsm)/).test(name) && !storageManager._validateNumbers(counter)) {
alert(`${chrome.i18n.getMessage('dialogImportFailed')}: ${name}`);
alert(`${browser.i18n.getMessage('dialogImportFailed')}: ${name}`);
throw InvalidFile;
}
}
@ -236,23 +236,23 @@ storageManager._validateDomainsAndStatistics = function (type, obj) {
for (const [name, counter] of Object.entries(category)) {
// eslint-disable-next-line no-useless-escape, max-len
if (!(/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,24}/).test(name) && !storageManager._validateNumbers(counter)) {
alert(`${chrome.i18n.getMessage('dialogImportFailed')}: ${name}`);
alert(`${browser.i18n.getMessage('dialogImportFailed')}: ${name}`);
throw InvalidFile;
}
}
} else {
alert(`${chrome.i18n.getMessage('dialogImportFailed')}: ${type}`);
alert(`${browser.i18n.getMessage('dialogImportFailed')}: ${type}`);
throw InvalidFile;
}
}
} else {
alert(`${chrome.i18n.getMessage('dialogImportFailed')}: ${date}`);
alert(`${browser.i18n.getMessage('dialogImportFailed')}: ${date}`);
throw InvalidFile;
}
}
valid = obj;
} else {
alert(`${chrome.i18n.getMessage('dialogImportFailed')}: ${type}`);
alert(`${browser.i18n.getMessage('dialogImportFailed')}: ${type}`);
throw InvalidFile;
}
return valid;
@ -284,8 +284,8 @@ storageManager._validateNumbers = function (value) {
*/
storageManager.data = {};
storageManager.type = chrome.storage.local;
storageManager.type = browser.storage.local;
storageManager.amountInjected = 0;
storageManager.statistics = {};
chrome.storage.onChanged.addListener(storageManager._handleStorageChanged);
browser.storage.onChanged.addListener(storageManager._handleStorageChanged);

View File

@ -40,11 +40,11 @@ helpers.insertI18nContentIntoDocument = function (document) {
i18nElements.forEach(function (i18nElement) {
let i18nMessageName = i18nElement.getAttribute('data-i18n-content');
if (chrome.i18n.getMessage(i18nMessageName) !== '') {
if (browser.i18n.getMessage(i18nMessageName) !== '') {
if (i18nElement.type === 'button') {
i18nElement.value = chrome.i18n.getMessage(i18nMessageName);
i18nElement.value = browser.i18n.getMessage(i18nMessageName);
} else {
i18nElement.textContent = chrome.i18n.getMessage(i18nMessageName);
i18nElement.textContent = browser.i18n.getMessage(i18nMessageName);
}
i18nElement.setAttribute('dir', scriptDirection);
} else {
@ -64,7 +64,7 @@ helpers.insertI18nTitlesIntoDocument = function (document) {
i18nElements.forEach(function (i18nElement) {
let i18nMessageName = i18nElement.getAttribute('data-i18n-title');
i18nElement.setAttribute('title', chrome.i18n.getMessage(i18nMessageName));
i18nElement.setAttribute('title', browser.i18n.getMessage(i18nMessageName));
i18nElement.setAttribute('dir', scriptDirection);
});
};
@ -242,13 +242,13 @@ helpers.determineActiveTab = function () {
'currentWindow': true
};
chrome.tabs.query(opt, function (tabs) {
browser.tabs.query(opt, function (tabs) {
if (tabs[0]) {
resolve(tabs[0]);
} else {
opt = {'active': true};
chrome.tabs.query(opt, function () {
browser.tabs.query(opt, function () {
resolve(tabs[0]);
});
}

View File

@ -17,7 +17,7 @@
var permission = {};
permission._onDocumentLoaded = function () {
chrome.permissions.getAll(({origins}) => {
browser.permissions.getAll(({origins}) => {
if (origins.includes('<all_urls>')) {
document.getElementById('div-permission').hidden = true;
document.getElementById('div-content').hidden = false;
@ -26,7 +26,7 @@ permission._onDocumentLoaded = function () {
document.getElementById('div-content').hidden = true;
console.error('[ LocalCDN ] missing permission');
document.getElementById('grant-permission').addEventListener('click', function () {
chrome.permissions.request({'origins': ['<all_urls>']});
browser.permissions.request({'origins': ['<all_urls>']});
});
}
});
@ -44,7 +44,7 @@ permission._removed = function () {
document.getElementById('div-content').hidden = true;
};
chrome.permissions.onAdded.addListener(permission._added);
chrome.permissions.onRemoved.addListener(permission._removed);
browser.permissions.onAdded.addListener(permission._added);
browser.permissions.onRemoved.addListener(permission._removed);
document.addEventListener('DOMContentLoaded', permission._onDocumentLoaded);

View File

@ -38,11 +38,6 @@ ruleGenerator.openRuleSet = function ({target}) {
textArea.style.display = 'block';
btnCopy.style.display = 'block';
if (!BrowserType.FIREFOX) {
delete urls['fonts.googleapis.com'];
delete urls['fonts.gstatic.com'];
}
for (const domain in urls) {
if (key === 'uMatrix') {
content += `* ${domain} script allow\n`;

View File

@ -57,13 +57,13 @@ stats.setStats = function (injection) {
data[today] = newEntry;
}
chrome.storage.local.set({
browser.storage.local.set({
[Setting.INTERNAL_STATISTICS_DATA]: data,
});
};
stats.getStats = function () {
chrome.storage.local.get([Setting.INTERNAL_STATISTICS_DATA], function (items) {
browser.storage.local.get([Setting.INTERNAL_STATISTICS_DATA], function (items) {
storageManager.statistics = items.internalStatisticsData || {};
});
};

View File

@ -30,7 +30,7 @@ var wrappers = {};
*/
wrappers.setBadgeBackgroundColor = function (details) {
if (chrome.action.setBadgeBackgroundColor === undefined) {
if (browser.action.setBadgeBackgroundColor === undefined) {
return;
}
@ -47,7 +47,7 @@ wrappers.setBadgeBackgroundColor = function (details) {
};
wrappers.setBadgeTextColor = function (details) {
if (chrome.action.setBadgeTextColor === undefined) {
if (browser.action.setBadgeTextColor === undefined) {
return;
}
@ -64,8 +64,8 @@ wrappers.setBadgeTextColor = function (details) {
};
wrappers.setBadgeText = function (tabId, text) {
if (chrome.action.setBadgeText !== undefined) {
chrome.action.setBadgeText({
if (browser.action.setBadgeText !== undefined) {
browser.action.setBadgeText({
'tabId': tabId,
'text': `${text}`
});
@ -73,9 +73,9 @@ wrappers.setBadgeText = function (tabId, text) {
};
wrappers.setIcon = function (details, type) {
if (chrome.action.setIcon) {
if (browser.action.setIcon) {
details.path = IconType[details.path][type];
chrome.action.setIcon(details);
browser.action.setIcon(details);
}
};
@ -95,15 +95,15 @@ wrappers.setBadgeColoring = function (tabId, value) {
return;
}
if (chrome.action.setBadgeTextColor !== undefined) {
chrome.action.setBadgeTextColor({
if (browser.action.setBadgeTextColor !== undefined) {
browser.action.setBadgeTextColor({
'tabId': tabId,
'color': textColor
});
}
if (chrome.action.setBadgeBackgroundColor !== undefined) {
chrome.action.setBadgeBackgroundColor({
if (browser.action.setBadgeBackgroundColor !== undefined) {
browser.action.setBadgeBackgroundColor({
'tabId': tabId,
'color': backgroundColor
});

View File

@ -87,7 +87,7 @@ logging._deleteLogs = function () {
'value': '',
};
chrome.runtime.sendMessage(message);
browser.runtime.sendMessage(message);
logging._resfresh();
}
};
@ -98,7 +98,7 @@ logging._getLoggingData = function () {
'topic': 'logs:get'
};
chrome.runtime.sendMessage(message, function (data) {
browser.runtime.sendMessage(message, function (data) {
logging._data = data['logs'];
resolve();
});

View File

@ -57,11 +57,6 @@ optionsAdvanced.init = function (opt) {
let blockMissing, blockGoogleFonts, allowedDomainsGoogleFonts, logging, domainsManipulateDOM,
negateHtmlFilterList, changeBadgeColorMissingResources;
if (BrowserType.CHROMIUM) {
document.getElementById('html-filter-div').style.display = 'none';
document.getElementById('block-google-fonts').style.display = 'none';
}
document.getElementById('last-mapping-update').textContent += ` ${mappings.lastMappingUpdate}`;
blockMissing = options.getOptionElement(Setting.BLOCK_MISSING);

View File

@ -44,12 +44,6 @@ optionsInfo._renderCdnFrameworkSection = function () {
optionsInfo._listOfFrameworks[path[1]] = true;
});
if (!BrowserType.FIREFOX) {
// Non-Firefox browser does not support Google Material Icons and Font Awesome
document.getElementById('unsupported-frameworks').style.display = 'block';
unsupportedFrameworks = 2;
}
optionsInfo._createList('cdn');
document.getElementById('cdn').classList.add('btns-active');
@ -92,9 +86,7 @@ optionsInfo._createList = function (type) {
}
list.forEach((elem) => {
if (!(BrowserType.CHROMIUM && (elem === 'fontawesome' || elem === 'google-material-design-icons'))) {
textArea.value += `${elem}\n`;
}
textArea.value += `${elem}\n`;
});
};

View File

@ -29,7 +29,7 @@ var optionsOther = {};
optionsOther._renderIconSection = function (opt) {
let url, bgColor, txtColor, selectedIcon;
if (!chrome.action.setIcon) {
if (!browser.action.setIcon) {
document.getElementById('icon-style-div').style.display = 'none';
return;
}
@ -43,7 +43,7 @@ optionsOther._renderIconSection = function (opt) {
} else if (selectedIcon === 'Light') {
document.getElementById('icon-light').checked = true;
}
url = chrome.runtime.getURL(`icons/action/${selectedIcon.toLowerCase()}/icon38-default.png`);
url = browser.runtime.getURL(`icons/action/${selectedIcon.toLowerCase()}/icon38-default.png`);
document.getElementById(BadgeSetting.HTML_ICON_BADGE_PREVIEW).src = url;
document.getElementById(BadgeSettingHTMLFilter.HTML_ICON_BADGE_PREVIEW).src = url;
document.getElementById(BadgeSettingMissingResource.HTML_ICON_BADGE_PREVIEW).src = url;
@ -91,7 +91,7 @@ optionsOther._renderStorageSection = function (opt) {
optionsOther._setIcon = function (optionValue) {
wrappers.setIcon({'path': optionValue}, 'Enabled');
let url = chrome.runtime.getURL(`icons/action/${optionValue.toLowerCase()}/icon38-default.png`);
let url = browser.runtime.getURL(`icons/action/${optionValue.toLowerCase()}/icon38-default.png`);
document.getElementById(BadgeSetting.HTML_ICON_BADGE_PREVIEW).src = url;
document.getElementById(BadgeSettingHTMLFilter.HTML_ICON_BADGE_PREVIEW).src = url;
document.getElementById(BadgeSettingMissingResource.HTML_ICON_BADGE_PREVIEW).src = url;
@ -106,7 +106,7 @@ optionsOther._preSelectStorage = function (type) {
};
optionsOther._onStorageOptionChanged = function ({target}) {
chrome.storage.local.set({
browser.storage.local.set({
[Setting.STORAGE_TYPE]: target.value,
});
if (target.value === 'local') {
@ -220,11 +220,6 @@ optionsOther._getBadgeElement = function (targetId) {
};
optionsOther.init = function (opt) {
if (BrowserType.CHROMIUM) {
document.getElementById('div-badged-text-color').style.display = 'none';
document.getElementById('html-div-badged-text-color').style.display = 'none';
document.getElementById('missing-div-badged-text-color').style.display = 'none';
}
document.getElementById('icon-default').addEventListener('change', options.onOptionChanged);
document.getElementById('icon-grey').addEventListener('change', options.onOptionChanged);

View File

@ -42,12 +42,7 @@ options._renderContents = function () {
options._renderLocaleNotice();
}
if (!BrowserType.FIREFOX) {
document.getElementById('chromium-banner').style.display = 'block';
document.getElementById('div-html-badge').style.display = 'none';
}
document.getElementById('label-version').textContent = chrome.runtime.getManifest().version;
document.getElementById('label-version').textContent = browser.runtime.getManifest().version;
};
options._renderOptionsPanel = function () {
@ -157,12 +152,12 @@ options._determineOptionValues = function () {
optionKeys = Object.keys(optionList);
if (options._storageType === 'sync') {
chrome.storage.sync.get(optionKeys, function (items) {
browser.storage.sync.get(optionKeys, function (items) {
options._optionValues = items;
resolve();
});
} else {
chrome.storage.local.get(optionKeys, function (items) {
browser.storage.local.get(optionKeys, function (items) {
options._optionValues = items;
resolve();
});
@ -172,7 +167,7 @@ options._determineOptionValues = function () {
options._determineLocalOptionValues = function () {
return new Promise((resolve) => {
chrome.storage.local.get([Setting.INTERNAL_STATISTICS, Setting.STORAGE_TYPE], function (items) {
browser.storage.local.get([Setting.INTERNAL_STATISTICS, Setting.STORAGE_TYPE], function (items) {
options._internalStatistics = items.internalStatistics;
options._storageType = items.storageType;
resolve();
@ -187,9 +182,9 @@ options.getOptionElement = function (optionKey) {
options._configureLinkPrefetching = function (value) {
if (value === false) {
// Restore default values of related preference values.
chrome.privacy.network.networkPredictionEnabled.clear({});
browser.privacy.network.networkPredictionEnabled.clear({});
} else {
chrome.privacy.network.networkPredictionEnabled.set({
browser.privacy.network.networkPredictionEnabled.set({
'value': false,
});
}
@ -281,24 +276,24 @@ options.onOptionChanged = function ({target}) {
break;
case Setting.LOGGING:
if (optionValue === false) {
chrome.runtime.sendMessage({'topic': 'logs:delete', 'value': ''});
browser.runtime.sendMessage({'topic': 'logs:delete', 'value': ''});
}
break;
}
if (options._storageType === 'sync' && optionKey !== 'internalStatistics') {
chrome.storage.sync.set({
browser.storage.sync.set({
[optionKey]: optionValue,
});
} else {
chrome.storage.local.set({
browser.storage.local.set({
[optionKey]: optionValue,
});
}
};
options._onLinkClick = function (url) {
chrome.tabs.create({
browser.tabs.create({
'url': url,
'active': true
});

View File

@ -50,12 +50,6 @@ popup._renderContents = function () {
.then(popup._determineStatusGoogleFonts)
.then(popup._determineResourceInjections)
.then(popup._renderContextualContents);
if (BrowserType.CHROMIUM) {
document.getElementById('div-manipulateDOM').hidden = true;
document.getElementById('div-google-fonts').hidden = true;
}
};
popup._renderNonContextualContents = function () {
@ -180,7 +174,7 @@ popup._enableProtection = function () {
'value': popup._domain,
};
chrome.runtime.sendMessage(message, function () {
browser.runtime.sendMessage(message, function () {
popup._onToggled();
});
};
@ -191,7 +185,7 @@ popup._disableProtection = function () {
'value': popup._domain,
};
chrome.runtime.sendMessage(message, function () {
browser.runtime.sendMessage(message, function () {
popup._onToggled();
});
};
@ -202,7 +196,7 @@ popup._enableManipulateDOM = function () {
'value': popup._domain,
};
chrome.runtime.sendMessage(message, function () {
browser.runtime.sendMessage(message, function () {
popup._onToggled();
});
};
@ -213,7 +207,7 @@ popup._disableManipulateDOM = function () {
'value': popup._domain,
};
chrome.runtime.sendMessage(message, function () {
browser.runtime.sendMessage(message, function () {
popup._onToggled();
});
};
@ -224,7 +218,7 @@ popup._enableGoogleFonts = function () {
'value': popup._domain,
};
chrome.runtime.sendMessage(message, function () {
browser.runtime.sendMessage(message, function () {
popup._onToggled();
});
};
@ -235,7 +229,7 @@ popup._disableGoogleFonts = function () {
'value': popup._domain,
};
chrome.runtime.sendMessage(message, function () {
browser.runtime.sendMessage(message, function () {
popup._onToggled();
});
};
@ -251,7 +245,7 @@ popup._determineDomainAllowlistStatus = function () {
return;
}
chrome.runtime.sendMessage(message, function (response) {
browser.runtime.sendMessage(message, function (response) {
popup._domainIsAllowlisted = response.value;
resolve();
});
@ -265,7 +259,7 @@ popup._determineStatusManipulateDOM = function () {
'value': popup._domain,
};
chrome.runtime.sendMessage(message, function (response) {
browser.runtime.sendMessage(message, function (response) {
popup._domainManipulateDOM = response.value;
resolve();
});
@ -279,7 +273,7 @@ popup._determineStatusGoogleFonts = function () {
'value': popup._domain,
};
chrome.runtime.sendMessage(message, function (response) {
browser.runtime.sendMessage(message, function (response) {
popup._domainGoogleFonts = response.value;
resolve();
});
@ -293,7 +287,7 @@ popup._determineResourceInjections = function () {
'value': popup._targetTab.id,
};
chrome.runtime.sendMessage(message, function (response) {
browser.runtime.sendMessage(message, function (response) {
let groupedInjections = popup._groupResourceInjections(response.value);
popup._resourceInjections = groupedInjections;
@ -318,7 +312,7 @@ popup._getData = function () {
'topic': 'popup:get-data'
};
chrome.runtime.sendMessage(message, function (items) {
browser.runtime.sendMessage(message, function (items) {
popup._amountInjected = items.data.amountInjected;
popup._statisticsStatus = items.data.internalStatistics;
popup.negateHtmlFilterList = items.data.negateHtmlFilterList;
@ -481,7 +475,7 @@ popup._filterDuplicates = function (array, key) {
popup._onDocumentLoaded = function () {
let manifest, language;
manifest = chrome.runtime.getManifest();
manifest = browser.runtime.getManifest();
language = navigator.language;
popup._name = manifest.name;
@ -495,7 +489,7 @@ popup._onButtonClick = function (ev) {
let dataLink = popupLinkList[ev.target.getAttribute('data-link')];
if (dataLink) {
if (ev.button === 0 || ev.button === 1) {
chrome.tabs.create({
browser.tabs.create({
'url': dataLink,
'active': ev.button === 0,
});
@ -508,25 +502,25 @@ popup._onButtonClick = function (ev) {
};
popup._onOptionsButtonClicked = function () {
chrome.runtime.openOptionsPage();
browser.runtime.openOptionsPage();
return window.close();
};
popup._onToggled = function () {
let bypassCache = typeof browser === 'undefined';
chrome.tabs.reload(popup._targetTab.id, {bypassCache});
browser.tabs.reload(popup._targetTab.id, {bypassCache});
setTimeout(function () {
popup._close();
}, 200);
};
popup._close = function () {
chrome.runtime.getPlatformInfo(function (information) {
if (information.os === chrome.runtime.PlatformOs.ANDROID) {
chrome.tabs.getCurrent(function (activeTab) {
browser.runtime.getPlatformInfo(function (information) {
if (information.os === browser.runtime.PlatformOs.ANDROID) {
browser.tabs.getCurrent(function (activeTab) {
if (activeTab) {
chrome.tabs.remove(activeTab.id);
browser.tabs.remove(activeTab.id);
} else {
window.close();
}

View File

@ -30,7 +30,7 @@ statistics._onDocumentLoaded = function () {
helpers.insertI18nContentIntoDocument(document);
helpers.insertI18nTitlesIntoDocument(document);
chrome.storage.local.get([Setting.DEFAULT_RANGE_STATISTIC], function (items) {
browser.storage.local.get([Setting.DEFAULT_RANGE_STATISTIC], function (items) {
statistics._dateUnit = items.defaultRangeStatistic || 'week';
document.getElementById('date-range').value = statistics._dateUnit;
@ -171,7 +171,7 @@ statistics._determineInjections = function () {
statistics._getStatistics = function () {
return new Promise((resolve) => {
chrome.storage.local.get([Setting.INTERNAL_STATISTICS_DATA], function (items) {
browser.storage.local.get([Setting.INTERNAL_STATISTICS_DATA], function (items) {
statistics._data = items.internalStatisticsData;
resolve();
});
@ -248,17 +248,17 @@ statistics._handlerDateRange = function ({target}) {
};
statistics._deleteStatistic = function () {
let text = chrome.i18n.getMessage('dialogConfirmDeleteStatistics');
let text = browser.i18n.getMessage('dialogConfirmDeleteStatistics');
if (confirm(text)) {
chrome.storage.local.set({
browser.storage.local.set({
[Setting.INTERNAL_STATISTICS_DATA]: {}
});
chrome.runtime.sendMessage({'topic': 'statistic:delete'});
browser.runtime.sendMessage({'topic': 'statistic:delete'});
}
};
statistics._saveDefaultRange = function (value) {
chrome.storage.local.set({
browser.storage.local.set({
[Setting.DEFAULT_RANGE_STATISTIC]: value
});
};

View File

@ -31,10 +31,7 @@ welcome._onDocumentLoaded = function () {
helpers.insertI18nContentIntoDocument(document);
helpers.insertI18nTitlesIntoDocument(document);
if (!BrowserType.FIREFOX) {
document.getElementById('chromium-banner').style.display = 'block';
}
document.getElementById('open-settings').addEventListener('mouseup', function () { chrome.runtime.openOptionsPage(); });
document.getElementById('open-settings').addEventListener('mouseup', function () { browser.runtime.openOptionsPage(); });
};
document.addEventListener('DOMContentLoaded', welcome._onDocumentLoaded);