MarkTheArtist commited on
Commit
2915072
·
verified ·
1 Parent(s): 54f38c3

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +321 -0
index.html CHANGED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>Interactive 3x3 Tile Tool</title>
7
+ <style>
8
+ body {
9
+ margin: 0;
10
+ padding: 22px;
11
+ background: #eee4cf;
12
+ font-family: Arial, Helvetica, sans-serif;
13
+ color: #222;
14
+ }
15
+ h1 { margin: 0 0 8px 0; }
16
+ .notice {
17
+ padding: 12px;
18
+ margin: 12px 0 18px 0;
19
+ border-radius: 10px;
20
+ border: 3px solid #9b2f2f;
21
+ background: #ffe7e7;
22
+ font-weight: bold;
23
+ }
24
+ .notice.ok {
25
+ border-color: #276c35;
26
+ background: #e5f6e8;
27
+ }
28
+ .layout {
29
+ display: flex;
30
+ flex-wrap: wrap;
31
+ gap: 22px;
32
+ align-items: flex-start;
33
+ }
34
+ .panel {
35
+ background: white;
36
+ border: 3px solid #aa9568;
37
+ border-radius: 14px;
38
+ padding: 18px;
39
+ box-shadow: 0 8px 18px rgba(0,0,0,.08);
40
+ }
41
+ #grid {
42
+ display: grid;
43
+ grid-template-columns: repeat(3, 150px);
44
+ grid-template-rows: repeat(3, 150px);
45
+ gap: 12px;
46
+ background: #b69d6a;
47
+ border: 6px solid #302614;
48
+ padding: 12px;
49
+ max-width: 100%;
50
+ overflow: auto;
51
+ }
52
+ .cell {
53
+ position: relative;
54
+ width: 150px;
55
+ height: 150px;
56
+ background: #fff8e8;
57
+ border: 4px solid #453720;
58
+ box-sizing: border-box;
59
+ cursor: pointer;
60
+ }
61
+ .cell.selected {
62
+ outline: 8px solid #ffcc33;
63
+ outline-offset: -10px;
64
+ }
65
+ .num {
66
+ position: absolute;
67
+ top: 6px;
68
+ left: 8px;
69
+ font-weight: bold;
70
+ color: #7e6c49;
71
+ z-index: 5;
72
+ }
73
+ .tile {
74
+ position: absolute;
75
+ left: 18px;
76
+ top: 18px;
77
+ width: 114px;
78
+ height: 114px;
79
+ transform-origin: 57px 57px;
80
+ }
81
+ .square-outline {
82
+ position: absolute;
83
+ left: 0;
84
+ top: 0;
85
+ width: 102px;
86
+ height: 102px;
87
+ border: 6px solid black;
88
+ }
89
+ .bar {
90
+ position: absolute;
91
+ left: 6px;
92
+ top: 50px;
93
+ width: 102px;
94
+ height: 14px;
95
+ background: black;
96
+ }
97
+ .elbow-v {
98
+ position: absolute;
99
+ left: 50px;
100
+ top: 0;
101
+ width: 14px;
102
+ height: 57px;
103
+ background: black;
104
+ }
105
+ .elbow-h {
106
+ position: absolute;
107
+ left: 57px;
108
+ top: 50px;
109
+ width: 57px;
110
+ height: 14px;
111
+ background: black;
112
+ }
113
+ .controls {
114
+ width: 330px;
115
+ max-width: 100%;
116
+ }
117
+ .group {
118
+ border-bottom: 1px solid #dccba5;
119
+ padding-bottom: 16px;
120
+ margin-bottom: 18px;
121
+ }
122
+ .group:last-child { border-bottom: none; }
123
+ button {
124
+ margin: 5px;
125
+ padding: 11px 13px;
126
+ border: 2px solid #6f5b35;
127
+ border-radius: 8px;
128
+ background: #fff8e8;
129
+ font-weight: bold;
130
+ cursor: pointer;
131
+ font-size: 15px;
132
+ }
133
+ button:hover { background: #ead6aa; }
134
+ button.active { background: #ffcc33; }
135
+ #status {
136
+ background: #fff8e8;
137
+ border: 2px solid #d2bd8d;
138
+ border-radius: 8px;
139
+ padding: 10px;
140
+ line-height: 1.45;
141
+ }
142
+ textarea {
143
+ width: 100%;
144
+ height: 135px;
145
+ font-family: monospace;
146
+ font-size: 12px;
147
+ box-sizing: border-box;
148
+ }
149
+ @media (max-width: 650px) {
150
+ #grid {
151
+ grid-template-columns: repeat(3, 90px);
152
+ grid-template-rows: repeat(3, 90px);
153
+ gap: 8px;
154
+ padding: 8px;
155
+ }
156
+ .cell {
157
+ width: 90px;
158
+ height: 90px;
159
+ }
160
+ .tile {
161
+ left: 10px;
162
+ top: 10px;
163
+ width: 70px;
164
+ height: 70px;
165
+ transform-origin: 35px 35px;
166
+ }
167
+ .square-outline {
168
+ width: 62px;
169
+ height: 62px;
170
+ border-width: 4px;
171
+ }
172
+ .bar {
173
+ left: 4px;
174
+ top: 33px;
175
+ width: 62px;
176
+ height: 7px;
177
+ }
178
+ .elbow-v {
179
+ left: 33px;
180
+ top: 0;
181
+ width: 7px;
182
+ height: 35px;
183
+ }
184
+ .elbow-h {
185
+ left: 35px;
186
+ top: 33px;
187
+ width: 35px;
188
+ height: 7px;
189
+ }
190
+ }
191
+ </style>
192
+ </head>
193
+ <body>
194
+
195
+ <h1>Interactive 3×3 Tile Tool</h1>
196
+
197
+ <div id="jsCheck" class="notice">
198
+ JavaScript is NOT running yet. If this message stays here, the file is being opened in a preview mode that blocks interaction.
199
+ </div>
200
+
201
+ <div class="layout">
202
+ <div class="panel">
203
+ <div id="grid"></div>
204
+ </div>
205
+
206
+ <div class="panel controls">
207
+ <div class="group">
208
+ <h2>Selected tile</h2>
209
+ <div id="status">Waiting for JavaScript...</div>
210
+ </div>
211
+
212
+ <div class="group">
213
+ <h2>Design</h2>
214
+ <button id="designA" type="button">Design A</button>
215
+ <button id="designB" type="button">Design B</button>
216
+ </div>
217
+
218
+ <div class="group">
219
+ <h2>Orientation</h2>
220
+ <button class="rot" data-rot="0" type="button">0°</button>
221
+ <button class="rot" data-rot="90" type="button">90°</button>
222
+ <button class="rot" data-rot="180" type="button">180°</button>
223
+ <button class="rot" data-rot="270" type="button">270°</button>
224
+ <br>
225
+ <button id="turn" type="button">Rotate selected 90°</button>
226
+ </div>
227
+
228
+ <div class="group">
229
+ <h2>Layout data</h2>
230
+ <textarea id="dataBox"></textarea>
231
+ <button id="selectData" type="button">Select data</button>
232
+ <button id="reset" type="button">Reset</button>
233
+ </div>
234
+ </div>
235
+ </div>
236
+
237
+ <script>
238
+ (function () {
239
+ var selected = 0;
240
+ var cells = [
241
+ {design:"A", rot:0}, {design:"B", rot:90}, {design:"A", rot:90},
242
+ {design:"B", rot:0}, {design:"A", rot:0}, {design:"B", rot:180},
243
+ {design:"A", rot:90}, {design:"B", rot:270}, {design:"A", rot:0}
244
+ ];
245
+ var jsCheck = document.getElementById("jsCheck");
246
+ jsCheck.className = "notice ok";
247
+ jsCheck.textContent = "JavaScript is working. You can click cells and change the design or rotation.";
248
+ function makeTile(cell) {
249
+ var design = '<div class="square-outline"></div>';
250
+ if (cell.design === "A") {
251
+ design += '<div class="bar"></div>';
252
+ } else {
253
+ design += '<div class="elbow-v"></div><div class="elbow-h"></div>';
254
+ }
255
+ return '<div class="tile" style="transform: rotate(' + cell.rot + 'deg)">' + design + '</div>';
256
+ }
257
+ function render() {
258
+ var grid = document.getElementById("grid");
259
+ grid.innerHTML = "";
260
+ for (var i = 0; i < 9; i++) {
261
+ var div = document.createElement("div");
262
+ div.className = "cell" + (i === selected ? " selected" : "");
263
+ div.setAttribute("data-index", i);
264
+ div.innerHTML = '<div class="num">' + (i + 1) + '</div>' + makeTile(cells[i]);
265
+ div.addEventListener("click", function () {
266
+ selected = Number(this.getAttribute("data-index"));
267
+ render();
268
+ });
269
+ grid.appendChild(div);
270
+ }
271
+ var current = cells[selected];
272
+ document.getElementById("status").innerHTML =
273
+ "Cell " + (selected + 1) + "<br>Design " + current.design + "<br>Rotation " + current.rot + "°";
274
+ document.getElementById("designA").className = current.design === "A" ? "active" : "";
275
+ document.getElementById("designB").className = current.design === "B" ? "active" : "";
276
+ var rotButtons = document.querySelectorAll(".rot");
277
+ for (var r = 0; r < rotButtons.length; r++) {
278
+ var val = Number(rotButtons[r].getAttribute("data-rot"));
279
+ rotButtons[r].className = "rot" + (val === current.rot ? " active" : "");
280
+ }
281
+ document.getElementById("dataBox").value = JSON.stringify(cells, null, 2);
282
+ }
283
+ document.getElementById("designA").addEventListener("click", function () {
284
+ cells[selected].design = "A";
285
+ render();
286
+ });
287
+ document.getElementById("designB").addEventListener("click", function () {
288
+ cells[selected].design = "B";
289
+ render();
290
+ });
291
+ var rotButtons = document.querySelectorAll(".rot");
292
+ for (var r = 0; r < rotButtons.length; r++) {
293
+ rotButtons[r].addEventListener("click", function () {
294
+ cells[selected].rot = Number(this.getAttribute("data-rot"));
295
+ render();
296
+ });
297
+ }
298
+ document.getElementById("turn").addEventListener("click", function () {
299
+ cells[selected].rot = (cells[selected].rot + 90) % 360;
300
+ render();
301
+ });
302
+ document.getElementById("selectData").addEventListener("click", function () {
303
+ var box = document.getElementById("dataBox");
304
+ box.focus();
305
+ box.select();
306
+ });
307
+ document.getElementById("reset").addEventListener("click", function () {
308
+ cells = [
309
+ {design:"A", rot:0}, {design:"B", rot:90}, {design:"A", rot:90},
310
+ {design:"B", rot:0}, {design:"A", rot:0}, {design:"B", rot:180},
311
+ {design:"A", rot:90}, {design:"B", rot:270}, {design:"A", rot:0}
312
+ ];
313
+ selected = 0;
314
+ render();
315
+ });
316
+ render();
317
+ })();
318
+ </script>
319
+
320
+ </body>
321
+ </html>