-
Notifications
You must be signed in to change notification settings - Fork 0
/
nonogram.html
executable file
·174 lines (167 loc) · 4.7 KB
/
nonogram.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nonogram solver</title>
<script src="runner.js"></script>
<script src="nonogram.js"></script>
<style>
input[type="number"] {
width: 50px;
}
td.g:nth-child(5n+1) {
border-right: 2px solid black;
}
tr:nth-child(5n+1) td.g {
border-bottom: 2px solid black;
}
.g {
height: 15px;
width: 15px;
border: 1px solid #CCC;
padding: 0;
line-height: 0;
}
#tb {
border-collapse: collapse;
}
.colH {
height: 140px;
vertical-align: bottom;
}
.colH div {
width: 140px;
transform: rotate(90deg) translate(-15px, 140px);
transform-origin: bottom right;
font-family: monospace;
text-align: right;
position: absolute;
}
.segment {
margin-left: 1ex;
}
.rowH {
height: 15px;
font-family: monospace;
text-align: right;
}
.rowH input, .colH input {
text-align: right;
height: 11px;
width: 138px;
padding: 0;
border: none;
border-bottom: 1px solid #888;
font-family: monospace;
}
@media screen and (max-device-width: 480px) and (orientation: portrait){
.g {
height: 11px;
width: 11px;
}
.colH {
height: 100px;
vertical-align: bottom;
}
.colH div {
width: 100px;
transform: rotate(90deg) translate(-15px, 100px);
}
.rowH {
height: 11px;
padding: 0;
line-height: 10px;
}
.rowH input, .colH input {
height: 9px;
width: 98px;
font-size: 9px;
}
.x {
-webkit-mask-position: -2px -2px;
}
}
th.hl {
background-color: #FD8;
}
span.dim {
color: #999;
}
span.hl {
color: #F35;
}
.set {background-color: #555;}
.g.c1 {background-color: black;}
.g.c2 {background-color: blue;}
.g.c3 {background-color: darkgreen;}
.g.c4 {background-color: #880;}
.g.c5 {background-color: #842;}
.g.c6 {background-color: darkred;}
.g.c7 {background-color: purple;}
.g.c8 {background-color: #0DF;}
.g.c9 {background-color: #DD0;}
.g.c10 {background-color: #E0E;}
.g.c11 {background-color: #3E8;}
.g.c12 {background-color: #E47;}
.g.c13 {background-color: #489;}
.g.c14 {background-color: #948;}
.x {
-webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M12.656 4.281L8.937 8l3.719 3.719-.938.938-3.719-3.719-3.719 3.719-.938-.938L7.061 8 3.342 4.281l.938-.938 3.719 3.719 3.719-3.719z"/></svg>')
}
.g.hl {
border: 1px solid red;
}
#controls {
margin-top: 5px;
}
#controls input[type="button"] {
background-color: #F8F8F8;
width: 35px;
height: 20px;
border-radius: 5px;
}
.play {
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M3 2l10 6-10 6z"/></svg>')
}
.pause {
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M2 2h5v12H2zm7 0h5v12H9z"/></svg>')
}
.arrow-right {
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M15.5 8L8 .5V5H0v6h8v4.5z"/></svg>')
}
.last {
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M14 2v12h-2V8.5l-5 5v-5l-5 5v-11l5 5v-5l5 5V2z"/></svg>')
}
.play, .pause, .arrow-right, .last {
background-repeat: no-repeat;
background-position: center;
}
</style>
</head>
<body>
<div id="step1">
1. <label>Dimension:</label>
<input id="dim-width" type="number" value="10"> ×
<input id="dim-height" type="number" value="10">
<input id="btn-clear" type="button" value="Create Empty Grid">
Or, <label>load
<select id="preset">
<option value="" >-- choose preset --</option>
</select>
</label>
</div>
<hr>
<div id="step2">
2. Fill-in row/column segments below, or draw on the grid.
</div>
<table id="tb">
</table>
<div id="controls">
<input id="btn-solve" type="button" class="play" title="play">
<input id="btn-next" type="button" class="arrow-right" title="next">
<input id="btn-runall" type="button" class="last" title="finish">
<label style="margin-left:20px">
Speed:<input id="delay" type="range" min="0" max="4" value="1" >
</label>
</div>
</body>