diff options
author | Andrew Dolgov <[email protected]> | 2021-09-14 21:36:42 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-09-14 21:36:42 +0300 |
commit | c9e10e6568a42e2a620b18cf9d01f4c5ea868466 (patch) | |
tree | 112ea57c8deaf71a3075f1cab31e9e10a371504b /js | |
parent | 0f21cf99048957daf586942e85cb9a4b2a94624e (diff) |
exp: add optional workaround for epubjs columns shifting around - https://github.com/futurepress/epub.js/issues/1218
Diffstat (limited to 'js')
-rw-r--r-- | js/reader.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/js/reader.js b/js/reader.js index 044d907..ba5d782 100644 --- a/js/reader.js +++ b/js/reader.js @@ -357,6 +357,15 @@ const Reader = { }); }); + localforage.getItem("epube.enable-column-hacks").then(function(enable) { + $(".enable_column_hacks_checkbox") + .attr("checked", enable) + .off("click") + .on("click", function(evt) { + localforage.setItem("epube.enable-column-hacks", evt.target.checked); + }); + }); + Promise.all([ localforage.getItem("epube.cache-timestamp"), localforage.getItem("epube.cache-version") @@ -742,6 +751,16 @@ const Reader = { if (book.locations.length() == 0) return; + localforage.getItem("epube.enable-column-hacks").then((enable) => { + if (enable && Reader.Page._moved_next >= 20) { + console.log('forcing re-render because of column hacks'); + + window.book.rendition.onResized($("#reader").width()); + + Reader.Page._moved_next = 0; + } + }); + const currentCfi = location.start.cfi; const currentPct = parseInt(book.locations.percentageFromCfi(currentCfi) * 100); @@ -1173,9 +1192,12 @@ const Reader = { }, Page: { _pagination_stored: 0, + _moved_next: 0, next: function() { window.book.rendition.next(); + Reader.Page._moved_next += 1; + if (typeof EpubeApp != "undefined") EpubeApp.showActionBar(false); else |