-
Notifications
You must be signed in to change notification settings - Fork 0
/
configurable.html
137 lines (123 loc) · 4.16 KB
/
configurable.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<title>AccuInfo 2.0.0 Configuration</title>
</head>
<body>
<div data-role="page" id="page1">
<div data-theme="" data-role="header">
<h3>AccuInfo</h3>
</div>
<div data-role="content">
<h2>Settings</h2>
<div data-role="fieldcontain">
<label for="month">Display month</label>
<select name="month" id="month" data-theme="" data-role="slider">
<option value="1">On</option>
<option value="0">Off</option>
</select>
<br>
<label for="date">Display date</label>
<select name="date" id="date" data-theme="" data-role="slider">
<option value="1">On</option>
<option value="0">Off</option>
</select>
<br>
<label for="hour">Display hour</label>
<select name="hour" id="hour" data-theme="" data-role="slider">
<option value="1">On</option>
<option value="0">Off</option>
</select>
<br>
<label for="minute">Display minute</label>
<select name="minute" id="minute" data-theme="" data-role="slider">
<option value="1">On</option>
<option value="0">Off</option>
</select>
<br>
<label for="bluetooth">Display bluetooth</label>
<select name="bluetooth" id="bluetooth" data-theme="" data-role="slider">
<option value="1">On</option>
<option value="0">Off</option>
</select>
<br>
Pod Change time
<br>
<label for="pchour">Hours ago</label>
<input name="pchour" id="pchour" data-theme="" type="number"
value="">
</input>
</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>
<script>
<!-- from http://snipplr.com/view/26662/get-url-parameters-with-jquery--improved/ -->
$.urlParam = function(name){
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (!results) { return 0; }
return results[1] || 0;
}
function updateControls() {
var month = decodeURIComponent($.urlParam("month"));
if (month != '') {
$("#month").val(month).slider("refresh");
}
var date = decodeURIComponent($.urlParam("date"));
if (date != '') {
$("#date").val(date).slider("refresh");
}
var hour = decodeURIComponent($.urlParam("hour"));
if (hour != '') {
$("#hour").val(hour).slider("refresh");
}
var minute = decodeURIComponent($.urlParam("minute"));
if (minute != '') {
$("#minute").val(minute).slider("refresh");
}
var bluetooth = decodeURIComponent($.urlParam("bluetooth"));
if (bluetooth != '') {
$("#bluetooth").val(bluetooth).slider("refresh");
}
var pchour = decodeURIComponent($.urlParam("pchour"));
if (pchour != '') {
$("#pchour").val(pchour);
}
}
function saveOptions() {
var options = {
'month': $("#month").val(),
'date': $("#date").val(),
'hour': $("#hour").val(),
'minute': $("#minute").val(),
'bluetooth': $("#bluetooth").val(),
'pchour': $("#pchour").val(),
}
return options;
}
$().ready(function() {
$("#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(location);
document.location = location;
});
});
$('#page1').bind('pageinit', updateControls);
</script>
</body>
</html>