1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-03 14:59:18 +02:00

Added locations

This commit is contained in:
fchasen 2015-07-08 21:54:00 -04:00
parent d7371a619d
commit 80787fc86b
10 changed files with 648 additions and 125 deletions

View file

@ -7,7 +7,7 @@ EPUBJS.Section = function(item){
this.url = item.url;
this.next = item.next;
this.prev = item.prev;
this.epubcfi = new EPUBJS.EpubCFI();
this.cfiBase = item.cfiBase;
@ -44,7 +44,7 @@ EPUBJS.Section.prototype.load = function(_request){
loading.reject(error);
});
}
return loaded;
};
@ -64,7 +64,7 @@ EPUBJS.Section.prototype.replacements = function(_document){
} else {
task.reject(new Error("No head to insert into"));
}
return task.promise;
};
@ -76,7 +76,7 @@ EPUBJS.Section.prototype.beforeSectionLoad = function(){
EPUBJS.Section.prototype.render = function(_request){
var rendering = new RSVP.defer();
var rendered = rendering.promise;
this.load(_request).then(function(contents){
var serializer = new XMLSerializer();
var output = serializer.serializeToString(contents);
@ -125,4 +125,8 @@ EPUBJS.Section.prototype.reconcileLayoutSettings = function(global){
EPUBJS.Section.prototype.cfiFromRange = function(_range) {
return this.epubcfi.generateCfiFromRange(_range, this.cfiBase);
};
};
EPUBJS.Section.prototype.cfiFromElement = function(el) {
return this.epubcfi.generateCfiFromElement(el, this.cfiBase);
};