epub zoom
This commit is contained in:
parent
1130f3ff00
commit
9b2d01aaa0
3 changed files with 22 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue