-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoptions.html
69 lines (60 loc) · 2.01 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
<!DOCTYPE html>
<html>
<head>
<title>Options page for close tabs right/left of current</title>
<link rel="stylesheet" href="options.css">
</head>
<body>
<header>
<img src="icons/icon_64.png">
<h1 id="widget-name">Close tabs right/left of current</h1>
<br/>
<h2>Made by <span id="widget-author"><a href="mailto:[email protected]">schizunio</a></h2>
</header>
<fieldset>
<p>
<label for="option">Select which buttons you want to display:</label>
<select name="option" id="option">
<option value="0">None</option>
<option value="1">Left</option>
<option value="2">Right</option>
</select>
</p>
<p>
<label for="includeSelf">Close also current (active) tab?</label>
<input id="includeSelf" type="checkbox" value="1">
</fieldset>
<p>
<h2>Remember - you need to restart opera for extension to work with already opened tabs!</h2>
</p>
<p>
Currently it's impossible for extension to have 2 buttons, so for now, you have to choose..
<br/>
I could make a popup, with 2 links/buttons, but that would be 2 clicks, not 1.
</p>
<script>
var select = document.getElementById('option');
var checkbox = document.getElementById('includeSelf');
var source = false;
opera.extension.onmessage = function(event){
source = event.source;
}
if ( widget.preferences.option ) {
select.value = widget.preferences.option;
}
if ( widget.preferences.includeSelf) {
checkbox.checked = (widget.preferences.includeSelf == 1 ? true : false);
}
select.addEventListener('change', function() {
widget.preferences.option = this.value;
if (source)
source.postMessage("reset");
}, false );
checkbox.addEventListener('change', function() {
widget.preferences.includeSelf = (this.checked ? 1 : 0);
if (source)
source.postMessage("reset");
}, false );
</script>
</body>
</html>