diff --git a/scratchpad-scripts/arkenfox-clear-deprecated.js b/scratchpad-scripts/arkenfox-clear-deprecated.js index 766dd33..e12f0f4 100644 --- a/scratchpad-scripts/arkenfox-clear-deprecated.js +++ b/scratchpad-scripts/arkenfox-clear-deprecated.js @@ -1,17 +1,20 @@ /*** - Version: up to and including FF/ESR78 + Version: up to and including FF/ESR78 - This will reset the preferences that have been deprecated by Mozilla - and used in the arkenfox user.js + This will reset the preferences that have been deprecated by Mozilla + and used in the arkenfox user.js - It is in reverse order, so feel free to remove sections that do not apply + It is in reverse order, so feel free to remove sections that do not apply - For instructions see: - https://github.com/arkenfox/user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts] + For instructions see: + https://github.com/arkenfox/user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts] ***/ -(function() { - let ops = [ +(() => { + + if ('undefined' === typeof(Services)) return alert('about:config needs to be the active tab!'); + + const aPREFS = [ /* deprecated */ /* 78 */ @@ -220,29 +223,26 @@ /* reset parrot: check your open about:config after running the script */ '_user.js.parrot' - ] + ]; + + console.clear(); - if("undefined" === typeof(Services)) { - alert("about:config needs to be the active tab!"); - return; - } - let c = 0; - for (let i = 0, len = ops.length; i < len; i++) { - if (Services.prefs.prefHasUserValue(ops[i])) { - Services.prefs.clearUserPref(ops[i]); - if (!Services.prefs.prefHasUserValue(ops[i])) { - console.log("reset", ops[i]); + for (const sPname of aPREFS) { + if (Services.prefs.prefHasUserValue(sPname)) { + Services.prefs.clearUserPref(sPname); + if (!Services.prefs.prefHasUserValue(sPname)) { + console.info('reset', sPname); c++; - } else { console.log("failed to reset", ops[i]); } + } else console.warn('failed to reset', sPname); } } - + focus(); - - let d = (c==1) ? " pref" : " prefs"; - if (c > 0) { - alert("successfully reset " + c + d + "\n\nfor details check the Browser Console (Ctrl+Shift+J)"); - } else { alert("nothing to reset"); } - + + const d = (c==1) ? ' pref' : ' prefs'; + alert(c ? 'successfully reset ' + c + d + "\n\nfor details check the console" : 'nothing to reset'); + + return 'all done'; + })();