aboutsummaryrefslogtreecommitdiffhomepage
path: root/themes/_global/js/keyboard.js
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2015-03-07 23:59:27 +0100
committerThomas Citharel <tcit@tcit.fr>2015-03-07 23:59:27 +0100
commitc34a8956e1cd07498457f3211898e8de6d794de3 (patch)
treeb53b0e16f39657af447294bb4b96a2d4f4cc22b1 /themes/_global/js/keyboard.js
parent00dc7622fbb25458f82b8d81dffae6f843dadece (diff)
downloadwallabag-c34a8956e1cd07498457f3211898e8de6d794de3.tar.gz
wallabag-c34a8956e1cd07498457f3211898e8de6d794de3.tar.zst
wallabag-c34a8956e1cd07498457f3211898e8de6d794de3.zip
implement swipe gestures on mobile to go to next and previous articles
Diffstat (limited to 'themes/_global/js/keyboard.js')
-rw-r--r--themes/_global/js/keyboard.js30
1 files changed, 15 insertions, 15 deletions
diff --git a/themes/_global/js/keyboard.js b/themes/_global/js/keyboard.js
index 26978cb2..ec20d3f2 100644
--- a/themes/_global/js/keyboard.js
+++ b/themes/_global/js/keyboard.js
@@ -1,27 +1,27 @@
1function navigateKeyboard(leftURL, rightURL) { 1function navigateKeyboard(leftURL, rightURL) {
2 window.addEventListener("keypress", function (event) { 2 window.addEventListener("keypress", function (event) {
3 var key = event.which || event.keyCode; // event.keyCode is used for IE8 and earlier versions 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) { 4 switch (key) {
6 case 37: 5 case 37:
7 // left arrow 6 goLeft(leftURL);
8 if (leftURL != "?view=view&id=") {
9 window.location = window.location.origin + window.location.pathname + leftURL;
10 }
11 break; 7 break;
12 /* 8
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: 9 case 39:
19 //right arrow 10 goRight(rightURL);
20 if (rightURL != "?view=view&id=") {
21 window.location = window.location.origin + window.location.pathname + rightURL;
22 }
23 break; 11 break;
24 } 12 }
25 13
26 }, false); 14 }, false);
15}
16
17function goLeft(leftURL) {
18 if (leftURL != "?view=view&id=") {
19 window.location = window.location.origin + window.location.pathname + leftURL;
20 }
21}
22
23function goRight(rightURL) {
24 if (rightURL != "?view=view&id=") {
25 window.location = window.location.origin + window.location.pathname + rightURL;
26 }
27} \ No newline at end of file 27} \ No newline at end of file