aboutsummaryrefslogtreecommitdiffstats
path: root/theme/default/static/main.js
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2024-11-21 20:59:05 +0100
committerThomas Lange <code@nerdmind.de>2024-11-29 15:10:40 +0100
commitebc5cf9ac20b959c6d4a6a34643eb8657cf9db84 (patch)
tree6a17f88f2afd17f8afac6a0d744d6369e2a65cdb /theme/default/static/main.js
parent52cb2b8aef3ba86e4abe551a3df9831d347e948e (diff)
downloadblog-ebc5cf9ac20b959c6d4a6a34643eb8657cf9db84.tar.gz
blog-ebc5cf9ac20b959c6d4a6a34643eb8657cf9db84.tar.xz
blog-ebc5cf9ac20b959c6d4a6a34643eb8657cf9db84.zip
Rename "rsrc" directories to "static"
Stop using "rsrc" as name for the directories which contain static files and rename them to "static". This affects the global static directory and the subdirectories in the theme directories. If you've stored your own files in the old global "rsrc" directory, you must move them to the new "static" directory.
Diffstat (limited to 'theme/default/static/main.js')
-rw-r--r--theme/default/static/main.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/theme/default/static/main.js b/theme/default/static/main.js
new file mode 100644
index 0000000..164c50f
--- /dev/null
+++ b/theme/default/static/main.js
@@ -0,0 +1,15 @@
+//==============================================================================
+// Elements which contains the location of the previous and next site
+//==============================================================================
+const prev = document.getElementById("prev-site");
+const next = document.getElementById("next-site");
+
+//==============================================================================
+// Handle arrow keys and change the location to the desired direction
+//==============================================================================
+document.addEventListener("keyup", function(e) {
+ if(!e.ctrlKey && !e.shiftKey && !e.altKey) {
+ (e.keyCode === 37 && prev) && (window.location.href = prev.getAttribute("href"));
+ (e.keyCode === 39 && next) && (window.location.href = next.getAttribute("href"));
+ }
+}, false);