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-21 21:27:03 +0100
commit5ccca11a448ea315a6e64453e630694ba2c20e66 (patch)
treed29b46acc6ade8c3d94e272695122e7d1c611bf6 /theme/default/static/main.js
parent52cb2b8aef3ba86e4abe551a3df9831d347e948e (diff)
downloadblog-5ccca11a448ea315a6e64453e630694ba2c20e66.tar.gz
blog-5ccca11a448ea315a6e64453e630694ba2c20e66.tar.xz
blog-5ccca11a448ea315a6e64453e630694ba2c20e66.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 static sub-directories 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);