enable gestures on posts/show

This commit is contained in:
r888888888
2017-09-23 13:44:41 -07:00
parent 233c118df4
commit d4106473dd

View File

@@ -25,6 +25,7 @@
this.initialize_post_image_resize_to_window_link(); this.initialize_post_image_resize_to_window_link();
this.initialize_similar(); this.initialize_similar();
this.initialize_replace_image_dialog(); this.initialize_replace_image_dialog();
this.initialize_gestures();
if ((Danbooru.meta("always-resize-images") === "true") || ((Danbooru.Cookie.get("dm") != "1") && (window.innerWidth <= 660))) { if ((Danbooru.meta("always-resize-images") === "true") || ((Danbooru.Cookie.get("dm") != "1") && (window.innerWidth <= 660))) {
$("#image-resize-to-window-link").click(); $("#image-resize-to-window-link").click();
@@ -69,10 +70,10 @@
$("body").hammer().bind("panend", function(e) { $("body").hammer().bind("panend", function(e) {
var percentage = e.gesture.deltaX / window.innerWidth; var percentage = e.gesture.deltaX / window.innerWidth;
if (hasPrev && percentage > 0.4) { if (hasPrev && percentage > 0.3) {
$("body").css({"transition-timing-function": "ease", "transition-duration": "0.3s", "opacity": "0", "transform": "translateX(150%)"}); $("body").css({"transition-timing-function": "ease", "transition-duration": "0.3s", "opacity": "0", "transform": "translateX(150%)"});
Danbooru.Post.nav_prev(e); Danbooru.Post.nav_prev(e);
} else if (hasNext && percentage < -0.4) { } else if (hasNext && percentage < -0.3) {
$("body").css({"transition-timing-function": "ease", "transition-duration": "0.3s", "opacity": "0", "transform": "translateX(-150%)"}); $("body").css({"transition-timing-function": "ease", "transition-duration": "0.3s", "opacity": "0", "transform": "translateX(-150%)"});
Danbooru.Post.nav_next(e); Danbooru.Post.nav_next(e);
} else { } else {
@@ -174,7 +175,9 @@
} }
Danbooru.Post.nav_prev = function(e) { Danbooru.Post.nav_prev = function(e) {
if ($("#search-seq-nav").length) { if ($("#a-show")) {
window.history.back();
} else if ($("#search-seq-nav").length) {
var href = $("#search-seq-nav a[rel~=prev]").attr("href"); var href = $("#search-seq-nav a[rel~=prev]").attr("href");
if (href) { if (href) {
location.href = href; location.href = href;