-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathoptions.js
More file actions
30 lines (22 loc) · 756 Bytes
/
options.js
File metadata and controls
30 lines (22 loc) · 756 Bytes
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
"use strict";
const EDITOR_STATES = [ "editorDefaultState", "editorChangedState", "editorSavedState" ];
nsUI.init( () =>
{
nsUI.tweakTextArea( "#scriptarea",
{
canTabs: true,
canAutocomplete: true,
onInput: () => nsUI.setState( "editorChangedState", EDITOR_STATES )
});
nsUI.bind( "#btnSave", "click", event =>
{
const script = nsUI.elem( "#scriptarea" ).value;
nsSettings.set({ "mixinsScript": script }, () => nsUI.setState( "editorSavedState", EDITOR_STATES ));
});
nsUI.onCtrlS( () => nsUI.elem( "#btnSave" ).click() );
nsSettings.get([ "mixinsScript" ], stored =>
{
if( stored.mixinsScript ) // Don't overwrite initial synopsis text
nsUI.elem( "#scriptarea" ).value = stored.mixinsScript;
});
});