1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-05 15:32:55 +02:00

added url routes

This commit is contained in:
fchasen 2014-02-18 09:47:10 -08:00
parent 8884638852
commit ed82dfe736
12 changed files with 89 additions and 43 deletions

View file

@ -2127,7 +2127,8 @@ EPUBJS.Book.prototype.generatePageList = function(width, height){
chapter = new EPUBJS.Chapter(this.spine[spinePos], this.store);
pager.displayChapter(chapter, this.globalLayoutProperties).then(function(chap){
var nextPage = true;//pager.nextPage();
var nextPage = true;
// Page though the entire chapter
while (nextPage) {
nextPage = pager.nextPage();
@ -2573,12 +2574,12 @@ EPUBJS.Book.prototype.getCurrentLocationCfi = function() {
EPUBJS.Book.prototype.goto = function(target){
if(typeof target === "number"){
return this.gotoPage(target);
} else if(target.indexOf("epubcfi(") === 0) {
if(target.indexOf("epubcfi(") === 0) {
return this.gotoCfi(target);
} else if(target.indexOf("%") === target.length-1) {
return this.gotoPercentage(parseInt(target.substring(0, target.length-1)));
return this.gotoPercentage(parseInt(target.substring(0, target.length-1))/100);
} else if(typeof target === "number" || isNaN(target) === false){
return this.gotoPage(target);
} else {
return this.gotoHref(target);
}
@ -2674,14 +2675,14 @@ EPUBJS.Book.prototype.gotoHref = function(url, defer){
//-- Load new chapter if different than current
return this.displayChapter(spinePos).then(function(){
if(section){
this.render.section(section);
this.renderer.section(section);
}
deferred.resolve(this.renderer.currentLocationCfi);
}.bind(this));
}else{
//-- Only goto section
if(section) {
this.render.section(section);
this.renderer.section(section);
}
deferred.resolve(this.renderer.currentLocationCfi);
}
@ -2700,7 +2701,7 @@ EPUBJS.Book.prototype.gotoPage = function(pg){
EPUBJS.Book.prototype.gotoPercentage = function(percent){
var pg = this.pagination.pageFromPercentage(percent);
return this.gotoCfi(pg);
return this.gotoPage(pg);
};
EPUBJS.Book.prototype.preloadNextChapter = function() {
@ -4529,6 +4530,7 @@ EPUBJS.Parser.prototype.pageList = function(navHtml, spineIndexByURL, bookSpine)
content = findAnchorOrSpan(item),
href = content.getAttribute('href') || '',
text = content.textContent || "",
page = parseInt(text),
isCfi = href.indexOf("epubcfi"),
split,
packageUrl,
@ -4542,12 +4544,12 @@ EPUBJS.Parser.prototype.pageList = function(navHtml, spineIndexByURL, bookSpine)
"cfi" : cfi,
"href" : href,
"packageUrl" : packageUrl,
"page" : text
"page" : page
});
} else {
list.push({
"href" : href,
"page" : text
"page" : page
});
}
@ -5040,7 +5042,7 @@ EPUBJS.Renderer.prototype.reformat = function(){
};
// Hide and show the render's container element.
// Hide and show the render's container .
EPUBJS.Renderer.prototype.visible = function(bool){
if(typeof(bool) === "undefined") {
return this.container.style.visibility;