epub zoom
This commit is contained in:
parent
1130f3ff00
commit
9b2d01aaa0
3 changed files with 22 additions and 3 deletions
|
@ -94,7 +94,7 @@
|
||||||
|
|
||||||
<script src="/static/epub.js/js/libs/jquery.min.js"></script>
|
<script src="/static/epub.js/js/libs/jquery.min.js"></script>
|
||||||
<script src="/static/epub.js/js/libs/zip.min.js"></script>
|
<script src="/static/epub.js/js/libs/zip.min.js"></script>
|
||||||
<script src="/static/reader/epub.js"></script>
|
<script src="/static/reader/epub.js?2"></script>
|
||||||
<!-- Render -->
|
<!-- Render -->
|
||||||
<script src="/static/epub.js/js/epub.js"></script>
|
<script src="/static/epub.js/js/epub.js"></script>
|
||||||
<!-- Reader -->
|
<!-- Reader -->
|
||||||
|
|
|
@ -53,8 +53,8 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||||
<!--
|
<!--
|
||||||
<script src="/static/pdf.js/debugger.js"></script>
|
<script src="/static/pdf.js/debugger.js"></script>
|
||||||
-->
|
-->
|
||||||
<script src="/static/pdf.js/viewer.js"></script>
|
<script src="/static/pdf.js/viewer.js?2"></script>
|
||||||
<script src="/static/reader/pdf.js"></script>
|
<script src="/static/reader/pdf.js?2"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ var reader;
|
||||||
var id = document.location.pathname.split('/')[1];
|
var id = document.location.pathname.split('/')[1];
|
||||||
var annotations = JSON.parse(localStorage[id + '.annotations'] || '[]')
|
var annotations = JSON.parse(localStorage[id + '.annotations'] || '[]')
|
||||||
var currentSelection;
|
var currentSelection;
|
||||||
|
var fontSize = parseInt(localStorage.epubFontSize || '100', 10)
|
||||||
|
|
||||||
function saveAnnotations() {
|
function saveAnnotations() {
|
||||||
localStorage[id + '.annotations'] = JSON.stringify(annotations)
|
localStorage[id + '.annotations'] = JSON.stringify(annotations)
|
||||||
|
@ -42,6 +43,7 @@ document.onreadystatechange = function () {
|
||||||
var rendition = reader.rendition,
|
var rendition = reader.rendition,
|
||||||
book = reader.book;
|
book = reader.book;
|
||||||
|
|
||||||
|
rendition.themes.fontSize(fontSize + "%");
|
||||||
annotations.forEach(function(a) {
|
annotations.forEach(function(a) {
|
||||||
rendition.annotations.highlight(a.cfiRange, a.data || {}, onHighlightClicked);
|
rendition.annotations.highlight(a.cfiRange, a.data || {}, onHighlightClicked);
|
||||||
})
|
})
|
||||||
|
@ -79,6 +81,23 @@ document.onreadystatechange = function () {
|
||||||
currentSelection = null
|
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) {
|
rendition.on("mark", function(cfiRange, contents) {
|
||||||
console.log('!! mark', cfiRange)
|
console.log('!! mark', cfiRange)
|
||||||
|
|
Loading…
Add table
Reference in a new issue