diff options
author | Thomas Citharel <tcit@tcit.fr> | 2015-03-07 22:52:03 +0100 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2015-03-07 22:52:03 +0100 |
commit | 00dc7622fbb25458f82b8d81dffae6f843dadece (patch) | |
tree | 5d9e6aec0bd8243b30d5f6f4cfb2334ff820bb88 /themes/_global/js | |
parent | 0ae1e652c94fded9f656876a25ca8021bc5bf727 (diff) | |
download | wallabag-00dc7622fbb25458f82b8d81dffae6f843dadece.tar.gz wallabag-00dc7622fbb25458f82b8d81dffae6f843dadece.tar.zst wallabag-00dc7622fbb25458f82b8d81dffae6f843dadece.zip |
change system for #1123 and keyboard arrows shortcuts
Diffstat (limited to 'themes/_global/js')
-rw-r--r-- | themes/_global/js/keyboard.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/themes/_global/js/keyboard.js b/themes/_global/js/keyboard.js new file mode 100644 index 00000000..26978cb2 --- /dev/null +++ b/themes/_global/js/keyboard.js | |||
@@ -0,0 +1,27 @@ | |||
1 | function navigateKeyboard(leftURL, rightURL) { | ||
2 | window.addEventListener("keypress", function (event) { | ||
3 | var key = event.which || event.keyCode; // event.keyCode is used for IE8 and earlier versions | ||
4 | console.log("key pressed : " + key); | ||
5 | switch (key) { | ||
6 | case 37: | ||
7 | // left arrow | ||
8 | if (leftURL != "?view=view&id=") { | ||
9 | window.location = window.location.origin + window.location.pathname + leftURL; | ||
10 | } | ||
11 | break; | ||
12 | /* | ||
13 | case 38: | ||
14 | // top arrow | ||
15 | window.location = window.location.origin + window.location.pathname + window.location.search + "#top"; | ||
16 | break; | ||
17 | */ | ||
18 | case 39: | ||
19 | //right arrow | ||
20 | if (rightURL != "?view=view&id=") { | ||
21 | window.location = window.location.origin + window.location.pathname + rightURL; | ||
22 | } | ||
23 | break; | ||
24 | } | ||
25 | |||
26 | }, false); | ||
27 | } \ No newline at end of file | ||