summaryrefslogtreecommitdiff
path: root/js/frame.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-03-27 21:29:24 +0200
committerMinteck <contact@minteck.org>2022-03-27 21:29:24 +0200
commit226516aca48e97d3dc4e4df213bc2023e64b1afd (patch)
tree60fb4f24b75b120e7e5b0e149069b16367c48aa0 /js/frame.js
downloadargon-226516aca48e97d3dc4e4df213bc2023e64b1afd.tar.gz
argon-226516aca48e97d3dc4e4df213bc2023e64b1afd.tar.bz2
argon-226516aca48e97d3dc4e4df213bc2023e64b1afd.zip
Initial commit
Diffstat (limited to 'js/frame.js')
-rw-r--r--js/frame.js25
1 files changed, 25 insertions, 0 deletions
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