-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·94 lines (82 loc) · 2.8 KB
/
index.html
File metadata and controls
executable file
·94 lines (82 loc) · 2.8 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
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html>
<head>
<title>Slate Example Configuration</title>
<link rel='stylesheet' type='text/css' href='css/slate.min.css'>
<script src='js/slate.min.js'></script>
<style>
.title {
padding: 15px 10px;
text-transform: uppercase;
font-family: 'PT Sans', sans-serif;
font-size: 1.2em;
font-weight: 500;
color: #888888;
text-align: center;
}
</style>
</head>
<body>
<h1 class='title'>LIFX Configuration</h1>
<div class='item-container'>
<div class='item-container-content'>
<div class='item'>
On this page you can enter your LIFX Token. After this the Pebble App is fully functional. At the current state all the lights associated with your account are triggered.
</div>
</div>
</div>
<div class='item-container'>
<!--<div class='item-container-header'>Customizability</div>-->
<div class='item-container-content'>
<label class='item'>
Token: <input id='lifx_token' type='text' class='' value=''>
</label>
</div>
</div>
<div class='item-container'>
<div class='button-container'>
<input id='submit_button' type='button' class='item-button' value='SUBMIT'>
</div>
</div>
</body>
<script>
function getConfigData() {
var picker = document.getElementById('lifx_token');
var options = {
'lifx_token': picker.value,
};
// Save for next launch
//localStorage['background_color'] = options['background_color'];
//localStorage['high_contrast'] = options['high_contrast'];
console.log('Got options: ' + JSON.stringify(options));
return options;
}
function getQueryParam(variable, defaultValue) {
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 defaultValue || false;
}
var submitButton = document.getElementById('submit_button');
submitButton.addEventListener('click', function() {
console.log('Submit');
// Set the return URL depending on the runtime environment
var return_to = getQueryParam('return_to', 'pebblejs://close#');
document.location = return_to + encodeURIComponent(JSON.stringify(getConfigData()));
});
(function() {
/*var backgroundColorPicker = document.getElementById('background_color_picker');
var highContrastCheckbox = document.getElementById('high_contrast_checkbox');
// Load any previously saved configuration, if available
if(localStorage['high_contrast']) {
highContrastCheckbox.checked = JSON.parse(localStorage['high_contrast']);
backgroundColorPicker.value = localStorage['background_color'];
}*/
})();
</script>
</html>