-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.js
90 lines (85 loc) · 1.71 KB
/
options.js
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
my_options = {
hotkeyEnable: {
name:"Hotkey Enable",
decription:"Enable/disable extension with hotkey.",
supported:false
},
showOnHotkey: {
name:"Show on Hotkey",
description:"Show pane only when hotkey is pressed.",
type:"binary",
optionClass:"regular",
value:false,
supported:true,
dependents:
{
showHotkey:true
}
},
showHotkey: {
name:"Hotkey (show pane)",
description:"The hotkey used to show pane",
dependencies:
{
showOnHotkey:true
},
type:"hotkey",
optionClass:"regular",
value:
{
keyCode:66,
ctrl:false,
alt:true,
shift:false,
identifier:66
},
supported:true
},
showOnModifier: {
name:"CTRL-Click",
description:"Show pane only when CTRL is pressed whilst marking text.",
type:"binary",
optionClass:"regular",
value:false,
supported:true
},
theseAreInitialValues:true
}
function saveOptions()
{
//console.log("saveOptions")
chrome.storage.local.set({"options":options})
}
var defaultOptions = {options:my_options}
options = {}
optionsReady = false
// var clearLocalStorage = true
//
// if (clearLocalStorage)
// {
// chrome.storage.local.set({"options":{}}, function(){
// chrome.storage.local.get("options", function(items){
// //console.log(items)
// optionsStorage = items.options
// populateOptions(my_options)
//
// //console.log("options done")
// })
// })
// }
// else
{
chrome.storage.local.get(defaultOptions, function(items){
options = items.options
if (options.hasOwnProperty("theseAreInitalValues"))
{
//console.log("initialValues")
saveOptions()
delete options.theseAreInitialValues
}
console.log("options:")
console.log(options)
//console.log("options done")
optionsReady = true
})
}