From e339c0c919e9e6bf7aa6c252eeaa96d67cb45539 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Sat, 23 Sep 2017 13:28:35 -0700 Subject: [PATCH] activate gestures in <660px only --- app/assets/javascripts/posts.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/assets/javascripts/posts.js b/app/assets/javascripts/posts.js index 74ff25c6c..bcabb4e14 100644 --- a/app/assets/javascripts/posts.js +++ b/app/assets/javascripts/posts.js @@ -37,6 +37,15 @@ } Danbooru.Post.initialize_gestures = function() { + if (!window.matchMedia) { + return; + } + + var mq = window.matchMedia('@media all and (max-width: 660px)'); + if (!mq.matches) { + return; + } + var hasNext = $("a[rel~=next]").length > 0; var hasPrev = $("a[rel~=prev]").length > 0;