diff --git a/static/html/epub.html b/static/html/epub.html index fc96f8b..b7f51da 100644 --- a/static/html/epub.html +++ b/static/html/epub.html @@ -94,7 +94,7 @@ - + diff --git a/static/html/pdf.html b/static/html/pdf.html index 2fcf5e8..2fa74ea 100644 --- a/static/html/pdf.html +++ b/static/html/pdf.html @@ -53,8 +53,8 @@ See https://github.com/adobe-type-tools/cmap-resources - - + + diff --git a/static/reader/epub.js b/static/reader/epub.js index dbc013d..08f209d 100644 --- a/static/reader/epub.js +++ b/static/reader/epub.js @@ -3,6 +3,7 @@ var reader; var id = document.location.pathname.split('/')[1]; var annotations = JSON.parse(localStorage[id + '.annotations'] || '[]') var currentSelection; +var fontSize = parseInt(localStorage.epubFontSize || '100', 10) function saveAnnotations() { localStorage[id + '.annotations'] = JSON.stringify(annotations) @@ -42,6 +43,7 @@ document.onreadystatechange = function () { var rendition = reader.rendition, book = reader.book; + rendition.themes.fontSize(fontSize + "%"); annotations.forEach(function(a) { rendition.annotations.highlight(a.cfiRange, a.data || {}, onHighlightClicked); }) @@ -79,6 +81,23 @@ document.onreadystatechange = function () { currentSelection = null } } + if (event.keyCode == 61 && event.shiftKey) { + fontSize += 10 + rendition.themes.fontSize(fontSize + "%"); + localStorage.epubFontSize = fontSize + event.preventDefault() + } else if (event.keyCode == 173 && event.shiftKey) { + fontSize -= 10 + rendition.themes.fontSize(fontSize + "%"); + localStorage.epubFontSize = fontSize + event.preventDefault() + } else if (event.keyCode == 48 && event.shiftKey) { + fontSize = 100 + rendition.themes.fontSize(fontSize + "%"); + localStorage.epubFontSize = fontSize + event.preventDefault() + } + console.log(fontSize) }) rendition.on("mark", function(cfiRange, contents) { console.log('!! mark', cfiRange)