diff options
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`) |