diff options
author | Andrew Dolgov <[email protected]> | 2018-07-02 16:22:01 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-07-02 16:22:01 +0300 |
commit | 892259c5821aa83d4b55e81cf38650f1ec5145a4 (patch) | |
tree | 596e0adf2dd3e8e6ae9dc3fc04776d396c6b5359 | |
parent | c49bf9b1e35f320fbc713d48ea6c4881337d835e (diff) |
reinstate location numbers in toc
-rw-r--r-- | read.html | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -573,6 +573,23 @@ }); $('#toc-modal').on('shown.bs.modal', function() { + function toc_loc_msg(href) { + try { + var cfiBase = book.spine.get(href).cfiBase; + + var loc = book.locations._locations.find(function(k) { + return k.indexOf(cfiBase) != -1 + }); + + return window.book.locations.locationFromCfi(loc); + + } catch (e) { + console.warn(e); + } + + return ""; + } + function process_toc_sublist(row, list, nest) { if (nest == 3) return false; @@ -585,7 +602,7 @@ var a = $("<a>") .attr('href', '#') - .html(row.label) + .html("<b class='pull-right'>" + toc_loc_msg(row.href) + "</b>" + row.label) .attr('data-href', row.href) .click(function() { book.rendition.display(a.attr('data-href')); @@ -612,7 +629,7 @@ try { var a = $("<a>") .attr('href', '#') - .html(row.label) + .html("<b class='pull-right'>" + toc_loc_msg(row.href) + "</b>" + row.label) .attr('data-href', row.href) .click(function() { book.rendition.display(a.attr('data-href')); |