-
Notifications
You must be signed in to change notification settings - Fork 0
/
cheatsheet.js
98 lines (76 loc) · 2.25 KB
/
cheatsheet.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
function dropDown() {
var y= document.getElementById('v');
var x= document.getElementById('version');
var arrow=document.getElementById('downarrow');
// body...
if (x.style.display==="none") {
x.style.display="block";
}
else{
x.style.display="none";
}
if (x.style.display==="block") {
y.style.color="#8893c9";
arrow.style.color="#8893c9";
}
else if (x.style.display==="none"){
y.style.color="#767680";
arrow.style.color="#9A98AB";
}
}
function hide(){
var arrow=document.getElementById('downarrow');
var x= document.getElementById('version');
var y= document.getElementById('v');
x.style.display="none";
y.style.color="#767680";
arrow.style.color="#9A98AB";
}
function displayMenu(e)
{
if(menu.style.display==="block")
{
menu.style.display="none";
e.target.setAttribute("class","fa fa-bars");
var x=e.target.getAttribute('class');
console.log(x);
}
else{
menu.style.display="block";
e.target.setAttribute("class","fa fa-times");
}
}
function newA(jsonA)
{
var myLink = jsonA["myA"];
for (var i = 0; i < myLink.length; i++) {
var li = document.createElement('li');
ul.appendChild(li);
var a = document.createElement('a');
a.href = myLink[i].url;
a.textContent = myLink[i].name;
a.target = "_blank";
a.style.color = myLink[i].color;
a.setAttribute('id',('link'+i));
li.appendChild(a);
a.onmouseover = function(e)
{
e = e || window.event;
var linkID = e.target.getAttribute('id');
//console.log(linkAttr);
var index = linkID.slice(-1);
e.target.style.backgroundColor = myLink[index].color;
e.target.style.borderColor = myLink[index].color;
e.target.style.color = "white";
}
a.onmouseout = function(e)
{
e = e || window.event;
var linkID = e.target.getAttribute('id');
//console.log(linkAttr);
var index = linkID.slice(-1);
e.target.style.backgroundColor = "#FCFDFF";
e.target.style.color = myLink[index].color;
}
}
}