-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
78 lines (78 loc) · 3.07 KB
/
index.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
function fmtDate(param) {
return param < 10 ? "0" + param : param;
}
function setData(obj) {
for (var p in obj) {
document.getElementById(p).innerHTML = obj[p];
}
}
function stabtnClick() {
// $("#log1")[0].style.color = "#EBF6F7";
// $("#log2")[0].style.color = "#EBF6F7"; $("#log3")[0].style.color = "#EBF6F7";
// $("#log1_5")[0].style.color = "#C7DC68"; $("#log2_5")[0].style.color = "#C7DC68"
// $("#log3_5")[0].style.color = "#C7DC68"
// $("#enjoy")[0].style.color = "#38A1DB";
$("#game-status")[0].className = "l1";
$("#stabtn")[0].disabled = true;
$("#stabtn")[0].disabled = true;
setData({ "game-status": "Lauching", "cwinfo": "Please Wait" });
setTimeout(function () { setData({ "stabtn": " - " }); }, 100);
setTimeout(function () { setData({ "stabtn": " <-> " }); }, 200);
setTimeout(function () { setData({ "stabtn": " <---> " }); }, 300);
setTimeout(function () { setData({ "stabtn": " <-----> " }); }, 400);
setTimeout(function () { setData({ "stabtn": " <-------> " }); }, 500);
setTimeout(function () { setData({ "stabtn": " <---------> " }); }, 600);
setTimeout(function () { setData({ "stabtn": "<----------->" }); }, 700);
setTimeout(function () { setData({ "stabtn": "<- LOADING ->" }); }, 800);
setTimeout(function () {
window.location.href = "./pages/game/game.html";
}, 1500);
}
function cwinfoClick() {
$("#stabtn")[0].disabled = true;
$("#stabtn")[0].disabled = true;
setData({ "stabtn": "Please Wait" });
setTimeout(function () { setData({ "cwinfo": "< >" }); }, 100);
setTimeout(function () { setData({ "cwinfo": "<< >>" }); }, 200);
setTimeout(function () { setData({ "cwinfo": "<<< >>>" }); }, 300);
setTimeout(function () { setData({ "cwinfo": "<<<< >>>>" }); }, 400);
setTimeout(function () { setData({ "cwinfo": "<<<<< >>>>>" }); }, 500);
setTimeout(function () { setData({ "cwinfo": "<<<<<< >>>>>>" }); }, 600);
setTimeout(function () {
window.location.href = "./pages/cwinfo/cwinfo.html";
}, 1000);
}
setInterval(function () {
var d = new Date();
setData({
"hh": fmtDate(d.getHours()),
"mm": fmtDate(d.getMinutes()),
"ss": fmtDate(d.getSeconds()),
"MM": fmtDate(d.getMonth() + 1),
"DD": fmtDate(d.getDate()),
"YYYY": fmtDate(d.getFullYear())
});
}, 1000);
$(preloadPatternLib);
var [pattern_loaded, stage_loaded] = [false, false];
function release() {
if (pattern_loaded && stage_loaded) {
$("#stabtn")[0].disabled = false;
}
}
function preloadPatternLib() {
$.ajax("/js/lifegame/patternLib.json", {
dataType: "text"
}).done((data) => {
sessionStorage.setItem("patternLib", data);
pattern_loaded = true;
release();
});
$.ajax("/js/lifegame/stageLib.json", {
dataType: "text"
}).done((data) => {
sessionStorage.setItem("stageLib", data);
stage_loaded = true;
release();
});
}