From cf1d643376d4f18cd5cfa9075a21b11fb5713daf Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 8 Oct 2020 16:05:18 +0300 Subject: some more gulp-related stuff --- dist/reader.min.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 dist/reader.min.js (limited to 'dist/reader.min.js') diff --git a/dist/reader.min.js b/dist/reader.min.js new file mode 100644 index 0000000..dc34ea2 --- /dev/null +++ b/dist/reader.min.js @@ -0,0 +1 @@ +"use strict";const DEFAULT_FONT_SIZE=16,DEFAULT_FONT_FAMILY="Georgia",DEFAULT_LINE_HEIGHT=140,MIN_LENGTH_TO_JUSTIFY=32,Reader={init:function(){$(document).on("keyup",(function(e){Reader.hotkeyHandler(e)})),$("#left").on("mouseup",(function(){Reader.Page.prev()})),$("#right").on("mouseup",(function(){Reader.Page.next()})),Reader.Loader.init()},initSecondStage:function(){"undefined"!=typeof EpubeApp&&EpubeApp.setPage("PAGE_READER"),Reader.applyTheme(),"true"==Cookie.get("is-epube-app")&&$("body").addClass("is-epube-app"),$(window).on("online",(function(){console.log("we're online, storing lastread");const t=e.rendition.currentLocation().start.cfi,o=parseInt(100*e.locations.percentageFromCfi(t));$.post("backend.php",{op:"storelastread",id:$.urlParam("id"),page:o,cfi:t},(function(e){e.cfi&&(Reader.Page._last_position_sync=(new Date).getTime()/1e3)})).fail((function(e){e&&401==e.status&&(window.location="index.php")}))})),localforage.getItem(Reader.cacheId("book")).then((function(t){if(/*!_is_ios &&*/t){console.log("loading from local storage");const o=new FileReader;o.onload=function(){try{e.open(this.result)}catch(e){$(".loading_message").html("Unable to load book (local)."),console.log(e)}},o.readAsArrayBuffer(t)}else if(console.log("loading from network"),navigator.onLine){const t="backend.php?op=download&id="+$.urlParam("id");$(".loading_message").html("Downloading..."),fetch(t,{credentials:"same-origin"}).then((function(t){if(200==t.status){const o=$.urlParam("b");t.blob().then((function(t){localforage.getItem(Reader.cacheId()).then((function(e){e||$.post("backend.php",{op:"getinfo",id:o},(function(e){e&&(localforage.setItem(Reader.cacheId(),e),e.has_cover&&fetch("backend.php?op=cover&id="+o,{credentials:"same-origin"}).then((function(e){200==e.status&&localforage.setItem(Reader.cacheId("cover"),e.blob())})))}))}));const n=new FileReader;n.onload=function(){e.open(this.result).then(()=>{localforage.setItem(Reader.cacheId("book"),t)}).catch(e=>{$(".loading_message").html("Unable to open book.
"+e+"")})},n.onerror=function(e){console.log("filereader error",e),$(".loading_message").html("Unable to open book.
"+e+"")},n.readAsArrayBuffer(t)})).catch(e=>{console.log("blob error",e),$(".loading_message").html("Unable to download book.
"+e+"")})}else $(".loading_message").html("Unable to download book: "+t.status+".")})).catch((function(e){console.warn(e),$(".loading").is(":visible")&&$(".loading_message").html("Unable to load book (remote).
"+e+"")}))}else $(".loading_message").html("This book is not available offline.")}));const e=ePub();window.book=e;const t=e.renderTo("reader",{width:"100%",height:"100%",minSpreadWidth:961});function o(t){try{const o=e.spine.get(t).cfiBase,n=e.locations._locations.find((function(e){return-1!=e.indexOf(o)}));return window.book.locations.locationFromCfi(n)}catch(e){console.warn(e)}return""}localforage.getItem("epube.enable-hyphens").then((function(e){e&&(Reader.hyphenateHTML=createHyphenator(hyphenationPatternsEnUs,{html:!0})),Reader.applyStyles(!0),t.display().then((function(){console.log("book displayed")}))})),t.hooks.content.register((function(t){t.on("linkClicked",(function(t){console.log("linkClicked",t),-1==t.indexOf("://")&&($(".prev_location_btn").attr("data-location-cfi",e.rendition.currentLocation().start.cfi).show(),window.setTimeout((function(){Reader.showUI(!0)}),50))}));const o=window.location.href.match(/^.*\//)[0],n=["dist/app-libs.min.js","js/reader_iframe.js"],a=t.document;for(let e=0;e").text(Reader.Loader._res_data[o+"css/reader.css"])),localforage.getItem("epube.theme").then((function(e){e||(e="default");const n=o+"themes/"+e+".css";$(t.document.head).append($("