forked from philc/vimium
-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings.html
100 lines (93 loc) · 3.18 KB
/
settings.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
<html>
<head>
<title>Vimium Settings</title>
<style type="text/css" media="screen">
body {
font-family:"helvetica neue", "helvetica", "arial", "sans";
width:600px;
margin:10px auto;
}
.example {
font-size:80%;
color:#555;
margin-left:20px;
}
.caption {
margin-right:10px;
}
td {
padding:5px 0;
}
button#saveSettings {
margin-top:20px;
}
textarea#excludedUrls {
width:450px;
min-height:100px;
}
#status {
margin-left:10px;
font-size:80%;
}
/* Make the caption in the settings table as small as possible, to pull the other fields to the right. */
td:nth-child(1), td:nth-child(2) {
width:1px;
white-space:nowrap;
}
</style>
</head>
<script type="text/javascript">
// Saves options to localStorage.
function saveOptions() {
localStorage["scrollStepSize"] = document.getElementById("scrollStepSize").value
localStorage["defaultZoomLevel"] = document.getElementById("defaultZoomLevel").value
localStorage["excludedUrls"] = document.getElementById("excludedUrls").value;
// Give the user some feedback that their options were saved.
var status = document.getElementById("status");
status.innerHTML = "Settings Saved.";
setTimeout(function() { status.innerHTML = ""; }, 750);
}
// Restores select box state to saved value from localStorage.
function populateOptions() {
// TODO(ilya): Create a single option list with defaults somewhere to share across various scripts.
var scrollStepSize = localStorage["scrollStepSize"] || 60;
var defaultZoomLevel = localStorage["defaultZoomLevel"] || 100;
var defaultExcludedUrls = localStorage["excludedUrls"] || "";
document.getElementById("scrollStepSize").value = scrollStepSize;
document.getElementById("defaultZoomLevel").value = defaultZoomLevel;
document.getElementById("excludedUrls").value = defaultExcludedUrls;
}
</script>
<body onload="populateOptions()">
<h1>Vimium - Settings</h1>
<table>
<tr>
<td class="caption">Scroll Step Size</td>
<td><input id="scrollStepSize" type="text" style="width:50px">px</td>
<td><span class="example">(default: 60)</td>
</tr>
<tr>
<td><span class="caption">Default zoom level</span></td>
<td><input id="defaultZoomLevel" type="text" value="100" style="width:50px">%</td>
<td><span class="example">(default: 100)</span></td>
</tr>
<tr>
<td colspan="3">
<div style="position:relative">
Excluded URLs<br/>
<div style="position:absolute; right:-240px; width:240px">
<div class="example">
e.g. http*://mail.google.com/*<br/>
This will disable Vimium on Gmail.<br/><br/>
Enter one URL per line.<br/>
</div>
</div>
<textarea id="excludedUrls"></textarea>
</div>
</td>
</tr>
</table>
<button id="saveSettings" onclick="saveOptions()">Save Settings</button>
<span id="status"></status>
</body>
</html>