]> _ Git - fluidbook-html5.git/commitdiff
done #1545 @0.5
authorVincent <vincent@cubedesigners.com>
Wed, 5 Jul 2017 15:55:02 +0000 (17:55 +0200)
committerVincent <vincent@cubedesigners.com>
Wed, 5 Jul 2017 15:55:02 +0000 (17:55 +0200)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/menu/fluidbook.chapters.js

index 3b199518e3d2307de208264b1d522dd27a585934..10d8cf9e8d6754e83748f7d3a7d4dd328c198a8c 100644 (file)
@@ -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) {
index 05a8635a2948a17ad24923d72847f3ee73ece7b9..f470cafcd2d633bd3df6df641a59a7314bbadc6a 100644 (file)
@@ -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 += '<li data-level="' + chapter.level + '"><a href="#/page/' + p + '" class="level' + chapter.level + '">';
+            res += '<li data-level="' + chapter.level + '"><a ' + href + ' class="level' + chapter.level + '">';
         } else if (this.style == 'ina') {
-            res += '<li style="background-color:#' + color + ';" data-level="' + chapter.level + '"><a href="#/page/' + p + '" class="nodark level' + chapter.level + '">';
+            res += '<li style="background-color:#' + color + ';" data-level="' + chapter.level + '"><a ' + href + ' class="nodark level' + chapter.level + '">';
         }
         res += '<span>' + chapter.label + '</span>';
-        res += '<div class="right" data-page="' + p + '">';
+        if (href != 'nohref') {
+            res += '<div class="right" data-page="' + p + '">';
 
-        if (this.style == 'classic') {
-            if (color == '') {
+            if (this.style == 'classic') {
+                if (color == '') {
+                    if (chapter.page != '') {
+                        res += '<span class="pagen">' + chapter.page + '</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>';
                 }
-            } else {
-                res += '<div class="puce" style="background-color:#' + color + ';">' + getSpriteIcon('interface-chevron') + '</div>';
-            }
-        } else {
-            if (chapter.page != '') {
-                res += '<span class="pagen">' + chapter.page + '</span>';
+                res += '<div class="puce noshadow"></div>';
             }
-            res += '<div class="puce noshadow"></div>';
+            res += '</div>';
         }
-        res += '</div>'
         res += '</a></li>';
 
         return res;