-
Notifications
You must be signed in to change notification settings - Fork 0
/
entry.js
37 lines (37 loc) · 1.14 KB
/
entry.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
function toggle(expandable) {
var expParent = expandable.parentNode;
var img = expParent.querySelector('img');
if (img !== null) {
if (img.addEventListener) {
img.addEventListener('click', function(event) {
event.stopPropagation();
});
} else {
img.attachEvent('onclick', function(event) {
event.cancelBubble = false;
});
}
}
var target = expParent.querySelector('.content');
if (target !== null) {
if (target.addEventListener) {
target.addEventListener('click', function(event) {
event.stopPropagation();
});
} else {
target.attachEvent('onclick', function(event) {
event.cancelBubble = false;
});
}
}
var arrow = expParent.querySelector('span.arrow');
if (arrow !== null) {
if (target.style.display == 'block') {
target.style.display = 'none';
arrow.innerHTML = '\u25BA';
} else {
target.style.display = 'block';
arrow.innerHTML = '\u25BC';
}
}
}