mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
This commit is contained in:
parent
8fbd6a0043
commit
7ae68c8d7d
2 changed files with 20 additions and 14 deletions
|
|
@ -792,15 +792,21 @@ var restoreUserData = function(request) {
|
||||||
vAPI.localStorage.removeItem('immediateHiddenSettings');
|
vAPI.localStorage.removeItem('immediateHiddenSettings');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Remove all stored data but keep global counts, people can become
|
||||||
|
// quite attached to numbers
|
||||||
|
|
||||||
var resetUserData = function() {
|
var resetUserData = function() {
|
||||||
vAPI.cacheStorage.clear();
|
let count = 3;
|
||||||
vAPI.storage.clear();
|
let countdown = ( ) => {
|
||||||
|
count -= 1;
|
||||||
|
if ( count === 0 ) {
|
||||||
|
vAPI.app.restart();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
vAPI.cacheStorage.clear(countdown); // 1
|
||||||
|
vAPI.storage.clear(countdown); // 2
|
||||||
|
µb.saveLocalSettings(countdown); // 3
|
||||||
vAPI.localStorage.removeItem('immediateHiddenSettings');
|
vAPI.localStorage.removeItem('immediateHiddenSettings');
|
||||||
|
|
||||||
// Keep global counts, people can become quite attached to numbers
|
|
||||||
µb.saveLocalSettings();
|
|
||||||
|
|
||||||
vAPI.app.restart();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
||||||
uBlock Origin - a browser extension to block requests.
|
uBlock Origin - a browser extension to block requests.
|
||||||
Copyright (C) 2014-2018 Raymond Hill
|
Copyright (C) 2014-present Raymond Hill
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -52,17 +52,17 @@
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
µBlock.saveLocalSettings = (function() {
|
µBlock.saveLocalSettings = (function() {
|
||||||
var saveAfter = 4 * 60 * 1000;
|
let saveAfter = 4 * 60 * 1000;
|
||||||
|
|
||||||
var save = function() {
|
let save = function(callback) {
|
||||||
this.localSettingsLastSaved = Date.now();
|
this.localSettingsLastSaved = Date.now();
|
||||||
vAPI.storage.set(this.localSettings);
|
vAPI.storage.set(this.localSettings, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
var onTimeout = function() {
|
let onTimeout = ( ) => {
|
||||||
var µb = µBlock;
|
let µb = µBlock;
|
||||||
if ( µb.localSettingsLastModified > µb.localSettingsLastSaved ) {
|
if ( µb.localSettingsLastModified > µb.localSettingsLastSaved ) {
|
||||||
save.call(µb);
|
µb.saveLocalSettings();
|
||||||
}
|
}
|
||||||
vAPI.setTimeout(onTimeout, saveAfter);
|
vAPI.setTimeout(onTimeout, saveAfter);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue