-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSlitherlinkUIFlow.js
64 lines (54 loc) · 1.58 KB
/
SlitherlinkUIFlow.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
$(document).ready(setupFlow);
function setupFlow() {
$("#BoardDimensions").hide();
$("#SavedBoard").hide();
$("#EditBoard").hide();
$("#BoardCanvas").hide();
$("#GetBoard").hide();
$("#SolveButtons").hide();
$("#SaveBoardArea").hide();
$("#EnterNewBoard").click(showNewBoardInput);
$("#GoToEnterSavedBoard").click(showSavedBoardInput);
$("#NewBoardBack").click(showBoardInputOptions);
$("#SavedBoardBack").click(showBoardInputOptions);
$("#EnterBoardDimensions").click(editBoard);
$("#EnterSavedBoard").click(editBoard);
$("#EditBoardBack").click(showBoardInputOptions);
$("#EditBoardOK").click(startSolving);
$("#EditBoardButton").click(editBoard);
$("#SaveBoard").click(showSaveBoardSetup);
$("#DoneSaving").click(startSolving);
}
function showBoardInputOptions() {
$("#BoardDimensions").hide();
$("#SavedBoard").hide();
$("#EditBoard").hide();
$("#BoardCanvas").hide();
$("#EnterBoardOptions").show();
}
function showNewBoardInput() {
$("#BoardDimensions").show();
$("#EnterBoardOptions").hide();
}
function showSavedBoardInput() {
$("#SavedBoard").show();
$("#EnterBoardOptions").hide();
}
function editBoard() {
$("#BoardDimensions").hide();
$("#SavedBoard").hide();
$("#SolveButtons").hide();
$("#BoardCanvas").show();
$("#EditBoard").show();
}
function startSolving() {
$("#EditBoard").hide();
$("#SaveBoardArea").hide();
var boardWidth = document.getElementById("BoardCanvas").width;
$("#StepAndSolve").width(Math.max(150, boardWidth - 181));
$("#SolveButtons").show();
}
function showSaveBoardSetup() {
$("#SolveButtons").hide();
$("#SaveBoardArea").show();
}