mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-15 18:57:05 +00:00
implement swipe gestures on mobile to go to next and previous articles
This commit is contained in:
parent
00dc7622fb
commit
c34a8956e1
6 changed files with 42 additions and 15 deletions
|
@ -1,27 +1,27 @@
|
|||
function navigateKeyboard(leftURL, rightURL) {
|
||||
window.addEventListener("keypress", function (event) {
|
||||
var key = event.which || event.keyCode; // event.keyCode is used for IE8 and earlier versions
|
||||
console.log("key pressed : " + key);
|
||||
switch (key) {
|
||||
case 37:
|
||||
// left arrow
|
||||
if (leftURL != "?view=view&id=") {
|
||||
window.location = window.location.origin + window.location.pathname + leftURL;
|
||||
}
|
||||
goLeft(leftURL);
|
||||
break;
|
||||
/*
|
||||
case 38:
|
||||
// top arrow
|
||||
window.location = window.location.origin + window.location.pathname + window.location.search + "#top";
|
||||
break;
|
||||
*/
|
||||
|
||||
case 39:
|
||||
//right arrow
|
||||
if (rightURL != "?view=view&id=") {
|
||||
window.location = window.location.origin + window.location.pathname + rightURL;
|
||||
}
|
||||
goRight(rightURL);
|
||||
break;
|
||||
}
|
||||
|
||||
}, false);
|
||||
}
|
||||
|
||||
function goLeft(leftURL) {
|
||||
if (leftURL != "?view=view&id=") {
|
||||
window.location = window.location.origin + window.location.pathname + leftURL;
|
||||
}
|
||||
}
|
||||
|
||||
function goRight(rightURL) {
|
||||
if (rightURL != "?view=view&id=") {
|
||||
window.location = window.location.origin + window.location.pathname + rightURL;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue