UNPKG

eve-esi-types

Version:

Extracted the main type of ESI. use for ESI request response types (version 2 only)

58 lines (54 loc) 1.91 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>eve-esi-types ESI request test</title> <script type="module" src="../minimal-rq.mjs"></script> <link rel="stylesheet" href="./index.css"> </head> <body> <div class="container"> <button id="run-test">Run test</button> </div> <div class="info"> <div>example command: <input type="text" class="command" value="browser-sync start -s --port 8080 --no-open --ss &lt;this site directory>" size="72" readonly> <button class="copy" onclick="copy('.command', '.')"></button> </div> then access to <a href="http://localhost:8080/web/?x=1&debug=1">eve-esi-types ESI request test</a> </div> <div class="log-frame" contenteditable></div> <footer class="footer"></footer> <script> /** @type {(s: string, rep: string, regex?: RegExp) => void} */ function copy(selector, replacement, regex = /<[^>]+>/) { /** @type {HTMLInputElement} */ const text = document.querySelector(selector); const shellscript = text.value.replace(regex, replacement); navigator.clipboard.writeText(shellscript).then(() => alert("Copied the text: " + shellscript)); } /** @type {HTMLDivElement} */ const logElement = document.querySelector(".log-frame"); if (logElement) { let inputBuffer = ""; logElement.addEventListener("keydown", function (e) { if (e.ctrlKey) { if (e.code === "KeyL") { e.preventDefault(); logElement.innerHTML = ""; } } else { const key = e.key; if (key === "Enter") { const cmd = inputBuffer; inputBuffer = ""; eval(`${cmd}`); } else if (key.length === 1) { inputBuffer += key; } } }); } </script> </body> </html>