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

Merge pull request #323 from bit/patches

fix loading .htm files and relative links if epub.js is not at /
This commit is contained in:
Fred Chasen 2015-12-02 21:11:53 -05:00
commit 0884a0aa8c
2 changed files with 8 additions and 2 deletions

View file

@ -1019,8 +1019,11 @@ EPUBJS.Book.prototype.gotoHref = function(url, defer){
split = url.split("#"); split = url.split("#");
chapter = split[0]; chapter = split[0];
section = split[1] || false; section = split[1] || false;
// absoluteURL = (chapter.search("://") === -1) ? (this.settings.contentsPath + chapter) : chapter; if (chapter.search("://") == -1) {
relativeURL = chapter.replace(this.settings.contentsPath, ''); relativeURL = chapter.replace(EPUBJS.core.uri(this.settings.contentsPath).path, '');
} else {
relativeURL = chapter.replace(this.settings.contentsPath, '');
}
spinePos = this.spineIndexByURL[relativeURL]; spinePos = this.spineIndexByURL[relativeURL];
//-- If link fragment only stay on current chapter //-- If link fragment only stay on current chapter

View file

@ -93,6 +93,9 @@ EPUBJS.core.request = function(url, type, withCredentials) {
if(!type) { if(!type) {
uri = EPUBJS.core.uri(url); uri = EPUBJS.core.uri(url);
type = uri.extension; type = uri.extension;
type = {
'htm': 'html'
}[type] || type;
} }
if(type == 'blob'){ if(type == 'blob'){