mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
Added cfi to toc
This commit is contained in:
parent
6dc9088fb7
commit
d0aea65fc7
9 changed files with 57 additions and 29 deletions
|
@ -5235,7 +5235,8 @@ EPUBJS.Parser.prototype.spine = function(spineXml, manifest){
|
|||
'href' : manifest[Id].href,
|
||||
'url' : manifest[Id].url,
|
||||
'index' : index,
|
||||
'cfiBase' : cfiBase
|
||||
'cfiBase' : cfiBase,
|
||||
'cfi' : "epub(" + cfiBase + ")"
|
||||
};
|
||||
spine.push(vert);
|
||||
});
|
||||
|
@ -5298,12 +5299,14 @@ EPUBJS.Parser.prototype.nav = function(navHtml, spineIndexByURL, bookSpine){
|
|||
baseUrl = split[0],
|
||||
subitems = getTOC(item),
|
||||
spinePos = spineIndexByURL[baseUrl],
|
||||
spineItem;
|
||||
spineItem = bookSpine[spinePos],
|
||||
cfi = spineItem ? spineItem.cfi : '';
|
||||
|
||||
if(!id) {
|
||||
if(spinePos) {
|
||||
spineItem = bookSpine[spinePos];
|
||||
id = spineItem.id;
|
||||
cfi = spineItem.cfi;
|
||||
} else {
|
||||
id = 'epubjs-autogen-toc-id-' + (idCounter++);
|
||||
}
|
||||
|
@ -5315,7 +5318,8 @@ EPUBJS.Parser.prototype.nav = function(navHtml, spineIndexByURL, bookSpine){
|
|||
"href": href,
|
||||
"label": text,
|
||||
"subitems" : subitems,
|
||||
"parent" : parent ? parent.getAttribute('id') : null
|
||||
"parent" : parent ? parent.getAttribute('id') : null,
|
||||
"cfi" : cfi
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -5349,13 +5353,15 @@ EPUBJS.Parser.prototype.toc = function(tocXml, spineIndexByURL, bookSpine){
|
|||
split = src.split("#"),
|
||||
baseUrl = split[0],
|
||||
spinePos = spineIndexByURL[baseUrl],
|
||||
spineItem,
|
||||
subitems = getTOC(item);
|
||||
spineItem = bookSpine[spinePos],
|
||||
subitems = getTOC(item),
|
||||
cfi = spineItem ? spineItem.cfi : '';
|
||||
|
||||
if(!id) {
|
||||
if(spinePos) {
|
||||
spineItem = bookSpine[spinePos];
|
||||
id = spineItem.id;
|
||||
cfi = spineItem.cfi;
|
||||
} else {
|
||||
id = 'epubjs-autogen-toc-id-' + (idCounter++);
|
||||
}
|
||||
|
@ -5368,7 +5374,8 @@ EPUBJS.Parser.prototype.toc = function(tocXml, spineIndexByURL, bookSpine){
|
|||
"label": text,
|
||||
"spinePos": spinePos,
|
||||
"subitems" : subitems,
|
||||
"parent" : parent ? parent.getAttribute('id') : null
|
||||
"parent" : parent ? parent.getAttribute('id') : null,
|
||||
"cfi" : cfi
|
||||
});
|
||||
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
2
build/epub.min.js
vendored
2
build/epub.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -5234,7 +5234,8 @@ EPUBJS.Parser.prototype.spine = function(spineXml, manifest){
|
|||
'href' : manifest[Id].href,
|
||||
'url' : manifest[Id].url,
|
||||
'index' : index,
|
||||
'cfiBase' : cfiBase
|
||||
'cfiBase' : cfiBase,
|
||||
'cfi' : "epub(" + cfiBase + ")"
|
||||
};
|
||||
spine.push(vert);
|
||||
});
|
||||
|
@ -5297,12 +5298,14 @@ EPUBJS.Parser.prototype.nav = function(navHtml, spineIndexByURL, bookSpine){
|
|||
baseUrl = split[0],
|
||||
subitems = getTOC(item),
|
||||
spinePos = spineIndexByURL[baseUrl],
|
||||
spineItem;
|
||||
spineItem = bookSpine[spinePos],
|
||||
cfi = spineItem ? spineItem.cfi : '';
|
||||
|
||||
if(!id) {
|
||||
if(spinePos) {
|
||||
spineItem = bookSpine[spinePos];
|
||||
id = spineItem.id;
|
||||
cfi = spineItem.cfi;
|
||||
} else {
|
||||
id = 'epubjs-autogen-toc-id-' + (idCounter++);
|
||||
}
|
||||
|
@ -5314,7 +5317,8 @@ EPUBJS.Parser.prototype.nav = function(navHtml, spineIndexByURL, bookSpine){
|
|||
"href": href,
|
||||
"label": text,
|
||||
"subitems" : subitems,
|
||||
"parent" : parent ? parent.getAttribute('id') : null
|
||||
"parent" : parent ? parent.getAttribute('id') : null,
|
||||
"cfi" : cfi
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -5348,13 +5352,15 @@ EPUBJS.Parser.prototype.toc = function(tocXml, spineIndexByURL, bookSpine){
|
|||
split = src.split("#"),
|
||||
baseUrl = split[0],
|
||||
spinePos = spineIndexByURL[baseUrl],
|
||||
spineItem,
|
||||
subitems = getTOC(item);
|
||||
spineItem = bookSpine[spinePos],
|
||||
subitems = getTOC(item),
|
||||
cfi = spineItem ? spineItem.cfi : '';
|
||||
|
||||
if(!id) {
|
||||
if(spinePos) {
|
||||
spineItem = bookSpine[spinePos];
|
||||
id = spineItem.id;
|
||||
cfi = spineItem.cfi;
|
||||
} else {
|
||||
id = 'epubjs-autogen-toc-id-' + (idCounter++);
|
||||
}
|
||||
|
@ -5367,7 +5373,8 @@ EPUBJS.Parser.prototype.toc = function(tocXml, spineIndexByURL, bookSpine){
|
|||
"label": text,
|
||||
"spinePos": spinePos,
|
||||
"subitems" : subitems,
|
||||
"parent" : parent ? parent.getAttribute('id') : null
|
||||
"parent" : parent ? parent.getAttribute('id') : null,
|
||||
"cfi" : cfi
|
||||
});
|
||||
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
19
reader/js/epub.min.js
vendored
19
reader/js/epub.min.js
vendored
|
@ -5235,7 +5235,8 @@ EPUBJS.Parser.prototype.spine = function(spineXml, manifest){
|
|||
'href' : manifest[Id].href,
|
||||
'url' : manifest[Id].url,
|
||||
'index' : index,
|
||||
'cfiBase' : cfiBase
|
||||
'cfiBase' : cfiBase,
|
||||
'cfi' : "epub(" + cfiBase + ")"
|
||||
};
|
||||
spine.push(vert);
|
||||
});
|
||||
|
@ -5298,12 +5299,14 @@ EPUBJS.Parser.prototype.nav = function(navHtml, spineIndexByURL, bookSpine){
|
|||
baseUrl = split[0],
|
||||
subitems = getTOC(item),
|
||||
spinePos = spineIndexByURL[baseUrl],
|
||||
spineItem;
|
||||
spineItem = bookSpine[spinePos],
|
||||
cfi = spineItem ? spineItem.cfi : '';
|
||||
|
||||
if(!id) {
|
||||
if(spinePos) {
|
||||
spineItem = bookSpine[spinePos];
|
||||
id = spineItem.id;
|
||||
cfi = spineItem.cfi;
|
||||
} else {
|
||||
id = 'epubjs-autogen-toc-id-' + (idCounter++);
|
||||
}
|
||||
|
@ -5315,7 +5318,8 @@ EPUBJS.Parser.prototype.nav = function(navHtml, spineIndexByURL, bookSpine){
|
|||
"href": href,
|
||||
"label": text,
|
||||
"subitems" : subitems,
|
||||
"parent" : parent ? parent.getAttribute('id') : null
|
||||
"parent" : parent ? parent.getAttribute('id') : null,
|
||||
"cfi" : cfi
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -5349,13 +5353,15 @@ EPUBJS.Parser.prototype.toc = function(tocXml, spineIndexByURL, bookSpine){
|
|||
split = src.split("#"),
|
||||
baseUrl = split[0],
|
||||
spinePos = spineIndexByURL[baseUrl],
|
||||
spineItem,
|
||||
subitems = getTOC(item);
|
||||
spineItem = bookSpine[spinePos],
|
||||
subitems = getTOC(item),
|
||||
cfi = spineItem ? spineItem.cfi : '';
|
||||
|
||||
if(!id) {
|
||||
if(spinePos) {
|
||||
spineItem = bookSpine[spinePos];
|
||||
id = spineItem.id;
|
||||
cfi = spineItem.cfi;
|
||||
} else {
|
||||
id = 'epubjs-autogen-toc-id-' + (idCounter++);
|
||||
}
|
||||
|
@ -5368,7 +5374,8 @@ EPUBJS.Parser.prototype.toc = function(tocXml, spineIndexByURL, bookSpine){
|
|||
"label": text,
|
||||
"spinePos": spinePos,
|
||||
"subitems" : subitems,
|
||||
"parent" : parent ? parent.getAttribute('id') : null
|
||||
"parent" : parent ? parent.getAttribute('id') : null,
|
||||
"cfi" : cfi
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -231,7 +231,8 @@ EPUBJS.Parser.prototype.spine = function(spineXml, manifest){
|
|||
'href' : manifest[Id].href,
|
||||
'url' : manifest[Id].url,
|
||||
'index' : index,
|
||||
'cfiBase' : cfiBase
|
||||
'cfiBase' : cfiBase,
|
||||
'cfi' : "epub(" + cfiBase + ")"
|
||||
};
|
||||
spine.push(vert);
|
||||
});
|
||||
|
@ -294,12 +295,14 @@ EPUBJS.Parser.prototype.nav = function(navHtml, spineIndexByURL, bookSpine){
|
|||
baseUrl = split[0],
|
||||
subitems = getTOC(item),
|
||||
spinePos = spineIndexByURL[baseUrl],
|
||||
spineItem;
|
||||
spineItem = bookSpine[spinePos],
|
||||
cfi = spineItem ? spineItem.cfi : '';
|
||||
|
||||
if(!id) {
|
||||
if(spinePos) {
|
||||
spineItem = bookSpine[spinePos];
|
||||
id = spineItem.id;
|
||||
cfi = spineItem.cfi;
|
||||
} else {
|
||||
id = 'epubjs-autogen-toc-id-' + (idCounter++);
|
||||
}
|
||||
|
@ -311,7 +314,8 @@ EPUBJS.Parser.prototype.nav = function(navHtml, spineIndexByURL, bookSpine){
|
|||
"href": href,
|
||||
"label": text,
|
||||
"subitems" : subitems,
|
||||
"parent" : parent ? parent.getAttribute('id') : null
|
||||
"parent" : parent ? parent.getAttribute('id') : null,
|
||||
"cfi" : cfi
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -345,13 +349,15 @@ EPUBJS.Parser.prototype.toc = function(tocXml, spineIndexByURL, bookSpine){
|
|||
split = src.split("#"),
|
||||
baseUrl = split[0],
|
||||
spinePos = spineIndexByURL[baseUrl],
|
||||
spineItem,
|
||||
subitems = getTOC(item);
|
||||
spineItem = bookSpine[spinePos],
|
||||
subitems = getTOC(item),
|
||||
cfi = spineItem ? spineItem.cfi : '';
|
||||
|
||||
if(!id) {
|
||||
if(spinePos) {
|
||||
spineItem = bookSpine[spinePos];
|
||||
id = spineItem.id;
|
||||
cfi = spineItem.cfi;
|
||||
} else {
|
||||
id = 'epubjs-autogen-toc-id-' + (idCounter++);
|
||||
}
|
||||
|
@ -364,7 +370,8 @@ EPUBJS.Parser.prototype.toc = function(tocXml, spineIndexByURL, bookSpine){
|
|||
"label": text,
|
||||
"spinePos": spinePos,
|
||||
"subitems" : subitems,
|
||||
"parent" : parent ? parent.getAttribute('id') : null
|
||||
"parent" : parent ? parent.getAttribute('id') : null,
|
||||
"cfi" : cfi
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue