forked from viresh-ratnakar/exolve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-customize-puzzle.html
120 lines (114 loc) · 2.57 KB
/
test-customize-puzzle.html
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" type="text/css" href="exolve-m.css?v0.91"/>
<script src="exolve-m.js?v0.91"></script>
<script>
function customizeExolve(p) {
let c = p.addCellText(0, 1, '@', 12, 10, true, false)
c = p.addCellText(0, 3, '①', 16, 14, true, true)
c.style.stroke = 'blue'
c = p.addCellText(1, 0, '*', 18, 10, false, true)
c = p.addCellText(1, 2, '%', 12, 8, false, false)
p.background.setAttributeNS(null, 'fill', 'red')
let expectedVars = [
'p.currRow',
'p.currCol',
'p.currClueIndex',
'p.gridInput',
'p.gridWidth',
'p.gridHeight',
'p.numCellsFilled',
'p.numCellsToFill',
'p.offsetLeft',
'p.offsetTop',
'p.svg',
'p.GRIDLINE',
'p.squareDim',
'p.circleR',
]
for (let v of expectedVars) {
eval('console.log("' + v + ' = " + ' + v + ')')
}
let expectedFunctions = [
'p.deactivateCurrCell',
'p.activateCell',
'p.advanceCursor',
'p.updateAndSaveState',
'p.updateDisplayAndGetState',
'p.showNinas',
'p.hideNinas',
'p.checkCurrent',
'p.checkAll',
'p.revealCurrent',
'p.revealAll',
'p.clearCurrent',
'p.clearAll',
]
for (let f of expectedFunctions) {
eval('console.log("func ' + f + ' = " + (' + f + '!= null))')
}
let expectedIds = [
'xlv1-clear',
'xlv1-clear-all',
'xlv1-check',
'xlv1-check-all',
'xlv1-reveal',
'xlv1-reveal-all',
'xlv1-setter-by',
'xlv1-squares-filled',
'xlv1-ninas',
'xlv1-submit',
'xlv1-across-label',
'xlv1-down-label',
'xlv1-saving',
]
for (let id of expectedIds) {
let elt = document.getElementById(id)
if (!elt) {
console.log('Could not find element for id: ' + id)
return
}
}
p.background.setAttributeNS(null, 'fill', 'green')
}
</script>
<title>Test-Customize-Puzzle</title>
</head>
<body>
<script>
createExolve(`
======REPLACE WITH YOUR PUZZLE BELOW======
exolve-begin
exolve-id: test-customize-puzzle
exolve-title: Test-Customize-Puzzle
exolve-setter: Viresh Ratnakar
exolve-copyright: 2020 Viresh Ratnakar
exolve-width: 5
exolve-height: 5
exolve-grid:
00000
0.0.0
00000
0.0.0
00000
exolve-prelude:
<center>
If grid does not turn green, examine js console for errors.
</center>
exolve-across:
1 TODO (5)
4 TODO (5)
5 TODO (5)
exolve-down:
1 TODO (5)
2 TODO (5)
3 TODO (5)
exolve-end
======REPLACE WITH YOUR PUZZLE ABOVE======
`);
</script>
</body>
</html>