diff --git a/public/js/reader.js b/public/js/reader.js index fa66b77..63cef7f 100644 --- a/public/js/reader.js +++ b/public/js/reader.js @@ -14,6 +14,7 @@ const readerComponent = () => { margin: 30, preloadLookahead: 3, enableRightToLeft: false, + fitType: 'vert', /** * Initialize the component by fetching the page dimensions @@ -65,6 +66,11 @@ const readerComponent = () => { this.preloadImage(this.items[idx - 1].url); } + const savedFitType = localStorage.getItem('fitType'); + if (savedFitType) { + this.fitType = savedFitType; + $('#fit-select').val(savedFitType); + } const savedFlipAnimation = localStorage.getItem('enableFlipAnimation'); this.enableFlipAnimation = savedFlipAnimation === null || savedFlipAnimation === 'true'; @@ -335,6 +341,11 @@ const readerComponent = () => { this.toPage(this.selectedIndex); }, + fitChanged(){ + this.fitType = $('#fit-select').val(); + localStorage.setItem('fitType', this.fitType); + }, + preloadLookaheadChanged() { localStorage.setItem('preloadLookahead', this.preloadLookahead); }, diff --git a/src/views/reader.html.ecr b/src/views/reader.html.ecr index 19e2b19..21357ee 100644 --- a/src/views/reader.html.ecr +++ b/src/views/reader.html.ecr @@ -5,7 +5,7 @@ <%= render_component "head" %>
-