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