forked from jp112sdl/SonoffHMLOX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs_wm.h
60 lines (54 loc) · 1.77 KB
/
js_wm.h
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
const char HTTP_SCRIPT[] PROGMEM = R"=====(
<script>
function c(l) {
document.getElementById('s').value = l.innerText || l.textContent; document.getElementById('p').focus();
}
function setBackendType() {
var backendtype = document.getElementById('backendtype');
var ccu = document.getElementById('ccu');
var qsa = document.querySelectorAll('[id^=div_]');
qsa.forEach(function(e) {
e.style.display = 'block';
});
qsa = document.querySelectorAll('[id$=_pow]');
qsa.forEach(function(e) {
e.style.display = 'block';
});
qsa = document.querySelectorAll('[id$=_switch]');
qsa.forEach(function(e) {
e.style.display = 'block';
});
if (backendtype) {
var flt;
switch (parseInt(backendtype.value)) {
case 0:
flt = 'lox';
if (ccu) ccu.placeholder = 'IP der CCU2';
break;
case 1:
flt = 'hm';
if (ccu) ccu.placeholder = 'IP:Port des LOXONE Miniservers';
break;
}
qsa = document.querySelectorAll('[id^=div_' + flt + ']');
qsa.forEach(function(e) { e.style.display = 'none'; });
}
if (sonoffmodel) {
switch (parseInt(sonoffmodel.value)) {
case 0:
qsa = document.querySelectorAll('[id$=_pow]');
qsa.forEach(function(e) { e.style.display = 'none'; });
break;
case 1:
qsa = document.querySelectorAll('[id$=_switch]');
qsa.forEach(function(e) { e.style.display = 'none'; });
break;
case 2:
qsa = document.querySelectorAll('[id$=_pow]');
qsa.forEach(function(e) { e.style.display = 'none'; });
break;
}
}
}
</script>
)=====";