Skip to content

Commit 939d75e

Browse files
authored
Update arkenfox-clear-removed.js
1 parent 3b573bf commit 939d75e

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

scratchpad-scripts/arkenfox-clear-removed.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
/***
2-
This will reset the preferences that have been removed completely from the arkenfox user.js.
2+
This will reset the preferences that have been removed completely from the arkenfox user.js.
33
4-
Last updated: 25-May-2021
4+
Last updated: 25-May-2021
55
6-
For instructions see:
7-
https://github.com/arkenfox/user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts]
6+
For instructions see:
7+
https://github.com/arkenfox/user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts]
88
***/
9-
10-
(function() {
11-
let ops = [
9+
10+
(() => {
11+
12+
if ('undefined' === typeof(Services)) return alert('about:config needs to be the active tab!');
13+
14+
const aPREFS = [
1215
/* removed in arkenfox user.js */
1316
/* 52-alpha */
1417
'browser.search.reset.enabled',
@@ -240,29 +243,26 @@
240243
'security.ssl.enable_ocsp_stapling',
241244
/* reset parrot: check your open about:config after running the script */
242245
'_user.js.parrot'
243-
]
246+
];
247+
248+
console.clear();
244249

245-
if("undefined" === typeof(Services)) {
246-
alert("about:config needs to be the active tab!");
247-
return;
248-
}
249-
250250
let c = 0;
251-
for (let i = 0, len = ops.length; i < len; i++) {
252-
if (Services.prefs.prefHasUserValue(ops[i])) {
253-
Services.prefs.clearUserPref(ops[i]);
254-
if (!Services.prefs.prefHasUserValue(ops[i])) {
255-
console.log("reset", ops[i]);
251+
for (const sPname of aPREFS) {
252+
if (Services.prefs.prefHasUserValue(sPname)) {
253+
Services.prefs.clearUserPref(sPname);
254+
if (!Services.prefs.prefHasUserValue(sPname)) {
255+
console.info('reset', sPname);
256256
c++;
257-
} else { console.log("failed to reset", ops[i]); }
257+
} else console.warn('failed to reset', sPname);
258258
}
259259
}
260-
260+
261261
focus();
262-
263-
let d = (c==1) ? " pref" : " prefs";
264-
if (c > 0) {
265-
alert("successfully reset " + c + d + "\n\nfor details check the Browser Console (Ctrl+Shift+J)");
266-
} else { alert("nothing to reset"); }
267-
262+
263+
const d = (c==1) ? ' pref' : ' prefs';
264+
alert(c ? 'successfully reset ' + c + d + "\n\nfor details check the console" : 'nothing to reset');
265+
266+
return 'all done';
267+
268268
})();

0 commit comments

Comments
 (0)