This repository was archived by the owner on Dec 10, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoptions.html
More file actions
81 lines (71 loc) · 2.35 KB
/
options.html
File metadata and controls
81 lines (71 loc) · 2.35 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="css/options.css">
<title id="widget-title">Live Page Code</title>
</head>
<body>
<header>
<img src="icons/icon.png">
<h1 id="widget-name">Live Page Code</h1>
</header>
<section>
<h3 id="MSG_settings">Settings</h3>
<fieldset>
<p>
<input name="check" id="saveimages" type="checkbox"></input>
<label for="saveimages" id="MSG_save">Save images as data-URI*</label>
</p>
<p>
<input name="check" id="encodeb64" type="checkbox"></input>
<label for="encodeb64" id="MSG_encode">Encode URI as base64 when opening**</label>
</p>
<p>
<input name="check" id="debugmode" type="checkbox"></input>
<label for="debugmode" id="MSG_debug">Enable debug output</label>
</p>
</fieldset>
<br /><p id="MSG_star_one">* only if images are from the same domain.</p>
<p id="MSG_star_two">** prevents save blocking by URL-filter.</p>
</section>
<footer>
<p>Powered by the Opera Browser</p>
</footer>
<script>
addEventListener('DOMContentLoaded', function() {
var storage;
if (typeof widget === 'undefined' || !widget.preferences) {
storage = window.opera.scriptStorage
} else {
storage = widget.preferences;
}
function s2b(s) { return s === "true" ? true : false; }
document.getElementsByTagName('html')[0].setAttribute('lang', window.navigator.language.slice(0,2));
function setOptions() {
document.querySelector("#saveimages").checked = s2b(storage["saveimages"]);
document.querySelector("#encodeb64").checked = s2b(storage["encodeb64"]);
document.querySelector("#debugmode").checked = s2b(storage["debugmode"]);
}
function saveOptions() {
var options = getOptions();
storage["saveimages"] = options.saveimages;
storage["encodeb64"] = options.encodeb64;
storage["debugmode"] = options.debugmode;
}
function optionChange() { saveOptions(); }
function getOptions() {
return {
saveimages: document.querySelector("#saveimages").checked,
encodeb64: document.querySelector("#encodeb64").checked,
debugmode: document.querySelector("#debugmode").checked,
};
}
// main
setOptions();
var inputs = document.querySelectorAll("input");
for (var n=0, e; e=inputs[n]; n++) e.addEventListener("change", optionChange, false);
},false);
</script>
</body>
</html>