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

built latest

This commit is contained in:
Fred Chasen 2013-07-14 16:25:27 -07:00
parent 47df4dcd02
commit edb7a38e59
2 changed files with 42 additions and 27 deletions

View file

@ -21,7 +21,7 @@ EPUBJS.Book = function(bookPath, options){
height: false,
spreads: true,
responsive: true,
version: 1.1,
version: 1,
restore: true
});
@ -167,7 +167,6 @@ EPUBJS.Book.prototype.unpack = function(containerPath){
then(function(contents){
book.contents = contents;
book.manifest = book.contents.manifest;
book.spine = book.contents.spine;
book.spineIndexByURL = book.contents.spineIndexByURL;
@ -897,6 +896,8 @@ EPUBJS.core.folder = function(url){
var slash = url.lastIndexOf('/'),
folder = url.slice(0, slash + 1);
if(slash == -1) folder = '';
return folder;
};
@ -1350,43 +1351,52 @@ EPUBJS.Parser.prototype.metadata = function(xml){
p = this;
metadata.bookTitle = p.getElement(xml, 'title');
metadata.creator = p.getElement(xml, 'creator');
metadata.description = p.getElement(xml, 'description');
metadata.bookTitle = p.getElementText(xml, 'title');
metadata.creator = p.getElementText(xml, 'creator');
metadata.description = p.getElementText(xml, 'description');
metadata.pubdate = p.getElement(xml, 'date');
metadata.pubdate = p.getElementText(xml, 'date');
metadata.publisher = p.getElement(xml, 'publisher');
metadata.publisher = p.getElementText(xml, 'publisher');
metadata.identifier = p.getElement(xml, "identifier");
metadata.language = p.getElement(xml, "language");
metadata.rights = p.getElement(xml, "rights");
metadata.identifier = p.getElementText(xml, "identifier");
metadata.language = p.getElementText(xml, "language");
metadata.rights = p.getElementText(xml, "rights");
metadata.modified_date = p.querySelector(xml, "meta[property='dcterms:modified']");
metadata.layout = p.querySelector(xml, "meta[property='rendition:orientation']");
metadata.orientation = p.querySelector(xml, "meta[property='rendition:orientation']");
metadata.spread = p.querySelector(xml, "meta[property='rendition:spread']");
metadata.modified_date = p.querySelectorText(xml, "meta[property='dcterms:modified']");
metadata.layout = p.querySelectorText(xml, "meta[property='rendition:orientation']");
metadata.orientation = p.querySelectorText(xml, "meta[property='rendition:orientation']");
metadata.spread = p.querySelectorText(xml, "meta[property='rendition:spread']");
// metadata.page_prog_dir = packageXml.querySelector("spine").getAttribute("page-progression-direction");
return metadata;
}
EPUBJS.Parser.prototype.getElement = function(xml, tag){
var find = xml.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/", tag),
EPUBJS.Parser.prototype.getElementText = function(xml, tag){
var found = xml.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/", tag),
el;
if(!find) return '';
if(!found || found.length == 0) return '';
el = find[0];
el = found[0];
if(el.childNodes.length){
return el.childNodes[0].nodeValue;
}
return '';
return el ? el.childNodes[0].nodeValue : '';
}
EPUBJS.Parser.prototype.querySelector = function(xml, q){
EPUBJS.Parser.prototype.querySelectorText = function(xml, q){
var el = xml.querySelector(q);
return el ? el.childNodes[0].nodeValue : '';
if(el && el.childNodes.length){
return el.childNodes[0].nodeValue;
}
return '';
}
@ -2010,6 +2020,11 @@ EPUBJS.Renderer.prototype.replaceUrlsInCss = function(base, text){
store = this.determineStore(),
matches = text.match(/url\(\'?\"?([^\'|^\"]*)\'?\"?\)/g);
if(!matches){
promise.resolve(text);
return promise;
}
matches.forEach(function(str){
var full = EPUBJS.core.resolveUrl(base, str.replace(/url\(|[|\)|\'|\"]/g, ''));
replaced = store.getUrl(full).then(function(url){

4
demo/js/epub.min.js vendored

File diff suppressed because one or more lines are too long