]> _ Git - fluidbook-html5.git/commitdiff
wip #5416 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 25 Aug 2022 09:35:58 +0000 (11:35 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 25 Aug 2022 09:35:58 +0000 (11:35 +0200)
js/libs/fluidbook/menu/fluidbook.chapters.js

index dc17097aa803a867ca0d003d67ca9b86c57961fb..32b17614c744d6b33f7e6517efeb5376c67518ac 100644 (file)
@@ -24,14 +24,12 @@ FluidbookChapters.prototype = {
         }
 
         return {sub: sub, view: this.html[sub], title: this.titles[sub], color: this.colors[sub]};
-    },
-    makeView: function (sub) {
+    }, makeView: function (sub) {
         this.makeClassicMenu(sub);
         if (this.cascade) {
             this.makeCascadeMenu(sub);
         }
-    },
-    makeCascadeMenu: function (sub) {
+    }, makeCascadeMenu: function (sub) {
         var h = $(this.html[sub]);
 
         for (var i = 3; i >= 0; i--) {
@@ -112,7 +110,10 @@ FluidbookChapters.prototype = {
             var vu = false;
             var level;
             $.each(this.chapters, function (k, v) {
-                if (v.label === '--' || v.label === '++') {
+                if (v.decoration === undefined) {
+                    v.decoration = '';
+                }
+                if (v.decoration === 'nocut' || v.decoration === 'forcecut' || v.label === '--' || v.label === '++') {
 
                 } else {
                     nbItems++;
@@ -146,13 +147,13 @@ FluidbookChapters.prototype = {
         this.html[sub] = '<ul class="' + classes.join(' ') + '">';
         $.each(base, function (k, v) {
             if (!forgetCut) {
-                forgetCut = v.label.indexOf('++') === 0;
+                forgetCut = v.decoration === 'nocut' || v.label.indexOf('++') === 0;
                 if (forgetCut) {
                     return;
                 }
             }
-            forceCut = v.label.indexOf('--') === 0 || v.label.indexOf('!!!') === 0;
-            ignore = forceCut || v.label.indexOf('++') === 0;
+            forceCut = v.decoration === 'forcecut' || v.decoration === 'column_head' || v.decoration === 'separator' || v.label.indexOf('--') === 0 || v.label.indexOf('!!!') === 0;
+            ignore = forceCut || v.decoration === 'nocut' || v.label.indexOf('++') === 0;
 
             // Next column
             if (!forgetCut && ((columnId + 1) < columns && ((columns > 1 && v.level === 0 && i > (perCol * 0.8)) || (forceCut && i > 0)))) {
@@ -175,12 +176,11 @@ FluidbookChapters.prototype = {
             this.html[sub] += '<div class="column">' + columnsContainers[j].join('') + '</div>';
         }
         this.html[sub] += '</ul>';
-    },
-    addItem: function (chapter, baseLevel) {
+    }, addItem: function (chapter, baseLevel) {
         if (baseLevel == undefined) {
             baseLevel = 0;
         }
-        if (chapter.label == '----') {
+        if (chapter.decoration === 'separator' || chapter.label === '----') {
             return '<li class="separator"></li>';
         }
         var color = chapter.color;
@@ -193,8 +193,8 @@ FluidbookChapters.prototype = {
             this.lastColor = color;
         }
 
-        if (chapter.label.substr(0, 3) == '!!!') {
-            chapter.label = chapter.label.substring(3);
+        if (chapter.decoration === 'column_head' || chapter.label.substr(0, 3) == '!!!') {
+            chapter.label = chapter.decoration === 'column_head' ? chapter.label : chapter.label.substring(3);
             chapter.level = '-1';
         }