forked from svn2github/AniDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanidbscript-hint2.js
71 lines (67 loc) · 2.21 KB
/
anidbscript-hint2.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
jsVersionArray.push({
"file":"anidbscript-hint2.js",
"version":"1.0",
"revision":"$Revision$",
"date":"$Date:: $",
"author":"$Author$",
"changelog":"Initial version"
});
function InitHint2()
{
if(document.getElementById && document.getElementsByTagName) // && CSS works, really
{
var basediv = document.getElementById("Base");
var root = document.createElement('div');
root.className = "hint2_jscontrols";
basediv.insertBefore(root, basediv.firstChild);
var tag = root.appendChild(document.createElement('h4'));
tag.appendChild(document.createTextNode('Advanced Options'));
var list = root.appendChild(document.createElement('ul'));
var taglist = document.getElementsByTagName('div');
for (var i = 0; i < taglist.length; i++)
{
if (taglist[i].className == "collapsible")
{
tag = list.appendChild(document.createElement('li'));
tag = tag.appendChild(document.createElement('a'));
tag.onclick = UnCollapseOption;
tag.title = taglist[i].id;
tag.appendChild(document.createTextNode("Show "+tag.title+" Options"));
taglist[i].className = "collapse";
}
}
tag = list.appendChild(document.createElement('li'));
tag = tag.appendChild(document.createElement('a'));
tag.onclick = CollapseNotes;
tag.title = "Descriptions";
tag.appendChild(document.createTextNode('Hide '+tag.title));
basediv.className += " jason";
}
InitDefault();
}
function CollapseOption()
{
document.getElementById(this.title).className = "collapse";
this.firstChild.nodeValue = "Show " + this.title + " Options";
this.onclick = UnCollapseOption;
}
function UnCollapseOption()
{
document.getElementById(this.title).className = "collapsible";
this.firstChild.nodeValue = "Hide " + this.title + " Options";
this.onclick = CollapseOption;
}
function CollapseNotes()
{
document.getElementById("Base").className += " nonote";
this.firstChild.nodeValue = "Show " + this.title;
this.onclick = UnCollapseNotes;
}
function UnCollapseNotes()
{
document.getElementById("Base").className = document.getElementById("Base").className.replace(/ nonote|nonote/i, "");
this.firstChild.nodeValue = "Hide " + this.title;
this.onclick = CollapseNotes;
}
//window.onload = InitHint2;
addLoadEvent(InitHint2);