-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathoptions.html
117 lines (112 loc) · 3.54 KB
/
options.html
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<html>
<head>
<title>Navigation Extension Options</title>
<style type="text/css" media="screen">
body {
margin-top : 20px;
margin-left: 10%;
background: -webkit-gradient(linear, 0% 0%, 20% 100%,
from(silver), to(white));
}
</style>
<script type="text/javascript">
function restore(){
FunctionManager.restore();
HitaHintManager.restore();
SiteManager.restore();
}
// for key config
var FunctionManager = {
save: function(){
localStorage["search"] = search.checked;
localStorage["hitahint"] = hitahint.checked;
localStorage["other"] = other.checked;
},
restore: function(){
if (!localStorage["search"])
localStorage["search"] = true;
if (!localStorage["hitahint"])
localStorage["hitahint"] = true;
if (!localStorage["other"])
localStorage["other"] = true;
search.checked = localStorage["search"] =="true"?true:false;
hitahint.checked = localStorage["hitahint"] =="true"?true:false;
other.checked = localStorage["other"] =="true"?true:false;
},
};
// for hit a hint
var HitaHintManager = {
save: function(){
if (hitahintkeys.value)
localStorage["hitahintkeys"] = hitahintkeys.value;
},
restore: function(){
if (!localStorage["hitahintkeys"])
localStorage["hitahintkeys"] = "asdfjkl";
hitahintkeys.value = localStorage["hitahintkeys"];
},
};
// for disabled sites
var SiteManager = {
save: function(){
var sites = "";
for (var i=0 ; i < disabled_sites.length ; i++)
sites += disabled_sites[i].value+",";
localStorage["disabled_sites"] = sites;
},
restore: function(){
var data = localStorage["disabled_sites"];
if (!data)
return;
var sites = data.split(",").slice(0,-1);
for (var i=0 ; i < sites.length ; i++)
this._append(sites[i]);
},
add: function(){
if (disabled_sites_adder.value == "")
return;
this._append(disabled_sites_adder.value);
},
del: function(){
for (var i=0; i < disabled_sites.length ; i++)
if (disabled_sites[i].selected)
disabled_sites.removeChild(disabled_sites[i--]);
},
_append: function(site){
var option = document.createElement("option");
option.innerText = site;
option.value = site;
disabled_sites.appendChild(option);
},
};
</script>
</head>
<body onload="restore()">
<h1>Functions</h1>
<table>
<tr>
<td><input type='checkbox' id='search' onclick="FunctionManager.save()" /></td>
<td>Enable Migemo Link Search</td>
</tr>
<tr>
<td><input type='checkbox' id='hitahint' onclick="FunctionManager.save()" /></td>
<td>Enable Hit-a-Hint</td>
</tr>
<tr>
<td><input type='checkbox' id='other' onclick="FunctionManager.save()" /></td>
<td>Enable Other Key Bindings</td>
</tr>
</table>
<h1>Hit-a-Hint Keys</h1>
<p>Characters to be used in hit-a-hint keys.</p>
<input id="hitahintkeys" style="width: 400px;" value="asdfjkl" onkeyup="HitaHintManager.save()"/>
<h1>Disabled Sites</h1>
<p>List URLs where this extension is disabled. You can use regular expressions here.</p>
<input id="disabled_sites_adder" style="width: 400px;" />
<input type="button" value="Add" onclick="SiteManager.add()"/>
<br/>
<select multiple id="disabled_sites" style="width: 400px; height: 200px;"></select>
<input type="button" value="Delete" onclick="SiteManager.del()"/>
<input type="button" value="save" onclick="SiteManager.save()"/>
</body>
</html>