mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2024-12-23 00:25:15 +01:00
Availability of certain variables changed (#92)
This commit is contained in:
parent
e2536dff2e
commit
34fba9c79d
@ -126,7 +126,6 @@ interceptor._handleStorageChanged = function (changes) {
|
||||
* Initializations
|
||||
*/
|
||||
|
||||
interceptor.amountInjected = 0;
|
||||
interceptor.xhrTestDomain = Address.LOCALCDN;
|
||||
interceptor.blockMissing = false;
|
||||
interceptor.blockGoogleFonts = true;
|
||||
@ -140,7 +139,7 @@ interceptor.relatedSettings.push(Setting.BLOCK_MISSING);
|
||||
interceptor.relatedSettings.push(Setting.ALLOWED_DOMAINS_GOOGLE_FONTS);
|
||||
|
||||
storageManager.type.get(interceptor.relatedSettings, function (items) {
|
||||
interceptor.amountInjected = items.amountInjected || 0;
|
||||
storageManager.amountInjected = items.amountInjected || 0;
|
||||
interceptor.xhrTestDomain = items.xhrTestDomain || Address.LOCALCDN;
|
||||
interceptor.blockMissing = items.blockMissing || false;
|
||||
interceptor.blockGoogleFonts = items.blockGoogleFonts || true;
|
||||
|
@ -54,21 +54,21 @@ stateManager.registerInjection = function (tabIdentifier, injection) {
|
||||
}
|
||||
}
|
||||
|
||||
if (isNaN(interceptor.amountInjected)) {
|
||||
if (isNaN(storageManager.amountInjected)) {
|
||||
|
||||
storageManager.type.get(Setting.AMOUNT_INJECTED, function (items) {
|
||||
|
||||
interceptor.amountInjected = items.amountInjected;
|
||||
storageManager.amountInjected = items.amountInjected;
|
||||
|
||||
storageManager.type.set({
|
||||
[Setting.AMOUNT_INJECTED]: ++interceptor.amountInjected
|
||||
[Setting.AMOUNT_INJECTED]: ++storageManager.amountInjected
|
||||
});
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
chrome.storage.local.set({
|
||||
[Setting.AMOUNT_INJECTED]: ++interceptor.amountInjected
|
||||
[Setting.AMOUNT_INJECTED]: ++storageManager.amountInjected
|
||||
});
|
||||
}
|
||||
if (stateManager.internalStatistics) {
|
||||
|
@ -152,7 +152,14 @@ storageManager._validation = function (content) {
|
||||
throw 'Invalid file!';
|
||||
}
|
||||
}
|
||||
|
||||
// set values directly
|
||||
wrappers.setIcon({ path: imported['selectedIcon'] }, 'Enabled');
|
||||
storageManager.amountInjected = imported['amountInjected'];
|
||||
storageManager.statistics = imported['internalStatisticsData'];
|
||||
|
||||
storageManager.type.set(imported);
|
||||
|
||||
alert(chrome.i18n.getMessage('dialogImportSuccessful'));
|
||||
};
|
||||
|
||||
@ -232,5 +239,7 @@ storageManager._validateNumbers = function (value) {
|
||||
|
||||
storageManager.data = {};
|
||||
storageManager.type = chrome.storage.local;
|
||||
storageManager.amountInjected = 0;
|
||||
storageManager.statistics = {};
|
||||
|
||||
chrome.storage.onChanged.addListener(storageManager._handleStorageChanged);
|
||||
|
@ -23,7 +23,7 @@ var stats = {};
|
||||
stats.setStats = function (injection) {
|
||||
let data, today, cdn, framework, newEntry;
|
||||
|
||||
data = stats.data;
|
||||
data = storageManager.statistics;
|
||||
today = new Date().toISOString().slice(0, 10);
|
||||
cdn = injection.source;
|
||||
framework = injection.path;
|
||||
@ -51,10 +51,8 @@ stats.setStats = function (injection) {
|
||||
|
||||
stats.getStats = function () {
|
||||
chrome.storage.local.get([Setting.INTERNAL_STATISTICS_DATA], function (items) {
|
||||
stats.data = items.internalStatisticsData || {};
|
||||
storageManager.statistics = items.internalStatisticsData || {};
|
||||
});
|
||||
};
|
||||
|
||||
stats.getStats();
|
||||
|
||||
stats.data = {};
|
||||
|
Loading…
Reference in New Issue
Block a user