From b78ba7f3d0177568991514d111ed70b5760cdabb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 1 Jul 2018 23:19:11 +0300 Subject: Revert "Revert "add page turn handling for iframe margins"" This reverts commit 577844e0568fb31c82a2071262315752037e7f87. --- js/reader.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/js/reader.js b/js/reader.js index 255ee91..e0572aa 100644 --- a/js/reader.js +++ b/js/reader.js @@ -23,6 +23,26 @@ $(document).ready(function() { } }); + $(window).on("mouseup", function(evt) { + if (evt.button == 0) { + + if ($(".modal").is(":visible")) + return; + + var reader = $("body"); + var doc = document.documentElement; + var margin_side = parseInt(reader.css("padding-left"), 10); + + if (evt.clientX >= doc.clientWidth - margin_side) { + console.log("iframe: RIGHT SIDE"); + parent.next_page(); + } else if (evt.clientX <= margin_side) { + console.log("iframe: LEFT SIDE"); + parent.prev_page(); + } + } + }); + $(window).on("touchstart", function() { enable_swipes(); }); -- cgit v1.2.3