-
Notifications
You must be signed in to change notification settings - Fork 15
/
test-state-based-display.html
85 lines (76 loc) · 1.87 KB
/
test-state-based-display.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
<!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?v1.58"/>
<script src="exolve-m.js?v1.58"></script>
<script>
function tweakDisplay(puz) {
for (let row = 0; row < puz.gridHeight; row++) {
for (let col = 0; col < puz.gridWidth; col++) {
const gridCell = puz.grid[row][col];
if (!gridCell.isLight) continue;
/* Add an overlay rectangle for colouring, it it doesn't exist */
let cellColour = 'transparent';
if (!gridCell.overlay) {
gridCell.overlay = puz.makeCellDiv(row, col, cellColour, 1);
puz.gridParent.appendChild(gridCell.overlay);
}
if (gridCell.currLetter == 'X') {
cellColour = 'blue';
} else if (gridCell.currLetter == 'Y') {
cellColour = 'green';
}
gridCell.overlay.style.backgroundColor = cellColour;
}
}
}
function customizeExolve(puz) {
puz.updateDisplayAndGetState = (function() {
var origHandler = puz.updateDisplayAndGetState;
return function() {
const ret = origHandler.apply(this);
tweakDisplay(this);
return ret
};
})();
tweakDisplay(puz);
}
</script>
<title>Test-State-Based-Display</title>
</head>
<body>
<script>
createExolve(`
======REPLACE WITH YOUR PUZZLE BELOW======
exolve-begin
exolve-title: Test-State-Based-Display
exolve-setter: Viresh Ratnakar
exolve-width: 5
exolve-height: 5
exolve-grid:
00000
0.0.0
00000
0.0.0
00000
exolve-prelude:
<center>
Typing X in any cell will turn it blue.
Typing Y in any cell will turn it green.
</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>