From 226516aca48e97d3dc4e4df213bc2023e64b1afd Mon Sep 17 00:00:00 2001 From: Minteck Date: Sun, 27 Mar 2022 21:29:24 +0200 Subject: Initial commit --- js/frame.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 js/frame.js (limited to 'js/frame.js') diff --git a/js/frame.js b/js/frame.js new file mode 100644 index 0000000..6f26e16 --- /dev/null +++ b/js/frame.js @@ -0,0 +1,25 @@ +_argonLoadedHooks.push(function ArgonStartupFrame() { + try { + log("Processing initial hash"); + original = location.hash.substring(1); + document.getElementById("frame-inner").src = "/_frame" + original; + } catch (e) { + console.error(e); + location.hash = ""; + } + + window.addEventListener('hashchange', () => { + log("Processing hash change"); + try { + original = location.hash.substring(1); + document.getElementById("frame-inner").src = "/_frame" + original; + } catch (e) { + console.error(e); + } + }); + + document.getElementById("frame-inner").addEventListener('load', () => { + log("Changing hash as per iframe URL"); + location.hash = document.getElementById("frame-inner").contentDocument.location.href.split(location.host)[1].substring(7); + }) +}) \ No newline at end of file -- cgit