mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
[mv3] Add ability to reset to default settings
This commit is contained in:
parent
37d995eeac
commit
6063d4f0ad
3 changed files with 21 additions and 1 deletions
|
|
@ -383,6 +383,14 @@
|
||||||
"message": "Restore…",
|
"message": "Restore…",
|
||||||
"description": "Text for buttons used to restore content"
|
"description": "Text for buttons used to restore content"
|
||||||
},
|
},
|
||||||
|
"resetToDefaultButton": {
|
||||||
|
"message": "Reset to default settings…",
|
||||||
|
"description": "Text for buttons used to reset configurations to default"
|
||||||
|
},
|
||||||
|
"resetToDefaultConfirm": {
|
||||||
|
"message": "All your custom settings will be removed. Do you really want to reset to default settings?",
|
||||||
|
"description": "Message asking user to confirm reset to default settings"
|
||||||
|
},
|
||||||
"dnrRulesWarning": {
|
"dnrRulesWarning": {
|
||||||
"message": "Do not add content from untrusted sources",
|
"message": "Do not add content from untrusted sources",
|
||||||
"description": "Short description of the DNR rules editor pane"
|
"description": "Short description of the DNR rules editor pane"
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@
|
||||||
<p>
|
<p>
|
||||||
<button class="iconified dontshrink" type="button"><span class="fa-icon">download-alt</span><span data-i18n="backupButton">_</span><span class="hover"></span></button>
|
<button class="iconified dontshrink" type="button"><span class="fa-icon">download-alt</span><span data-i18n="backupButton">_</span><span class="hover"></span></button>
|
||||||
<button class="iconified dontshrink" type="button"><span class="fa-icon">upload-alt</span><span data-i18n="restoreButton">_</span><span class="hover"></span></button><input type="file" accept="application/json">
|
<button class="iconified dontshrink" type="button"><span class="fa-icon">upload-alt</span><span data-i18n="restoreButton">_</span><span class="hover"></span></button><input type="file" accept="application/json">
|
||||||
|
<button class="iconified dontshrink" type="button"><span class="fa-icon">undo</span><span data-i18n="resetToDefaultButton">_</span><span class="hover"></span></button><input type="file" accept="application/json">
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
Home: https://github.com/gorhill/uBlock
|
Home: https://github.com/gorhill/uBlock
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { browser, sendMessage } from './ext.js';
|
import { browser, i18n, sendMessage } from './ext.js';
|
||||||
import { dom, qs$ } from './dom.js';
|
import { dom, qs$ } from './dom.js';
|
||||||
import { hashFromIterable } from './dashboard.js';
|
import { hashFromIterable } from './dashboard.js';
|
||||||
import { renderFilterLists } from './filter-lists.js';
|
import { renderFilterLists } from './filter-lists.js';
|
||||||
|
|
@ -173,6 +173,13 @@ async function restoreSettings() {
|
||||||
input.click();
|
input.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function resetSettings() {
|
||||||
|
const response = self.confirm(i18n.getMessage('resetToDefaultConfirm'));
|
||||||
|
if ( response !== true ) { return; }
|
||||||
|
const api = await import('./backup-restore.js');
|
||||||
|
await api.restoreFromObject({});
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
dom.on('#autoReload input[type="checkbox"]', 'change', ev => {
|
dom.on('#autoReload input[type="checkbox"]', 'change', ev => {
|
||||||
|
|
@ -210,6 +217,10 @@ dom.on('section[data-pane="settings"] [data-i18n="restoreButton"]', 'click', ( )
|
||||||
restoreSettings();
|
restoreSettings();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dom.on('section[data-pane="settings"] [data-i18n="resetToDefaultButton"]', 'click', ( ) => {
|
||||||
|
resetSettings();
|
||||||
|
});
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
function listen() {
|
function listen() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue