Skip to content

Commit acc1376

Browse files
authored
Update arkenfox-clear-deprecated.js
1 parent 939d75e commit acc1376

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

scratchpad-scripts/arkenfox-clear-deprecated.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
/***
2-
Version: up to and including FF/ESR78
2+
Version: up to and including FF/ESR78
33
4-
This will reset the preferences that have been deprecated by Mozilla
5-
and used in the arkenfox user.js
4+
This will reset the preferences that have been deprecated by Mozilla
5+
and used in the arkenfox user.js
66
7-
It is in reverse order, so feel free to remove sections that do not apply
7+
It is in reverse order, so feel free to remove sections that do not apply
88
9-
For instructions see:
10-
https://github.com/arkenfox/user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts]
9+
For instructions see:
10+
https://github.com/arkenfox/user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts]
1111
***/
1212

13-
(function() {
14-
let ops = [
13+
(() => {
14+
15+
if ('undefined' === typeof(Services)) return alert('about:config needs to be the active tab!');
16+
17+
const aPREFS = [
1518
/* deprecated */
1619

1720
/* 78 */
@@ -220,29 +223,26 @@
220223

221224
/* reset parrot: check your open about:config after running the script */
222225
'_user.js.parrot'
223-
]
226+
];
227+
228+
console.clear();
224229

225-
if("undefined" === typeof(Services)) {
226-
alert("about:config needs to be the active tab!");
227-
return;
228-
}
229-
230230
let c = 0;
231-
for (let i = 0, len = ops.length; i < len; i++) {
232-
if (Services.prefs.prefHasUserValue(ops[i])) {
233-
Services.prefs.clearUserPref(ops[i]);
234-
if (!Services.prefs.prefHasUserValue(ops[i])) {
235-
console.log("reset", ops[i]);
231+
for (const sPname of aPREFS) {
232+
if (Services.prefs.prefHasUserValue(sPname)) {
233+
Services.prefs.clearUserPref(sPname);
234+
if (!Services.prefs.prefHasUserValue(sPname)) {
235+
console.info('reset', sPname);
236236
c++;
237-
} else { console.log("failed to reset", ops[i]); }
237+
} else console.warn('failed to reset', sPname);
238238
}
239239
}
240-
240+
241241
focus();
242-
243-
let d = (c==1) ? " pref" : " prefs";
244-
if (c > 0) {
245-
alert("successfully reset " + c + d + "\n\nfor details check the Browser Console (Ctrl+Shift+J)");
246-
} else { alert("nothing to reset"); }
247-
242+
243+
const d = (c==1) ? ' pref' : ' prefs';
244+
alert(c ? 'successfully reset ' + c + d + "\n\nfor details check the console" : 'nothing to reset');
245+
246+
return 'all done';
247+
248248
})();

0 commit comments

Comments
 (0)