X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=files%2Fpr0n-fullscreen.js;fp=files%2Fpr0n-fullscreen.js;h=7ab77cd3155b4ad28320b4c54ed0af8121a4373f;hp=86e73a731fafd77fc38bc81c296a5c4e60b06cf5;hb=86ec101a01fc0a0fdfc338251a28ee35f4a6504f;hpb=8e14ba2a203956268b1cd28b215a9764471c054f diff --git a/files/pr0n-fullscreen.js b/files/pr0n-fullscreen.js index 86e73a7..7ab77cd 100644 --- a/files/pr0n-fullscreen.js +++ b/files/pr0n-fullscreen.js @@ -504,6 +504,12 @@ function set_swipe_pos(x, transition) { x = Math.max(x, -window.innerWidth); x = Math.min(x, window.innerWidth); + if (!can_go_previous()) { + x = Math.min(x, window.innerWidth / 8); + } + if (!can_go_next()) { + x = Math.max(x, -window.innerWidth / 8); + } var dpr = find_dpr(); var main = document.getElementById("main"); @@ -535,10 +541,10 @@ function end_swipe(e) { if (swiping) { var new_x = (e.changedTouches[0].pageX - swipe_start_x); - if (new_x < -window.innerWidth / 4) { + if (new_x < -window.innerWidth / 4 && can_go_next()) { set_swipe_pos(-window.innerWidth, "transform 0.1s ease-out"); setTimeout(function() { go_next(); }, 100); - } else if (new_x > window.innerWidth / 4) { + } else if (new_x > window.innerWidth / 4 && can_go_previous()) { set_swipe_pos(window.innerWidth, "transform 0.1s ease-out"); setTimeout(function() { go_previous(); }, 100); } else {