-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.html
72 lines (69 loc) · 2.64 KB
/
configuration.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
<!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="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>
</head>
<body>
<div data-role="page" id="main">
<div data-role="header" class="jqm-header">
<h1>Pebble MYLAPS config</h1>
</div>
<div data-role="content">
<div data-role="fieldcontain">
<label for="transponderid">Transponder ID:</label>
<input name="transponderid" id="transponderid"></input>
</div>
<div data-role="fieldcontain">
<label for="trackid">Track ID:</label>
<input name="trackid" id="trackid"></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>
</div>
<script>
function getQueryParam(variable, default_) {
var query = location.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (pair[0] == variable)
return decodeURIComponent(pair[1]);
}
return default_ || '';
}
function saveOptions() {
var options = {
'transponderid': $("#transponderid").val(),
'trackid': $("#trackid").val()
};
return options;
}
$().ready(function() {
$("#transponderid").val(getQueryParam('transponderid'));
$("#trackid").val(getQueryParam('trackid'));
$("#b-cancel").click(function() {
console.log("Cancel");
document.location = "pebblejs://close";
});
$("#b-submit").click(function() {
console.log("Submit");
var return_to = getQueryParam('return_to', 'pebblejs://close#');
var location = return_to + encodeURIComponent(JSON.stringify(saveOptions()));
console.log("Warping to: " + location);
document.location = location;
});
});
</script>
</body>
</html>