// [x-get=""] // [x-inner-text] - will use inner text instead of html (() => { let storage = window.x0?.registerStorage("http") || {}; storage.intervals = []; window.x0?.registerModuleRemoveHook("http", ({ intervals }) => intervals.forEach(p => clearInterval(p))); document.querySelectorAll("[x-get]") .forEach(async e => { e.innerHTML += "*"; let update = async () => { let result = await (await fetch(e.getAttribute("x-get"))).text(); if (e.hasAttribute("x-inner-text")) { e.innerText = result; } else { e.innerHTML = result; } } await update() if (e.hasAttribute("x-get-refresh")) { storage.intervals.push(setInterval(update, e.getAttribute("x-get-refresh"))); } }) })()