-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
59 lines (56 loc) · 2.04 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<title>Settings</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
</head>
<body>
<div data-role="page" id="main">
<div data-role="header" class="jqm-header">
<h1>Settings</h1>
</div>
<div data-role="content">
<div data-role="fieldcontain">
<label for="term">Search Term</label>
<input name="term" id="term" placeholder="What do you want pictures of?"></textarea>
</div>
<div data-role="fieldcontain">
<label for="shake">Shake to Refresh</label>
<select name="shake" id="shake" data-role="slider">
<option value="off">Off</option>
<option value="on">On</option>
</select>
</div>
</div>
<fieldset class="ui-grid-a">
<div class="ui-block-a"><button type="submit" data-theme="d" id="cancel">Cancel</button></div>
<div class="ui-block-b"><button type="submit" data-theme="a" id="submit">Submit</button></div>
</fieldset>
</div>
<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>
<script>
function save() {
var settings = {};
settings.term = $("#term").val();
settings.shake = $("#shake").val();
return settings;
}
$().ready(function() {
$("#cancel").click(function() {
console.log("Cancel");
var location = "pebblejs://close";
document.location = location;
});
$("#submit").click(function() {
console.log("Submit");
var location = "pebblejs://close#" + encodeURIComponent(JSON.stringify(save()));
document.location = location;
});
var settings = JSON.parse(decodeURIComponent(window.location.search.substring(1)));
$("#term").val(settings.term);
$("#shake").val(settings.shake).slider("refresh");
});
</script>
</body>
</html>