-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript.js
More file actions
40 lines (35 loc) · 1.05 KB
/
javascript.js
File metadata and controls
40 lines (35 loc) · 1.05 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
function initialize_webiopi() {
// webiopiの準備が終わってからstyles.cssを適用する
applyCustomCss("styles.css");
// GPIOの状態を監視しない
webiopi().refreshGPIO(false);
}
function clickEvent() {
var execDate = document.myform.execTime.value;
if (execDate == "") {
webiopi().callMacro("clearCron", []);
} else {
webiopi().callMacro("updateCron", [execDate]);
}
}
function applyCustomCss(custom_css) {
var head = document.getElementsByTagName("head")[0];
var style = document.createElement("link");
style.rel = "stylesheet";
style.type = "text/css";
style.href = custom_css;
head.appendChild(style);
}
function setDefault() {
var getDefault = function(macro, args, response) {
if (response) {
document.getElementById("execTime").value = response;
} else {
document.getElementById("execTime").value = "";
}
};
webiopi().callMacro("getCurrentSetting", [], getDefault);
}
window.onload = function() {
setDefault();
};