From eb80d4f36ee6a03faf77138c704b680f0dcaf70e Mon Sep 17 00:00:00 2001 From: evazion Date: Mon, 7 Oct 2019 23:09:36 -0500 Subject: [PATCH] mobile: disable "swipe left to go back" gesture on post show page. The swipe left gesture interfered with scrolling left and right, using using pinch to zoom, and with copy and pasting text. This gesture wasn't really necessary anyway, since the back button can always be used to go back instead. --- app/javascript/src/javascripts/posts.js.erb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/javascript/src/javascripts/posts.js.erb b/app/javascript/src/javascripts/posts.js.erb index d7fad487b..0e8223c6f 100644 --- a/app/javascript/src/javascripts/posts.js.erb +++ b/app/javascript/src/javascripts/posts.js.erb @@ -29,7 +29,6 @@ Post.initialize_all = function() { this.initialize_post_image_resize_links(); this.initialize_post_image_resize_to_window_link(); this.initialize_similar(); - this.initialize_gestures(); if ((Utility.meta("always-resize-images") === "true") || (Utility.meta("viewport") && (window.screen.width <= 660))) { $("#image-resize-to-window-link").click(); @@ -61,8 +60,8 @@ Post.initialize_gestures = function() { return; } $("#image-container").css({overflow: "visible"}); - var hasPrev = $("#a-show").length || $(".paginator a[rel~=prev]").length; - var hasNext = $("#a-index").length && $(".paginator a[rel~=next]").length; + var hasPrev = $(".paginator a[rel~=prev]").length; + var hasNext = $(".paginator a[rel~=next]").length; var hammer = new Hammer($body[0], {touchAction: 'pan-y', recognizers: [[Hammer.Swipe, { threshold: 20, velocity: 0.4, direction: Hammer.DIRECTION_HORIZONTAL }]], inputClass: Hammer.TouchInput}); $body.data("hammer", hammer); @@ -178,9 +177,7 @@ Post.initialize_similar = function() { } Post.swipe_prev = function(e) { - if ($("#a-show").length) { - window.history.back(); - } if ($(".paginator a[rel~=prev]").length) { + if ($(".paginator a[rel~=prev]").length) { location.href = $("a[rel~=prev]").attr("href"); }