forked from palian/BlueFuturistic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.html
145 lines (129 loc) · 5.48 KB
/
config.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!DOCTYPE html>
<html>
<head>
<title>Configurable</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="https://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head>
<body>
<div data-role="page" id="main">
<div data-role="header" class="jqm-header">
<h1>Configuration</h1>
</div>
<div data-role="content">
<div data-role="fieldcontain">
<label for="color_select">Word Color:</label>
<select name="color_select" id="color_select" data-role="text-box">
<option value="1">Light Blue</option>
<option value="2">Dark Blue</option>
<option value="3">Oxford Blue</option>
<option value="4">White</option>
<option value="5">Light Gray</option>
<option value="6">Black</option>
<option value="7">Yellow</option>
<option value="8">Orange</option>
<option value="9">Light Red</option>
<option value="10">Dark Red</option>
<option value="11">Bright Green</option>
<option value="12">Light Green</option>
<option value="13">Dark Green</option>
<option value="14">Vivid Violet</option>
<option value="15">Light Purple</option>
<option value="16">Dark Purple</option>
</select>
</div>
<div data-role="fieldcontain">
<label for="color2_select">Numbers Color:</label>
<select name="color2_select" id="color2_select" data-role="text-box">
<option value="1">Light Blue</option>
<option value="2">Dark Blue</option>
<option value="3">Oxford Blue</option>
<option value="4">White</option>
<option value="5">Light Gray</option>
<option value="6">Black</option>
<option value="7">Yellow</option>
<option value="8">Orange</option>
<option value="9">Light Red</option>
<option value="10">Dark Red</option>
<option value="11">Bright Green</option>
<option value="12">Light Green</option>
<option value="13">Dark Green</option>
<option value="14">Vivid Violet</option>
<option value="15">Light Purple</option>
<option value="16">Dark Purple</option>
</select>
</div>
<div data-role="fieldcontain">
<label for="color1_select">Background Color:</label>
<select name="color1_select" id="color1_select" data-role="text-box">
<option value="1">Light Blue</option>
<option value="2">Dark Blue</option>
<option value="3">Oxford Blue</option>
<option value="4">White</option>
<option value="5">Light Gray</option>
<option value="6">Black</option>
<option value="7">Yellow</option>
<option value="8">Orange</option>
<option value="9">Light Red</option>
<option value="10">Dark Red</option>
<option value="11">Bright Green</option>
<option value="12">Light Green</option>
<option value="13">Dark Green</option>
<option value="14">Vivid Violet</option>
<option value="15">Light Purple</option>
<option value="16">Dark Purple</option>
</select>
</div>
</div>
<div class="ui-body ui-body-b">
<fieldset class="ui-grid-a">
<div class="ui-block-a"><button type="submit" data-theme="d" id="b-cancel">Cancel</button></div>
<div class="ui-block-b"><button type="submit" data-theme="a" id="b-submit">Submit</button></div>
</fieldset>
</div>
</div>
</div>
</div>
<script>
function selectElement(select, variable) {
var color = getURLVariable(variable);
$(select).val(color);
$(select).selectmenu('refresh', true);
}
function getURLVariable(name) {
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)",
regex = new RegExp(regexS),
results = regex.exec(window.location.href);
if (results == null) return "";
else return results[1];
}
function saveOptions() {
var options = {
'color': $("#color_select").val(),'color1': $("#color1_select").val(),'color2': $("#color2_select").val(),
}
return options;
}
$(function() {
// select options from request variables
selectElement("#color_select", "color");
selectElement("#color1_select", "color1");
selectElement("#color2_select", "color2");
$("#b-cancel").click(function() {
console.log("Cancel");
document.location = "pebblejs://close";
});
$("#b-submit").click(function() {
console.log("Submit");
var location = "pebblejs://close#" + encodeURIComponent(JSON.stringify(saveOptions()));
console.log("Warping to: " + location);
console.log(location);
document.location = location;
});
});
</script>
</body>
</html>