mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-05 15:32:55 +02:00
fixed merge issues
This commit is contained in:
commit
5cb99ef2e6
9 changed files with 144 additions and 11 deletions
|
@ -612,12 +612,13 @@ EPUBJS.Book.prototype.fromStorage = function(stored) {
|
|||
*/
|
||||
|
||||
EPUBJS.Book.prototype.setStyle = function(style, val, prefixed) {
|
||||
this.render.setStyle(style, val, prefixed);
|
||||
this.settings.styles[style] = val;
|
||||
|
||||
if(this.render) this.render.setStyle(style, val, prefixed);
|
||||
}
|
||||
|
||||
EPUBJS.Book.prototype.removeStyle = function(style, val, prefixed) {
|
||||
this.render.removeStyle(style);
|
||||
if(this.render) this.render.removeStyle(style);
|
||||
|
||||
delete this.settings.styles[style];
|
||||
}
|
||||
|
|
2
build/epub.min.js
vendored
2
build/epub.min.js
vendored
File diff suppressed because one or more lines are too long
2
demo/js/epub.min.js
vendored
2
demo/js/epub.min.js
vendored
File diff suppressed because one or more lines are too long
117
examples/backbone.html
Normal file
117
examples/backbone.html
Normal file
|
@ -0,0 +1,117 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="no-js">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>ePubJS Promises Example</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<link rel="stylesheet" href="basic.css">
|
||||
|
||||
<script src="../libs/underscore/underscore-min.js"></script>
|
||||
<script src="../libs/backbone/backbone-min.js"></script>
|
||||
|
||||
<!-- EPUBJS Renderer -->
|
||||
<script src="/build/epub.min.js"></script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
var Book = new EPUBJS.Book("/demo/moby-dick/", { restore: true });
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="main">
|
||||
<div id="prev" onclick="Book.prevPage();" class="arrow">‹</div>
|
||||
<div id="area"></div>
|
||||
<div id="next" onclick="Book.nextPage();"class="arrow">›</div>
|
||||
<div id="loader"><img src="../demo/img/loader.gif"></div>
|
||||
<select id="toc"></select>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
// Book.getMetadata().then(function(meta){
|
||||
|
||||
// document.title = meta.bookTitle+" – "+meta.creator;
|
||||
|
||||
// });
|
||||
|
||||
// Book.getToc().then(function(toc){
|
||||
|
||||
// var $select = document.getElementById("toc"),
|
||||
// docfrag = document.createDocumentFragment();
|
||||
|
||||
// toc.forEach(function(chapter) {
|
||||
// var option = document.createElement("option");
|
||||
// option.textContent = chapter.label;
|
||||
// option.ref = chapter.href;
|
||||
|
||||
// docfrag.appendChild(option);
|
||||
// });
|
||||
|
||||
// $select.appendChild(docfrag);
|
||||
|
||||
// $select.onchange = function(){
|
||||
// var index = $select.selectedIndex,
|
||||
// url = $select.options[index].ref;
|
||||
|
||||
// Book.goto(url);
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// });
|
||||
|
||||
// Book.ready.all.then(function(){
|
||||
// document.getElementById("loader").style.display = "none";
|
||||
// });
|
||||
|
||||
// Book.renderTo("area");
|
||||
|
||||
var BB = {};
|
||||
|
||||
// Router
|
||||
BB.Router = Backbone.Router.extend({
|
||||
routes: {
|
||||
"book/:p" : "details"
|
||||
},
|
||||
|
||||
details: function(hash){
|
||||
var view = new Book.Views.Details({model: Library.get(hash)});
|
||||
view.render(function(el){
|
||||
$("#main").html(el);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Instantiate Router
|
||||
var router = new Book.Router();
|
||||
|
||||
// This will fetch the book template and render it.
|
||||
BB.Views.Details = Backbone.View.extend({
|
||||
template: "app/templates/books/details.html",
|
||||
|
||||
render: function(done) {
|
||||
var view = this;
|
||||
|
||||
// Fetch the template, render it to the View element and call done.
|
||||
namespace.fetchTemplate(this.template, function(tmpl) {
|
||||
view.el.innerHTML = tmpl(view.model.toJSON());
|
||||
|
||||
if (_.isFunction(done)) {
|
||||
done(view.el);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -8,9 +8,9 @@
|
|||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
|
||||
<!-- EPUBJS Renderer -->
|
||||
<script src="../build/epub.min.js"></script>
|
||||
<script src="../hooks/extensions/hypothesis.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="basic.css">
|
||||
|
||||
|
@ -49,9 +49,8 @@
|
|||
|
||||
<script>
|
||||
|
||||
Book.renderTo("area").then(function(){
|
||||
Book.renderTo("area");
|
||||
Book.setStyle("padding", "0 300px");
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
10
hooks/extensions/hypothesis.js
Normal file
10
hooks/extensions/hypothesis.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
EPUBJS.Hooks.register("beforeChapterDisplay").hypothesis = function(callback, chapter){
|
||||
|
||||
|
||||
EPUBJS.core.addScript("https://hypothes.is/app/embed.js", null, chapter.doc.head);
|
||||
|
||||
if(callback) callback();
|
||||
|
||||
}
|
||||
|
||||
|
4
libs/backbone/backbone-min.js
vendored
Normal file
4
libs/backbone/backbone-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
libs/backbone/backbone-min.map
Normal file
1
libs/backbone/backbone-min.map
Normal file
File diff suppressed because one or more lines are too long
|
@ -604,12 +604,13 @@ EPUBJS.Book.prototype.fromStorage = function(stored) {
|
|||
*/
|
||||
|
||||
EPUBJS.Book.prototype.setStyle = function(style, val, prefixed) {
|
||||
this.render.setStyle(style, val, prefixed);
|
||||
this.settings.styles[style] = val;
|
||||
|
||||
if(this.render) this.render.setStyle(style, val, prefixed);
|
||||
}
|
||||
|
||||
EPUBJS.Book.prototype.removeStyle = function(style, val, prefixed) {
|
||||
this.render.removeStyle(style);
|
||||
if(this.render) this.render.removeStyle(style);
|
||||
|
||||
delete this.settings.styles[style];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue