From 563c729643221c172fbb44702af7f09eaa289cff Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 19 Nov 2017 15:03:05 +0300 Subject: add some polyfills for garbage browsers --- read.html | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'read.html') diff --git a/read.html b/read.html index 0e47584..88344e3 100644 --- a/read.html +++ b/read.html @@ -8,6 +8,9 @@ + + + @@ -219,6 +222,8 @@ var _pagination_stored = 0; var _last_position_sync = 0; + var _is_ios = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; + const DEFAULT_FONT_SIZE = 16; const DEFAULT_FONT_FAMILY = "Georgia"; const DEFAULT_LINE_HEIGHT = 140; @@ -254,13 +259,15 @@ } localforage.getItem(cacheId("book")).then(function(item) { - if (item) { + + // ios doesn't work with FileReader for whatever reason + if (/*!_is_ios &&*/ item) { console.log("loading from local storage"); var fileReader = new FileReader(); - fileReader.onload = function() { + fileReader.onload = function(evt) { book.open(this.result); }; @@ -357,6 +364,15 @@ if (callback) callback(); } +/* EPUBJS.Renderer.prototype.onResized = function(e) { + this.trigger('renderer:beforeResize'); + + var width = $("#reader").width(); + var height = $("#reader").height(); + + this.resize(width, height, false); + }; */ + var book = ePub({ restore: false, }); -- cgit v1.2.3