-
Notifications
You must be signed in to change notification settings - Fork 3
/
script.js
70 lines (64 loc) · 2.39 KB
/
script.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
//abre tooltip de cada elemento. Fecha os demais
function abre(event) {
var close = document.getElementsByClassName("hide");
var hide;
for (hide = 0; hide < close.length; hide++) {
close[hide].style.display = "none";
}
event.currentTarget.nextElementSibling.style.display = "inline";
event.currentTarget.nextElementSibling.setAttribute('aria-live', 'polite');
event.currentTarget.nextElementSibling.setAttribute('aria-atomic', 'true');
}
//Exibe CSS mais simples
function css(cssFile, cssLinkIndex) {
var horizontal = document.getElementsByTagName("link").item(cssLinkIndex);
var vertical = document.createElement("link");
vertical.setAttribute("rel", "stylesheet");
vertical.setAttribute("type", "text/css");
vertical.setAttribute("href", cssFile);
document.getElementsByTagName("head").item(0).replaceChild(vertical, horizontal);
}
//fecha todos os elementos com esc
document.onkeydown = function(e){
var close = document.getElementsByClassName("hide");
var hide;
if(e.keyCode === 27){
for (hide = 0; hide < close.length; hide++) {
close[hide].style.display = "none";
close[hide].setAttribute('aria-live', 'off');
close[hide].setAttribute('aria-atomic', 'false');
}
}
};
//fecha todos os elementos com clique
function fecha() {
var close = document.getElementsByClassName("hide");
var hide;
for (hide = 0; hide < close.length; hide++) {
close[hide].style.display = "none";
close[hide].setAttribute('aria-live', 'off');
}
}
//acao do checkbox para abrir os eventos relacionados ao tema
function show() {
var web = document.getElementsByClassName("web");
var internet = document.getElementsByClassName("internet");
var checkweb = document.getElementById("checkweb");
var checkint = document.getElementById("checkint");
var allweb;
for (allweb = 0; allweb < web.length; allweb++){
if (checkweb.checked == 1){
web[allweb].style.display = 'block';
}else{
web[allweb].style.display = 'none';
}
}
var allinternet;
for (allinternet = 0; allinternet < internet.length; allinternet++){
if (checkint.checked == 1){
internet[allinternet].style.display = 'block';
}else{
internet[allinternet].style.display = 'none';
}
}
}