diff options
author | Tuomas Klavér <tklavr@local> | 2023-11-20 02:04:12 +0200 |
---|---|---|
committer | Tuomas Klavér <tklavr@local> | 2023-11-20 02:04:12 +0200 |
commit | d13d4860f3d5b51d659379aa8a38742bfe49bf37 (patch) | |
tree | eaf65876d9a4497f282dab300007338144c53001 /static/menu.js | |
parent | 4724a8667371abcf8b0a5a7355a7c2588841c135 (diff) |
Questions now shows up. DB -> JSON -> JS -> DOM
Diffstat (limited to 'static/menu.js')
-rw-r--r-- | static/menu.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/static/menu.js b/static/menu.js index ee8f977..5256ef2 100644 --- a/static/menu.js +++ b/static/menu.js @@ -145,6 +145,16 @@ hashToPage = async () => { pageElement.loaded = false; window.location.assign( pageElement.innerHTML.slice( 11 ) ); } + + // https://plnkr.co/edit/MMegiu by Allen Kim + Array.from(pageElement.querySelectorAll("script")).forEach(oldScript => { + const newScript = document.createElement("script"); + Array.from(oldScript.attributes).forEach(attr => + newScript.setAttribute(attr.name, attr.value)); + newScript.appendChild(document.createTextNode(oldScript.innerHTML)); + oldScript.parentNode.replaceChild(newScript, oldScript); + }); + document.getElementById(`${currentPage}_menuEntry`) .className = 'menuItem' document.getElementById(`${p}_menuEntry`) |