aboutsummaryrefslogtreecommitdiffstats
path: root/template/standard/rsrc/main.js
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2018-05-15 01:39:38 +0200
committerThomas Lange <code@nerdmind.de>2018-05-15 01:39:38 +0200
commit0ca5f4750730fd71c4fd230f0024c55590dac0cf (patch)
treef98b00cb8be0b00875e475dd3d368c992ba8ebf1 /template/standard/rsrc/main.js
parente8357d31e7cb3629ebde78653e3345fd7997df41 (diff)
downloadblog-0ca5f4750730fd71c4fd230f0024c55590dac0cf.tar.gz
blog-0ca5f4750730fd71c4fd230f0024c55590dac0cf.tar.xz
blog-0ca5f4750730fd71c4fd230f0024c55590dac0cf.zip
Fix javascript problem that causes unintended behavior
If you browse in a browser tab through some websites and want to go back to the previous page, post or user, you can either click the history back button, press the corresponding key on your mouse or even press <alt>+<arrow-left> on your keyboard. But if you only press <arrow-left> on a page, post or user, the callback function of the "keyup" event will change the location in the desired direction on the blog if there is a previous page, post or user, and if neither <ctrl> nor <shift> is pressed. This is a functionality of the javascript from the template and not a functionality of your browser. Pressing <alt>+<arrow-left> IS a functionality of the browser and should not conflict with the behavior when <arrow-left> is pressed alone. This commit fixes this problem by adding the condition that <alt> should not be pressed either.
Diffstat (limited to 'template/standard/rsrc/main.js')
-rw-r--r--template/standard/rsrc/main.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/template/standard/rsrc/main.js b/template/standard/rsrc/main.js
index 6d088e3..f73d061 100644
--- a/template/standard/rsrc/main.js
+++ b/template/standard/rsrc/main.js
@@ -8,7 +8,7 @@ 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) {
+ 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"));
}