Spaces:
Running
Running
Download index.html from MarkTheArtist/TileVisualizer: direct link, hf CLI and curl.
- Browser
- Download file 9.52 kB
-
https://huggingface.co/spaces/MarkTheArtist/TileVisualizer/resolve/main/index.html
- Command line
-
hf download hf://spaces/MarkTheArtist/TileVisualizer/index.html
-
curl -L -o index.html https://huggingface.co/spaces/MarkTheArtist/TileVisualizer/resolve/main/index.html
9.52 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Interactive 4x4 Tile Tool</title> | |
| <style> | |
| body { | |
| margin: 0; | |
| padding: 22px; | |
| background: #eee4cf; | |
| font-family: Arial, Helvetica, sans-serif; | |
| color: #222; | |
| } | |
| h1 { margin: 0 0 8px 0; } | |
| .notice { | |
| padding: 12px; | |
| margin: 12px 0 18px 0; | |
| border-radius: 10px; | |
| border: 3px solid #9b2f2f; | |
| background: #ffe7e7; | |
| font-weight: bold; | |
| } | |
| .notice.ok { | |
| border-color: #276c35; | |
| background: #e5f6e8; | |
| } | |
| .layout { | |
| display: flex; | |
| flex-wrap: wrap; | |
| gap: 22px; | |
| align-items: flex-start; | |
| } | |
| .panel { | |
| background: white; | |
| border: 3px solid #aa9568; | |
| border-radius: 14px; | |
| padding: 18px; | |
| box-shadow: 0 8px 18px rgba(0,0,0,.08); | |
| } | |
| #grid { | |
| display: grid; | |
| grid-template-columns: repeat(4, 120px); | |
| grid-template-rows: repeat(4, 120px); | |
| gap: 10px; | |
| background: #b69d6a; | |
| border: 6px solid #302614; | |
| padding: 12px; | |
| max-width: 100%; | |
| overflow: auto; | |
| } | |
| .cell { | |
| position: relative; | |
| width: 120px; | |
| height: 120px; | |
| background: #fff8e8; | |
| border: 4px solid #453720; | |
| box-sizing: border-box; | |
| cursor: pointer; | |
| } | |
| .cell.selected { | |
| outline: 7px solid #ffcc33; | |
| outline-offset: -9px; | |
| } | |
| .num { | |
| position: absolute; | |
| top: 5px; | |
| left: 7px; | |
| font-weight: bold; | |
| color: #7e6c49; | |
| z-index: 5; | |
| font-size: 13px; | |
| } | |
| .tile { | |
| position: absolute; | |
| left: 14px; | |
| top: 14px; | |
| width: 92px; | |
| height: 92px; | |
| transform-origin: 46px 46px; | |
| } | |
| .square-outline { | |
| position: absolute; | |
| left: 0; | |
| top: 0; | |
| width: 82px; | |
| height: 82px; | |
| border: 5px solid black; | |
| } | |
| .bar { | |
| position: absolute; | |
| left: 5px; | |
| top: 40px; | |
| width: 82px; | |
| height: 12px; | |
| background: black; | |
| } | |
| .elbow-v { | |
| position: absolute; | |
| left: 40px; | |
| top: 0; | |
| width: 12px; | |
| height: 46px; | |
| background: black; | |
| } | |
| .elbow-h { | |
| position: absolute; | |
| left: 46px; | |
| top: 40px; | |
| width: 46px; | |
| height: 12px; | |
| background: black; | |
| } | |
| .controls { width: 330px; max-width: 100%; } | |
| .group { | |
| border-bottom: 1px solid #dccba5; | |
| padding-bottom: 16px; | |
| margin-bottom: 18px; | |
| } | |
| .group:last-child { border-bottom: none; } | |
| button { | |
| margin: 5px; | |
| padding: 11px 13px; | |
| border: 2px solid #6f5b35; | |
| border-radius: 8px; | |
| background: #fff8e8; | |
| font-weight: bold; | |
| cursor: pointer; | |
| font-size: 15px; | |
| } | |
| button:hover { background: #ead6aa; } | |
| button.active { background: #ffcc33; } | |
| #status { | |
| background: #fff8e8; | |
| border: 2px solid #d2bd8d; | |
| border-radius: 8px; | |
| padding: 10px; | |
| line-height: 1.45; | |
| } | |
| textarea { | |
| width: 100%; | |
| height: 150px; | |
| font-family: monospace; | |
| font-size: 12px; | |
| box-sizing: border-box; | |
| } | |
| .legend { | |
| display: flex; | |
| align-items: center; | |
| gap: 10px; | |
| margin: 12px 0; | |
| } | |
| .mini { | |
| position: relative; | |
| width: 62px; | |
| height: 62px; | |
| border: 3px solid #493b23; | |
| background: #fff8ea; | |
| } | |
| .mini .square-outline { | |
| left: 8px; | |
| top: 8px; | |
| width: 38px; | |
| height: 38px; | |
| border-width: 4px; | |
| } | |
| .mini .bar { | |
| left: 11px; | |
| top: 29px; | |
| width: 40px; | |
| height: 6px; | |
| } | |
| .mini .elbow-v { | |
| left: 29px; | |
| top: 9px; | |
| width: 6px; | |
| height: 22px; | |
| } | |
| .mini .elbow-h { | |
| left: 32px; | |
| top: 29px; | |
| width: 22px; | |
| height: 6px; | |
| } | |
| @media (max-width: 650px) { | |
| #grid { | |
| grid-template-columns: repeat(4, 68px); | |
| grid-template-rows: repeat(4, 68px); | |
| gap: 6px; | |
| padding: 7px; | |
| } | |
| .cell { | |
| width: 68px; | |
| height: 68px; | |
| border-width: 3px; | |
| } | |
| .num { | |
| font-size: 11px; | |
| top: 3px; | |
| left: 5px; | |
| } | |
| .tile { | |
| left: 8px; | |
| top: 8px; | |
| width: 52px; | |
| height: 52px; | |
| transform-origin: 26px 26px; | |
| } | |
| .square-outline { | |
| width: 46px; | |
| height: 46px; | |
| border-width: 3px; | |
| } | |
| .bar { | |
| left: 3px; | |
| top: 24px; | |
| width: 46px; | |
| height: 5px; | |
| } | |
| .elbow-v { | |
| left: 24px; | |
| top: 0; | |
| width: 5px; | |
| height: 26px; | |
| } | |
| .elbow-h { | |
| left: 26px; | |
| top: 24px; | |
| width: 26px; | |
| height: 5px; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Interactive 4×4 Tile Tool</h1> | |
| <div id="jsCheck" class="notice"> | |
| JavaScript is NOT running yet. If this message stays here, the file is being opened in a preview mode that blocks interaction. | |
| </div> | |
| <div class="layout"> | |
| <div class="panel"> | |
| <div id="grid"></div> | |
| </div> | |
| <div class="panel controls"> | |
| <div class="group"> | |
| <h2>Selected tile</h2> | |
| <div id="status">Waiting for JavaScript...</div> | |
| </div> | |
| <div class="group"> | |
| <h2>Design</h2> | |
| <button id="designA" type="button">Design A</button> | |
| <button id="designB" type="button">Design B</button> | |
| </div> | |
| <div class="group"> | |
| <h2>Orientation</h2> | |
| <button class="rot" data-rot="0" type="button">0°</button> | |
| <button class="rot" data-rot="90" type="button">90°</button> | |
| <button class="rot" data-rot="180" type="button">180°</button> | |
| <button class="rot" data-rot="270" type="button">270°</button> | |
| <br> | |
| <button id="turn" type="button">Rotate selected 90°</button> | |
| </div> | |
| <div class="group"> | |
| <h2>Legend</h2> | |
| <div class="legend"> | |
| <div class="mini"> | |
| <div class="square-outline"></div> | |
| <div class="bar"></div> | |
| </div> | |
| <div><b>Design A</b><br>Square with a bar across it</div> | |
| </div> | |
| <div class="legend"> | |
| <div class="mini"> | |
| <div class="square-outline"></div> | |
| <div class="elbow-v"></div> | |
| <div class="elbow-h"></div> | |
| </div> | |
| <div><b>Design B</b><br>Right angle ending at side midpoints</div> | |
| </div> | |
| </div> | |
| <div class="group"> | |
| <h2>Layout data</h2> | |
| <textarea id="dataBox"></textarea> | |
| <button id="selectData" type="button">Select data</button> | |
| <button id="reset" type="button">Reset</button> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| (function () { | |
| var selected = 0; | |
| function defaultCells() { | |
| return [ | |
| {design:"A", rot:0}, {design:"B", rot:90}, {design:"A", rot:90}, {design:"B", rot:180}, | |
| {design:"B", rot:0}, {design:"A", rot:0}, {design:"B", rot:180}, {design:"A", rot:90}, | |
| {design:"A", rot:90}, {design:"B", rot:270}, {design:"A", rot:0}, {design:"B", rot:0}, | |
| {design:"B", rot:270}, {design:"A", rot:180}, {design:"B", rot:90}, {design:"A", rot:0} | |
| ]; | |
| } | |
| var cells = defaultCells(); | |
| var jsCheck = document.getElementById("jsCheck"); | |
| jsCheck.className = "notice ok"; | |
| jsCheck.textContent = "JavaScript is working. You can click cells and change the design or rotation."; | |
| function makeTile(cell) { | |
| var design = '<div class="square-outline"></div>'; | |
| if (cell.design === "A") { | |
| design += '<div class="bar"></div>'; | |
| } else { | |
| design += '<div class="elbow-v"></div><div class="elbow-h"></div>'; | |
| } | |
| return '<div class="tile" style="transform: rotate(' + cell.rot + 'deg)">' + design + '</div>'; | |
| } | |
| function render() { | |
| var grid = document.getElementById("grid"); | |
| grid.innerHTML = ""; | |
| for (var i = 0; i < 16; i++) { | |
| var div = document.createElement("div"); | |
| div.className = "cell" + (i === selected ? " selected" : ""); | |
| div.setAttribute("data-index", i); | |
| div.innerHTML = '<div class="num">' + (i + 1) + '</div>' + makeTile(cells[i]); | |
| div.addEventListener("click", function () { | |
| selected = Number(this.getAttribute("data-index")); | |
| render(); | |
| }); | |
| grid.appendChild(div); | |
| } | |
| var current = cells[selected]; | |
| document.getElementById("status").innerHTML = | |
| "Cell " + (selected + 1) + "<br>Design " + current.design + "<br>Rotation " + current.rot + "°"; | |
| document.getElementById("designA").className = current.design === "A" ? "active" : ""; | |
| document.getElementById("designB").className = current.design === "B" ? "active" : ""; | |
| var rotButtons = document.querySelectorAll(".rot"); | |
| for (var r = 0; r < rotButtons.length; r++) { | |
| var val = Number(rotButtons[r].getAttribute("data-rot")); | |
| rotButtons[r].className = "rot" + (val === current.rot ? " active" : ""); | |
| } | |
| document.getElementById("dataBox").value = JSON.stringify(cells, null, 2); | |
| } | |
| document.getElementById("designA").addEventListener("click", function () { | |
| cells[selected].design = "A"; | |
| render(); | |
| }); | |
| document.getElementById("designB").addEventListener("click", function () { | |
| cells[selected].design = "B"; | |
| render(); | |
| }); | |
| var rotButtons = document.querySelectorAll(".rot"); | |
| for (var r = 0; r < rotButtons.length; r++) { | |
| rotButtons[r].addEventListener("click", function () { | |
| cells[selected].rot = Number(this.getAttribute("data-rot")); | |
| render(); | |
| }); | |
| } | |
| document.getElementById("turn").addEventListener("click", function () { | |
| cells[selected].rot = (cells[selected].rot + 90) % 360; | |
| render(); | |
| }); | |
| document.getElementById("selectData").addEventListener("click", function () { | |
| var box = document.getElementById("dataBox"); | |
| box.focus(); | |
| box.select(); | |
| }); | |
| document.getElementById("reset").addEventListener("click", function () { | |
| cells = defaultCells(); | |
| selected = 0; | |
| render(); | |
| }); | |
| render(); | |
| })(); | |
| </script> | |
| </body> | |
| </html> |