mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-11 17:41:03 +01:00
fix new hidden setting default value not being applied (https://github.com/orgs/uBlockOrigin/teams/volunteers/discussions/62)
This commit is contained in:
parent
251b36338b
commit
00cb02ec47
1 changed files with 23 additions and 1 deletions
|
@ -104,6 +104,15 @@
|
|||
µb.hiddenSettings[key] = hs[key];
|
||||
}
|
||||
}
|
||||
// To remove once 1.15.26 is widespread. The reason is to ensure
|
||||
// the change in the following commit is taken into account:
|
||||
// https://github.com/gorhill/uBlock/commit/8071321e9104
|
||||
if ( hs.manualUpdateAssetFetchPeriod === 2000 ) {
|
||||
µb.hiddenSettings.manualUpdateAssetFetchPeriod =
|
||||
µb.hiddenSettingsDefault.manualUpdateAssetFetchPeriod;
|
||||
hs.manualUpdateAssetFetchPeriod = undefined;
|
||||
µb.saveHiddenSettings();
|
||||
}
|
||||
}
|
||||
if ( vAPI.localStorage.getItem('immediateHiddenSettings') === null ) {
|
||||
µb.saveImmediateHiddenSettings();
|
||||
|
@ -116,8 +125,21 @@
|
|||
);
|
||||
};
|
||||
|
||||
// Note: Save only the settings which values differ from the default ones.
|
||||
// This way the new default values in the future will properly apply for those
|
||||
// which were not modified by the user.
|
||||
|
||||
µBlock.saveHiddenSettings = function(callback) {
|
||||
vAPI.storage.set({ hiddenSettings: this.hiddenSettings, callback });
|
||||
var bin = { hiddenSettings: {} };
|
||||
for ( var prop in this.hiddenSettings ) {
|
||||
if (
|
||||
this.hiddenSettings.hasOwnProperty(prop) &&
|
||||
this.hiddenSettings[prop] !== this.hiddenSettingsDefault[prop]
|
||||
) {
|
||||
bin.hiddenSettings[prop] = this.hiddenSettings[prop];
|
||||
}
|
||||
}
|
||||
vAPI.storage.set(bin, callback);
|
||||
this.saveImmediateHiddenSettings();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue