From 0018be7edc28b11a8da14e94613c5591da98d93a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 28 Jun 2018 18:02:39 +0300 Subject: simplify rotation/resize hacks --- js/read.js | 16 ---------------- read.html | 33 ++++++++++++--------------------- 2 files changed, 12 insertions(+), 37 deletions(-) diff --git a/js/read.js b/js/read.js index 39d7929..cc61dbe 100644 --- a/js/read.js +++ b/js/read.js @@ -103,22 +103,6 @@ function hotkey_handler(e) { $(document).ready(function() { document.onkeydown = hotkey_handler; - $(window).on("orientationchange", function(evt) { - console.log("orientationchange"); - - $(".loading").show(); - $(".loading_message").html("Opening chapter..."); - - window.setTimeout(function() { - open_lastread(); - - window.setTimeout(function() { - $(".loading").hide(); - }, 500); - - }, 1000); - }); - $(window).on("mouseup", function(evt) { if (evt.button == 0) { diff --git a/read.html b/read.html index b19c23e..0370065 100644 --- a/read.html +++ b/read.html @@ -466,27 +466,6 @@ if (callback) callback(); } - EPUBJS.Renderer.prototype.onResized = function(e) { - this.trigger('renderer:beforeResize'); - - var width = this.container.clientWidth; - var height = this.container.clientHeight; - - this.resize(width, height, false); - - $(".loading").show(); - $(".loading_message").html("Opening chapter..."); - - window.setTimeout(function() { - open_lastread(); - - window.setTimeout(function() { - $(".loading").hide(); - }, 500); - - }, 1000); - }; - if (_is_ios) { var book = ePub({ restore: false, @@ -685,7 +664,19 @@ book.on("renderer:chapterUnloaded", function() { $(".loading").show(); $(".loading_message").html("Opening chapter..."); + }); + + book.on("renderer:resized", function() { + $(".loading").show(); + $(".loading_message").html("Opening chapter..."); + window.setTimeout(function() { + open_lastread(); + + window.setTimeout(function() { + $(".loading").hide(); + }, 500); + }, 500); }); book.on("renderer:chapterDisplayed", function() { -- cgit v1.2.3