-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclick.js
More file actions
288 lines (251 loc) · 9.5 KB
/
click.js
File metadata and controls
288 lines (251 loc) · 9.5 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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
/*
var network1 = document.getElementById("network-1");
var network2 = document.getElementById("network-2");
var network3 = document.getElementById("network-3");
var network4 = document.getElementById("network-4");
var network5 = document.getElementById("network-5");
network1.onclick = function() {
network1.setAttribute('style', 'Background-Color: #000000' );
network2.setAttribute('style', 'Background-Color: #FFFFFF' );
network3.setAttribute('style', 'Background-Color: #FFFFFF' );
network4.setAttribute('style', 'Background-Color: #FFFFFF' );
network5.setAttribute('style', 'Background-Color: #FFFFFF' );
}
network2.onclick = function() {
network1.setAttribute('style', 'Background-Color: #FFFFFF' );
network2.setAttribute('style', 'Background-Color: #000000' );
network3.setAttribute('style', 'Background-Color: #FFFFFF' );
network4.setAttribute('style', 'Background-Color: #FFFFFF' );
network5.setAttribute('style', 'Background-Color: #FFFFFF' );
}
network3.onclick = function() {
network1.setAttribute('style', 'Background-Color: #FFFFFF' );
network2.setAttribute('style', 'Background-Color: #FFFFFF' );
network3.setAttribute('style', 'Background-Color: #000000' );
network4.setAttribute('style', 'Background-Color: #FFFFFF' );
network5.setAttribute('style', 'Background-Color: #FFFFFF' );
}
network4.onclick = function() {
network1.setAttribute('style', 'Background-Color: #FFFFFF' );
network2.setAttribute('style', 'Background-Color: #FFFFFF' );
network3.setAttribute('style', 'Background-Color: #FFFFFF' );
network4.setAttribute('style', 'Background-Color: #000000' );
network5.setAttribute('style', 'Background-Color: #FFFFFF' );
}
network5.onclick = function() {
network1.setAttribute('style', 'Background-Color: #FFFFFF' );
network2.setAttribute('style', 'Background-Color: #FFFFFF' );
network3.setAttribute('style', 'Background-Color: #FFFFFF' );
network4.setAttribute('style', 'Background-Color: #FFFFFF' );
network5.setAttribute('style', 'Background-Color: #000000' );
}
*/
// Network
var networks = document.getElementsByClassName("network");
for(var i = 0; i < networks.length; ++i) {
networks[i].onclick = function(e) {
var target = (e || windows.event).target;
console.log("perfect");
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(networks[j] != target) {
networks[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}
// Internet
var internet = document.getElementsByClassName("internet");
for(var i = 0; i < internet.length; ++i) {
internet[i].onclick = function(e) {
var target = (e || windows.event).target;
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(internet[j] != target) {
internet[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}
// Networking Device
var device = document.getElementsByClassName("device");
for(var i = 0; i < device.length; ++i) {
device[i].onclick = function(e) {
var target = (e || windows.event).target;
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(device[j] != target) {
device[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}
// Protocol
var proto = document.getElementsByClassName("proto");
for(var i = 0; i < proto.length; ++i) {
proto[i].onclick = function(e) {
var target = (e || windows.event).target;
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(proto[j] != target) {
proto[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}
// OSI
var osi = document.getElementsByClassName("osi");
for(var i = 0; i < osi.length; ++i) {
osi[i].onclick = function(e) {
var target = (e || windows.event).target;
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(osi[j] != target) {
osi[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}
// TCP
var tcp = document.getElementsByClassName("tcp");
for(var i = 0; i < tcp.length; ++i) {
tcp[i].onclick = function(e) {
var target = (e || windows.event).target;
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(tcp[j] != target) {
tcp[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}
// Encap
var encap = document.getElementsByClassName("encap");
for(var i = 0; i < encap.length; ++i) {
encap[i].onclick = function(e) {
var target = (e || windows.event).target;
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(encap[j] != target) {
encap[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}
// De-encap
var decap = document.getElementsByClassName("decap");
for(var i = 0; i < decap.length; ++i) {
decap[i].onclick = function(e) {
var target = (e || windows.event).target;
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(decap[j] != target) {
decap[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}
// PDU
var pdu = document.getElementsByClassName("pdu");
for(var i = 0; i < pdu.length; ++i) {
pdu[i].onclick = function(e) {
var target = (e || windows.event).target;
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(pdu[j] != target) {
pdu[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}
// Address
var address = document.getElementsByClassName("address");
for(var i = 0; i < address.length; ++i) {
address[i].onclick = function(e) {
var target = (e || windows.event).target;
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(address[j] != target) {
address[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}
// Mac Address
var mac = document.getElementsByClassName("mac");
for(var i = 0; i < mac.length; ++i) {
mac[i].onclick = function(e) {
var target = (e || windows.event).target;
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(mac[j] != target) {
mac[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}
// IP Address
var ip = document.getElementsByClassName("ip");
for(var i = 0; i < ip.length; ++i) {
ip[i].onclick = function(e) {
var target = (e || windows.event).target;
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(ip[j] != target) {
ip[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}
// Port Address
var port = document.getElementsByClassName("port");
for(var i = 0; i < port.length; ++i) {
port[i].onclick = function(e) {
var target = (e || windows.event).target;
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(port[j] != target) {
port[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}
// Routing
var route = document.getElementsByClassName("route");
for(var i = 0; i < route.length; ++i) {
route[i].onclick = function(e) {
var target = (e || windows.event).target;
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(route[j] != target) {
route[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}
// DNS
var dns = document.getElementsByClassName("dns");
for(var i = 0; i < dns.length; ++i) {
dns[i].onclick = function(e) {
var target = (e || windows.event).target;
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(dns[j] != target) {
dns[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}
// HTTPS
var http = document.getElementsByClassName("http");
for(var i = 0; i < http.length; ++i) {
http[i].onclick = function(e) {
var target = (e || windows.event).target;
target.setAttribute('style', 'Background-Color: #000000');
for( var j = 0; j < networks.length; ++j) {
if(http[j] != target) {
http[j].setAttribute('style', 'Background-Color: #FFFFFF');
}
}
}
}