-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathToggle JS Debugger.jsx
56 lines (51 loc) · 1.26 KB
/
Toggle JS Debugger.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* Toggles Javascript Debugger
*
* @author Zack Lovatt <[email protected]>
* @version 0.2.1
*/
(function toggleJSDebugger() {
var prefInfo = {
section: 'Main Pref Section v2',
key: 'Pref_JAVASCRIPT_DEBUGGER',
file: PREFType.PREF_Type_MACHINE_INDEPENDENT,
};
var newSetting;
try {
// Toggle the pref, save to disk, and reload so it's active in the current session
if (parseFloat(app.version) >= 12.0) {
newSetting = +!(
app.preferences.getPrefAsLong(
prefInfo.section,
prefInfo.key,
prefInfo.file
) === 1
);
app.preferences.savePrefAsLong(
prefInfo.section,
prefInfo.key,
newSetting,
prefInfo.file
);
} else {
prefInfo.section = 'Main Pref Section';
newSetting = +!(
app.preferences.getPrefAsLong(prefInfo.section, prefInfo.key) === 1
);
app.preferences.savePrefAsLong(
prefInfo.section,
prefInfo.key,
newSetting
);
}
app.preferences.saveToDisk();
app.preferences.reload();
if (newSetting === 0) {
alert('Javascript Debugger Disabled');
} else {
alert('Javascript Debugger Enabled');
}
} catch (e) {
alert('Can\'t change prefs!\n' + e);
}
})();