forked from johreh/gloomycompanion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.js
61 lines (49 loc) · 1.39 KB
/
ui.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
function activate_tab(tabs, pages, activetab)
{
for (key in tabs)
{
tabs[key].className = (key == activetab) ? "" : "inactive";
}
for (key in pages)
{
pages[key].className = (key == activetab) ? "tabbody" : "inactive tabbody";
}
}
function show_settingspane(pane, cancelarea, show)
{
pane.className = show ? "pane" : "pane inactive";
cancelarea.style.display = show ? "initial" : "none";
}
function init_ui()
{
var tabs =
{
scenarios: document.getElementById("scenariotab"),
decks: document.getElementById("deckstab")
};
var pages =
{
scenarios: document.getElementById("scenariospage"),
decks: document.getElementById("deckspage")
};
settingspane = document.getElementById("settingspane");
settingsbtn = document.getElementById("settingsbtn");
cancelarea = document.getElementById("cancelarea");
scenariotab.onclick = function(e)
{
activate_tab(tabs, pages, "scenarios");
}
deckstab.onclick = function(e)
{
activate_tab(tabs, pages, "decks");
}
settingsbtn.onclick = function(e)
{
show_settingspane(settingspane, cancelarea, true);
}
cancelarea.onclick = function(e)
{
show_settingspane(settingspane, cancelarea, false);
}
activate_tab(tabs, pages, "scenarios");
}