mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-05 15:32:55 +02:00
Backbone example clean up
This commit is contained in:
parent
a2a179d98b
commit
2639fbd273
1 changed files with 33 additions and 48 deletions
|
@ -30,12 +30,11 @@
|
|||
</head>
|
||||
<body>
|
||||
<div id="main">
|
||||
|
||||
<div id="loader"><img src="../reader/img/loader.gif"></div>
|
||||
<select id="toc"></select>
|
||||
</div>
|
||||
|
||||
<script type="text/template" id="abcdef">
|
||||
<script type="text/template" id="test-template">
|
||||
<div id="prev" class="arrow">‹</div>
|
||||
<div id="area"></div>
|
||||
<div id="next" class="arrow">›</div>
|
||||
|
@ -104,7 +103,11 @@
|
|||
BB.Views = {};
|
||||
|
||||
EPUBJS.Hooks.register("beforeChapterDisplay").transculsions = function(callback, renderer){
|
||||
console.log('test');
|
||||
$(renderer.element).contents().find('body').bind('mouseup', function(){
|
||||
|
||||
var selection = $('iframe').contents()[0].getSelection().toString();
|
||||
debugger;
|
||||
});
|
||||
callback();
|
||||
};
|
||||
|
||||
|
@ -113,60 +116,42 @@
|
|||
|
||||
el: '#main',
|
||||
|
||||
book: ePub("/reader/moby-dick.epub", { restore: true }),
|
||||
|
||||
model: Library,
|
||||
|
||||
book: null,
|
||||
|
||||
events: {
|
||||
'click #next': 'nextPage',
|
||||
'click #prev': 'previousPage'
|
||||
},
|
||||
|
||||
template: _.template( $('#abcdef').html() ),
|
||||
template: _.template( $('#test-template').html() ),
|
||||
|
||||
//eventually pass book url as a param to initialize
|
||||
initialize: function() {
|
||||
this.area = $('<div></div>');
|
||||
|
||||
this.book.renderTo(this.area[0]).then(function(){
|
||||
// view.bindIframe();
|
||||
});
|
||||
this.area = $('<div style="height:100%;"></div>');
|
||||
|
||||
this.book = ePub("/reader/moby-dick.epub", { restore: true });
|
||||
|
||||
this.book.renderTo(this.area[0]);
|
||||
},
|
||||
|
||||
render: function(done) {
|
||||
var view = this;
|
||||
|
||||
render: function() {
|
||||
this.$el.html(this.template());
|
||||
|
||||
this.$('#area').html(this.area);
|
||||
|
||||
this.bindIframe();
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
bindIframe: function(){
|
||||
$('#area iframe').contents().find('body').bind('mouseup', function(){
|
||||
|
||||
var selection = $('iframe').contents()[0].getSelection().toString();
|
||||
debugger;
|
||||
});
|
||||
},
|
||||
|
||||
nextPage: function(e){
|
||||
var view = this;
|
||||
e.preventDefault();
|
||||
|
||||
this.book.nextPage().then(function(){
|
||||
// view.bindIframe();
|
||||
})
|
||||
this.book.nextPage();
|
||||
},
|
||||
|
||||
previousPage: function(e){
|
||||
e.preventDefault();
|
||||
|
||||
this.book.prevPage()
|
||||
this.book.prevPage();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue