-
Notifications
You must be signed in to change notification settings - Fork 0
/
displaykeychain.js
144 lines (141 loc) · 3.96 KB
/
displaykeychain.js
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
function displayKeyChain()
{
$("#keychain").empty();
var header = document.createElement("div");
$(header).css("text-align", "center");
$(header).html("Nøglebundt");
$("#keychain").append(header);
var left = document.createElement("div");
$(left).addClass("lefttop");
$(left).html("Dør");
$("#keychain").append(left);
var right = document.createElement("div");
$(right).addClass("righttop");
$(right).html("Tænd/slukket")
$("#keychain").append(right);
var show = false;
$.each(doorsWork, function(i)
{
var left = document.createElement("div");
$(left).addClass("left");
$(left).css("clear", "both");
$(left).html(doorsWork[i].name);
$("#keychain").append(left);
var right = document.createElement("div");
$(right).attr("name", doorsWork[i].name);
$(right).addClass("onoff");
$(right).css("position", "relative");
$(right).css("left", "-55px");
$(right).addClass("right");
$(right).addClass("hand");
$(right).addClass("workSwitch");
$(right).attr("type", "work");
if (doorsWork[i].locked)
{
$(right).html("Åben");
$(right).css("background-color", "green");
$(right).css("text-align", "left");
}
else
{
$(right).html("Låst");
$(right).css("background-color", "red");
$(right).css("text-align", "center");
}
$("#keychain").append(right);
var button = document.createElement("button");
$(button).html("Slet");
$(button).css("float", "right");
$(button).css("position", "relative");
$(button).css("left", "68px");
$(button).css("top", "6px");
$(button).addClass("remove");
$(button).attr("type", "work");
$(button).attr("name", doorsWork[i].name);
$("#keychain").append(button);
});
var show = false;
$.each(doorsHome, function(i)
{
var left = document.createElement("div");
$(left).addClass("left");
$(left).css("clear", "both");
$(left).html(doorsHome[i].name);
$("#keychain").append(left);
var right = document.createElement("div");
$(right).attr("name", doorsHome[i].name);
$(right).css("position", "relative");
$(right).css("left", "-55px");
$(right).addClass("onoff");
$(right).addClass("right");
$(right).addClass("hand");
$(right).addClass("homeSwitch");
$(right).attr("type", "home");
if (doorsHome[i].locked)
{
$(right).html("Åben");
$(right).css("background-color", "green");
$(right).css("text-align", "left");
}
else
{
$(right).html("Låst");
$(right).css("background-color", "red");
$(right).css("text-align", "center");
}
$("#keychain").append(right);
var button = document.createElement("button");
$(button).html("Slet");
$(button).css("float", "right");
$(button).css("position", "relative");
$(button).css("left", "68px");
$(button).css("top", "6px");
$(button).addClass("remove");
$(button).attr("type", "home");
$(button).attr("name", doorsHome[i].name);
$("#keychain").append(button);
});
var show = false;
$.each(doorsFree, function(i)
{
var left = document.createElement("div");
$(left).addClass("left");
$(left).css("clear", "both");
$(left).html(doorsFree[i].name);
$("#keychain").append(left);
var right = document.createElement("div");
$(right).attr("name", doorsFree[i].name);
$(right).addClass("onoff");
$(right).addClass("right");
$(right).css("position", "relative");
$(right).css("left", "-55px");
$(right).addClass("hand");
$(right).addClass("freeSwitch");
$(right).attr("type", "free");
if (doorsFree[i].locked)
{
$(right).html("Åben");
$(right).css("background-color", "green");
$(right).css("text-align", "left");
}
else
{
$(right).html("Låst");
$(right).css("background-color", "red");
$(right).css("text-align", "center");
}
$("#keychain").append(right);
var button = document.createElement("button");
$(button).html("Slet");
$(button).css("float", "right");
$(button).css("position", "relative");
$(button).css("left", "68px");
$(button).css("top", "6px");
$(button).addClass("remove");
$(button).attr("type", "free");
$(button).attr("name", doorsFree[i].name);
$("#keychain").append(button);
});
turnonoff();
addRemoveBind();
}