]> _ Git - fluidbook-html5.git/commitdiff
done #1934 @6
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 7 Feb 2018 14:30:05 +0000 (15:30 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 7 Feb 2018 14:30:05 +0000 (15:30 +0100)
js/libs/fluidbook/fluidbook.bookmarks.js
js/libs/fluidbook/fluidbook.links.js
js/libs/fluidbook/fluidbook.menu.js
js/libs/fluidbook/fluidbook.nav.js
style/nav-horizontal.less

index f9cf8c91aec2f1f973178bafa2369a47355fb788..9375291ef589747e4fda983fbcd2e176cf37bdf4 100644 (file)
@@ -364,12 +364,15 @@ FluidbookBookmarks.prototype = {
         }
         return bookmarks;
     },
-    getView: function () {
-        var c = this.getIndex(false);
+    getView: function (title, downloadLabel) {
+        var c = this.getIndex(false, false, downloadLabel);
         if (c === false) {
             return c;
         }
-        var index = '<div class="bookmarkssub"><div class="caption">' + this.fluidbook.menu.closeButton() + '<h2>' + this.fluidbook.l10n.__('bookmarks') + '</h2>';
+        if(title==''){
+            title=this.fluidbook.l10n.__('bookmarks');
+        }
+        var index = '<div class="bookmarkssub"><div class="caption">' + this.fluidbook.menu.closeButton() + '<h2>' + title + '</h2>';
         index += '</div>';
         index += c;
         index += '</div>';
@@ -391,7 +394,7 @@ FluidbookBookmarks.prototype = {
         }
         return true;
     },
-    getIndex: function (all, onlyGroup) {
+    getIndex: function (all, onlyGroup, downloadLabel) {
         if (all == undefined) {
             all = false;
         }
@@ -407,9 +410,13 @@ FluidbookBookmarks.prototype = {
             return false;
         }
 
+        if (downloadLabel == '') {
+            downloadLabel = this.fluidbook.l10n.__('download');
+        }
+
         var index = '<div class="content"><div id="indexView" class="bookmarkView">';
 
-        if (onlyGroup == undefined) {
+        if (onlyGroup == undefined || !onlyGroup) {
             for (var g = 0; g < groups.length; g++) {
                 var group = groups[g];
                 var pages = [];
@@ -451,7 +458,7 @@ FluidbookBookmarks.prototype = {
 
         }
         if (this.fluidbook.datas.print || this.fluidbook.datas.pdf) {
-            index += '<a class="print" href="#">' + this.fluidbook.l10n.__('download') + '</a>';
+            index += '<a class="print" href="#">' + downloadLabel + '</a>';
         }
         index += '</div>';
         index += '</div>';
index e5a78cf185bbeb8a3f01157f8a13360c06cfabcd..09eea1781a9f26f8d5ad69e3236486484fe8a16f 100644 (file)
@@ -92,12 +92,16 @@ FluidbookLinks.prototype = {
             }
 
             if (action == 'chapters' && extra) {
-                window.location.hash='#/chapters/'+extra;
+                window.location.hash = '#/chapters/' + extra;
                 return false;
             }
 
             var navitem = $("#horizontalNav_" + action);
+
             if (navitem.length > 0) {
+                if ($(this).data('extra') != null) {
+                    $(navitem).data('extra', $(this).data('extra'));
+                }
                 $(navitem).get(0).click();
             }
 
index f4ebf51c0ca7b8f1f796033c4061e4423cf52f0b..ca3a37e2b8b7e71b8231792c07cb86fe19c91453 100644 (file)
@@ -64,10 +64,13 @@ FluidbookMenu.prototype = {
         }
     },
     __openView: function (view, param1, param2, callback) {
-        //console.log('__openView(' + view + ',' + param1 + ',' + param2 + ')');
 
-        param1 = decodeURIComponent(param1);
-        param2 = decodeURIComponent(param2);
+        if (typeof param1 === 'string') {
+            param1 = decodeURIComponent(param1);
+        }
+        if (typeof param2 === 'string') {
+            param2 = decodeURIComponent(param2);
+        }
 
         var $this = this;
         var camelView = view.charAt(0).toUpperCase() + view.substr(1);
@@ -256,7 +259,27 @@ FluidbookMenu.prototype = {
         this.fluidbook.share.openShare(p1, p2, callback);
     },
     openBookmark: function (p1, p2, callback) {
-        var view = this.fluidbook.bookmarks.getView();
+        console.log('!!' + JSON.stringify(p1));
+        var title = '';
+        var downloadLabel = '';
+        try {
+            title = p1.title;
+        } catch (e) {
+
+        }
+        try {
+            downloadLabel = p1.downloadLabel;
+        } catch (e) {
+
+        }
+        if (title == undefined) {
+            title = '';
+        }
+        if (downloadLabel == undefined) {
+            downloadLabel = '';
+        }
+
+        var view = this.fluidbook.bookmarks.getView(title, downloadLabel);
         if (view !== false) {
             $("#view").append('<div class="mview" data-menu="bookmarks">' + view + '</div>');
             if (callback != undefined) {
index d3714187f8d99e149f5511d8a01ef285df58f615..ae66938ce2ae6d869bf178649d9dca18b5ac3747 100644 (file)
@@ -314,11 +314,17 @@ FluidbookNav.prototype = {
             navOrder.push(navOrder.splice(localeIconIndex, 1)[0]); // Push to end of array
         }
 
+        var hide = array_diff(all, navOrder);
+        var thisall = navOrder.concat(hide);
+
         var $this = this;
 
-        for (var i in navOrder) {
-            var icon = navOrder[i];
-            //var visible = hide.indexOf(icon) == -1;
+        for (var i in thisall) {
+            var icon = thisall[i];
+            var visible = hide.indexOf(icon) == -1;
+            if (!visible && navType == 'menu') {
+                continue;
+            }
             var link = null;
             var link2 = null;
 
@@ -534,15 +540,16 @@ FluidbookNav.prototype = {
 
                     link = $(link).get(0).outerHTML;
                 }
-
-
                 var nav = this.getNavFromType(navType);
                 nav.find('ul').append('<li>' + link + '</li>');
             }
 
-            // if (!visible) {
-            //     $(link).addClass('hidden');
-            // }
+            if (!visible) {
+                $(link).addClass('hidden');
+                if (link2) {
+                    $(link2).addClass('hidden');
+                }
+            }
         }
 
         if (navType == 'menu') {
@@ -642,7 +649,7 @@ FluidbookNav.prototype = {
         // Share icon
         $(document).on('click', '.icon-share', function () {
             if ($this.fluidbook.datas.phonegap != 'android') {
-                return true;
+                return true;0
             }
             $this.fluidbook.share.intentShare();
             return false;
@@ -672,6 +679,11 @@ FluidbookNav.prototype = {
                 }
                 return false;
             }
+            if ($(this).data('extra') != null) {
+                $this.fluidbook.menu.openView('bookmark', $(this).data('extra'), null, function () {
+                });
+                return false;
+            }
         });
 
         // Zoom In icon
index 8e8ef424dd47b4dece2857f2a84c171bb0a1330b..20b9e0a5e46424eddf792620c60019d6b53fed0b 100644 (file)
                .help & {
                        color: #ccc;
                }
+               &.hidden {
+                       display: none !important;
+                       opacity: 0;
+                       width: 0;
+                       height: 0;
+                       visibility: hidden;
+                       margin: 0;
+                       padding: 0;
+               }
        }
 
        img, .svg-icon {
                height: 25px;
                width: auto;
-               .msie &{
+               .msie & {
                        width: 25px;
                }