-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththeme.js
More file actions
86 lines (77 loc) · 2.4 KB
/
theme.js
File metadata and controls
86 lines (77 loc) · 2.4 KB
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
function mainTheme() {
window.localStorage['lastConnect'] = new Date().getTime();
initMap();
initHelp();
initPopup();
initJoinus();
window.onresize = resizeAll;
}
function resizeAll(){
initMap();
initHelp();
}
function initJoinus(){
var elJoin = document.getElementById("popupJoinus");
var elEmail = document.getElementById("joinEmail");
var elEmailConfirm = document.getElementById("joinEmailConfirm");
var elPasswdConfirm = document.getElementById("joinPasswdConfirm");
elEmail.onblur = joinEmailCheck;
elEmailConfirm.onblur = joinEmailConfirm;
elPasswdConfirm.onblur = joinPasswdConfirm;
}
function mainUser(){
window.localStorage['lastConnect'] = new Date().getTime();
initMap();
initHelp();
initPopup();
window.onresize = initMap;
}
function resizeCanvas(){
var canvas = document.getElementById("canvas");
var mapBody = document.getElementById("body");
var canvasWidth = mapBody.clientWidth;
var canvasHeight = mapBody.clientHeight;
canvas.setAttribute("width", canvasWidth);
canvas.setAttribute("height", canvasHeight);
}
function initMap() {
// body postion
var menu = document.getElementById("menu");
var body = document.getElementById("body");
body.style.height = window.innerHeight - menu.clientHeight - 14;
initCanvas(0);
}
function initHelp(){
// help position
var help = document.getElementById("help");
help.style.left = window.innerWidth - help.clientWidth - 30;
help.style.top = menu.clientHeight + 20;
if( window.localStorage['helpOpen'] != "true" )
helpToggle();
}
function initPopup(){
var elPopupLoad = document.getElementById("popupLoad");
if( elPopupLoad ){
console.log("load box exist");
popupPosisionCenter(elPopupLoad);
}
var elJoinus = document.getElementById("popupJoinus");
if( elJoinus ){
console.log("joinus box exist");
popupPosisionCenter(elJoinus);
}
}
function helpToggle(){
var help = document.getElementById("help");
if( help.style.display == "block" || help.style.display == "" ){
help.style.display = "none";
window.localStorage['helpOpen'] = false;
}
else{
help.style.display = "block";
window.localStorage['helpOpen'] = true;
}
}
function popupPosisionCenter(elPopup){
elPopup.style.left = (document.body.clientWidth - elPopup.clientWidth)/2;
}