]> _ Git - fluidbook-html5.git/commitdiff
fix #2163 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 26 Jul 2018 13:10:36 +0000 (15:10 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 26 Jul 2018 13:10:36 +0000 (15:10 +0200)
js/libs/fluidbook/menu/fluidbook.chapters.js

index bbc8d5f21eb91b83052504befd10952afa8f5a77..dc494f4bebf8fffd7de79b6d51a576003dce9a37 100644 (file)
@@ -145,10 +145,17 @@ FluidbookChapters.prototype = {
         var level = chapter.level - baseLevel;
 
         var p = '';
+        var pdisplay = '';
         if (chapter.page != '') {
-            p = this.fluidbook.virtualToPhysical(chapter.page);
+            if (this.fluidbook.datas.chaptersPageNumber == 'virtual') {
+                p = this.fluidbook.virtualToPhysical(chapter.page);
+                pdisplay = chapter.page;
+            } else {
+                p = chapter.page;
+                pdisplay = this.fluidbook.physicalToVirtual(p);
+            }
             if (p === false) {
-                p='';
+                p = '';
                 href = this.cascade ? 'href="#"' : "nohref";
             } else {
                 href = 'href="#/page/' + p + '"';
@@ -168,14 +175,14 @@ FluidbookChapters.prototype = {
             if (this.style == 'classic') {
                 if (color == '') {
                     if (chapter.page != '') {
-                        res += '<span class="pagen">' + chapter.page + '</span>';
+                        res += '<span class="pagen">' + pdisplay + '</span>';
                     }
                 } else {
                     res += '<div class="puce" style="background-color:#' + color + ';">' + getSpriteIcon('interface-chevron') + '</div>';
                 }
             } else {
-                if (chapter.page != '') {
-                    res += '<span class="pagen">' + chapter.page + '</span>';
+                if (pdisplay != '') {
+                    res += '<span class="pagen">' + pdisplay + '</span>';
                 }
                 res += '<div class="puce noshadow"></div>';
             }
@@ -199,7 +206,7 @@ FluidbookChapters.prototype = {
             }
         });
 
-        for(var i=0;i<=10;i++) {
+        for (var i = 0; i <= 10; i++) {
             $('.mview[data-menu="chapters"] ul.chapters li[data-page=""]').each(function () {
                 if ($(this).find('ul li').length == 0) {
                     $(this).remove();