'
@@ -203,10 +229,9 @@ function getWiFi(id) {
req.open("GET", "/wifi/scan", true);
req.send()
-
}
-function ClickDay(id, day) {
+function clickDay(id, day) {
value = parameters[id].split('')
day_value = value[day]
day_value = (day_value=='0')?'1':'0'
@@ -217,7 +242,16 @@ function ClickDay(id, day) {
sendUpdate(id);
}
-function ElementHTML(element) {
+function sendTime(id) {
+ var value = document.getElementById('_ui_element_' + id).value
+ if (value) {
+ var date = new Date(value)
+ var timestamp = Math.floor(date.getTime()/1000);
+ sendAction('time',{"timestamp":timestamp})
+ }
+}
+
+function elementHTML(element) {
var value
if (parameters[element.id] || !isNaN(parameters[element.id])) {
value = parameters[element.id]
@@ -230,13 +264,13 @@ function ElementHTML(element) {
case 'hr':
return '
'
case 'button':
- return '
'
+ return '
'
case 'password':
return '
'
- + ''
- + '
'
+ + '
'
+ + '
'
case 'input':
var pattern = ""
if (element.pattern) {
@@ -251,15 +285,15 @@ function ElementHTML(element) {
pattern = ' pattern="' + encode(element.pattern) + '"'
}
return '
'
- + ''
- + '
'
+ + '
'
+ + '
'
+ '
'
+ '
'
+ ''
- + '
'
- + '
'
+ + '
'
+ + '
'
case 'checkbox':
return ''
return days
+ case 'timeset':
+ var now = new Date()
+ now.setMinutes(now.getMinutes() - now.getTimezoneOffset())
+ value = now.toISOString().slice(0, -1);
+ return '
'
+ +'
'
+ + '
->
'
case 'text':
return '
' + encode(value) + '
'
case 'number':
@@ -301,13 +342,13 @@ function ElementHTML(element) {
+ ' class="pure-u-1" maxlength="99" oninput="sendUpdate(\'' + element.id + '\')" />'
case 'table':
default:
- return '
'
- + encode(element.label)+ '
' + encode(value) + '
'
+ return '
'
+ + encode(element.label)+ '
' + encode(value) + '
'
}
}
-function DrawPage(id) {
+function drawPage(id) {
var idx =0, i=0
for (const page of pages) {
var menu_link = document.getElementById('_ui_pglink_' + page.id)
@@ -324,25 +365,25 @@ function DrawPage(id) {
var page_content = document.getElementById("_ui_page_content");
var content = ''
for (const element of pages[idx].elements) {
- content = content + ElementHTML(element) + '\n'
+ content = content + elementHTML(element) + '\n'
}
page_content.innerHTML = content
window.location.hash = id
}
-function DrawNavigator(project, pages) {
+function drawNavigator(project, pages) {
var menu = document.getElementById('_ui_menu_list');
var list = ''
for (const page of pages) {
list = list + '