diff --git a/examples/backbone.html b/examples/backbone.html index 94aa354..e2a2d16 100644 --- a/examples/backbone.html +++ b/examples/backbone.html @@ -1,117 +1,157 @@ - - - - ePubJS Promises Example - - - + + + + ePubJS Promises Example + + + - + - - + + + - - + - - - -
- -
- -
- -
+ + + - - // Book.getToc().then(function(toc){ + - + // Instantiate Router + var router = new BB.Router(); + + BB.Views = {}; + + EPUBJS.Hooks.register("beforeChapterDisplay").transculsions = function(callback, renderer){ + $(renderer.element).contents().find('body').bind('mouseup', function(){ + + var selection = $('iframe').contents()[0].getSelection().toString(); + debugger; + }); + callback(); + }; + + // This will fetch the book template and render it. + BB.Views.Details = Backbone.View.extend({ + + el: '#main', + + model: Library, + + book: null, + + events: { + 'click #next': 'nextPage', + 'click #prev': 'previousPage' + }, + + template: _.template( $('#test-template').html() ), + + //eventually pass book url as a param to initialize + initialize: function() { + this.area = $('
'); + + this.book = ePub("../reader/moby-dick.epub", { restore: true }); + + this.book.renderTo(this.area[0]); + }, + + render: function() { + this.$el.html(this.template()); + + this.$('#area').html(this.area); + + return this; + }, + + nextPage: function(e){ + e.preventDefault(); + this.book.nextPage(); + }, + + previousPage: function(e){ + e.preventDefault(); + this.book.prevPage(); + } + }); + + var view = new BB.Views.Details(); + + view.render(); + + +