From fab489cdaf178c56f3b0673bf8a05e59a640bcbc Mon Sep 17 00:00:00 2001 From: Vincent Date: Wed, 5 Jul 2017 17:55:02 +0200 Subject: [PATCH] done #1545 @0.5 --- js/libs/fluidbook/fluidbook.js | 6 ++- js/libs/fluidbook/menu/fluidbook.chapters.js | 41 +++++++++++++------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index 3b199518..10d8cf9e 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -710,7 +710,11 @@ Fluidbook.prototype = { return this.datas.numerotation[page - 1]; }, virtualToPhysical: function (page) { - return this.datas.numerotation.indexOf(page) + 1; + var i=this.datas.numerotation.indexOf(page); + if(i==-1){ + return false; + } + return i + 1; }, getSearchHints: function (q) { diff --git a/js/libs/fluidbook/menu/fluidbook.chapters.js b/js/libs/fluidbook/menu/fluidbook.chapters.js index 05a8635a..f470cafc 100644 --- a/js/libs/fluidbook/menu/fluidbook.chapters.js +++ b/js/libs/fluidbook/menu/fluidbook.chapters.js @@ -89,32 +89,45 @@ FluidbookChapters.prototype = { chapter.level = '-1'; } - var p = (this.fluidbook.virtualToPhysical(chapter.page)); var res = ''; + var href; + + if (chapter.page != '') { + var p = this.fluidbook.virtualToPhysical(chapter.page); + if (p === false) { + href = "nohref"; + } else { + href = 'href="#/page/' + p + '"'; + } + } else { + href = "nohref"; + } if (this.style == 'classic') { - res += '
  • '; + res += '
  • '; } else if (this.style == 'ina') { - res += '
  • '; + res += '
  • '; } res += '' + chapter.label + ''; - res += '
    '; + if (href != 'nohref') { + res += '
    '; - if (this.style == 'classic') { - if (color == '') { + if (this.style == 'classic') { + if (color == '') { + if (chapter.page != '') { + res += '' + chapter.page + ''; + } + } else { + res += '
    ' + getSpriteIcon('interface-chevron') + '
    '; + } + } else { if (chapter.page != '') { res += '' + chapter.page + ''; } - } else { - res += '
    ' + getSpriteIcon('interface-chevron') + '
    '; - } - } else { - if (chapter.page != '') { - res += '' + chapter.page + ''; + res += '
    '; } - res += '
    '; + res += '
    '; } - res += '
    ' res += '
  • '; return res; -- 2.39.5