]> _ Git - fluidbook-html5.git/commitdiff
#1762
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 18 Dec 2017 17:47:58 +0000 (18:47 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 18 Dec 2017 17:47:58 +0000 (18:47 +0100)
js/libs/fluidbook/fluidbook.nav.js
js/libs/fluidbook/fluidbook.resize.js

index c342874fc4f224321bb96d30a36421bc8e2b1b7e..01883c45d5099ef3830e1d59c954bc847c288355 100644 (file)
@@ -31,7 +31,7 @@ FluidbookNav.prototype = {
                     }
                     return true;
                 },
-                preventDefault:function(){
+                preventDefault: function () {
                     return false;
                 },
             },
@@ -297,6 +297,11 @@ FluidbookNav.prototype = {
             "3d",
             "help",
             "lang",
+            "extra1",
+            "extra2",
+            "extra3",
+            "extra4",
+            "extra5",
         ];
 
         // Fallback to default list if navOrder is still empty for some reason
@@ -310,19 +315,6 @@ FluidbookNav.prototype = {
             navOrder.push(navOrder.splice(localeIconIndex, 1)[0]); // Push to end of array
         }
 
-
-        // // Backwards compatibility for old "afterSearch" setting to work with new "extra" link
-        // if (this.fluidbook.datas.afterSearch != '' && this.fluidbook.datas.afterSearchLink != '' && this.fluidbook.datas.themeEnableAfterSearch) {
-        //
-        //     // Only override "extra" link values if they're not already set
-        //     if (this.fluidbook.datas.navExtraImage == '' && this.fluidbook.datas.navExtraLink == '') {
-        //         this.fluidbook.datas.navExtraImage = this.fluidbook.datas.afterSearch;
-        //         this.fluidbook.datas.navExtraLink = this.fluidbook.datas.afterSearchLink;
-        //         this.fluidbook.datas.navExtraTooltip = this.fluidbook.datas.afterSearchTooltip;
-        //     }
-        // }
-
-
         for (var i in navOrder) {
             var icon = navOrder[i];
             //var visible = hide.indexOf(icon) == -1;
@@ -455,10 +447,9 @@ FluidbookNav.prototype = {
                         navExtraImage = this.fluidbook.datas.navExtraImage;
                         link = '<a id="' + elementID + '" data-tooltip="' + this.fluidbook.datas.navExtraTooltip + '" href="' + this.fluidbook.datas.navExtraLink + '"' + navLinkTarget + '><img class="nav-icon" src="data/images/' + navExtraImage + '"></a>';
 
-                    } else if (this.fluidbook.datas.afterSearch != '' && this.fluidbook.datas.themeEnableAfterSearch && navType == 'horizontalNav') {
-
+                    } else if (this.fluidbook.datas.afterSearch != '' && this.fluidbook.datas.afterSearchDisplayForHTML && this.fluidbook.datas.themeEnableAfterSearch && navType == 'horizontalNav') {
                         // Use the "afterSearch" image and links set in the theme and link editor
-                        $nav.find('ul').append('<li id="'+ elementID +'"><div id="afterSearch"><div class="c">' + this.fluidbook.loader.getImage('data/images/' + this.fluidbook.datas.afterSearch) + '</div><div class="links">' + this.fluidbook.datas.links.aftersearch + '</div></div></li>');
+                        $nav.find('ul').append('<li id="' + elementID + '"><div id="afterSearch"><div class="c">' + this.fluidbook.loader.getImage('data/images/' + this.fluidbook.datas.afterSearch) + '</div><div class="links">' + this.fluidbook.datas.links.aftersearch + '</div></div></li>');
                     }
 
 
@@ -470,12 +461,54 @@ FluidbookNav.prototype = {
                 if (link !== null) {
                     $nav.find('ul').append('<li>' + link + '</li>');
                 }
+            } else if (icon.match(/extra\d/)) {
+                var n = icon.substr(5, 1);
+                var extraURL = DATAS['navExtraLink' + n];
+                var extraIcon = DATAS['navExtraIcon' + n];
+                var extraVisibility = DATAS['navExtraVisibility' + n];
+                if (extraURL == '' || extraIcon == '') {
+                    continue;
+                }
+                if ((extraVisibility == 'horizontal' && navType == 'menu') || (extraVisibility == 'burger' && navType == 'horizontalNav')) {
+                    continue;
+                }
+                var linkIcon;
+                if (extraIcon.indexOf('.') === -1) {
+                    linkIcon = getSpriteIcon(extraIcon);
+                } else {
+                    linkIcon = '<img class="nav-icon" src="data/images/' + extraIcon + '">';
+                }
+
+                if (extraURL.indexOf('link:') === 0) {
+                    var linkId = extraURL.split(':', 2)[1];
+                    var foundLink;
+                    $.each(DATAS.links, function (page, links) {
+                        var l = $('<root>' + links + '</root>').find('[data-id="' + linkId + '"]');
+                        if (l.length == 1) {
+                            foundLink = l;
+                            return false;
+                        }
+                    });
+                    if (foundLink == undefined) {
+                        continue;
+                    }
+                    link = $(foundLink).find('a').append(linkIcon);
+                    if (navType == 'menu') {
+                        var tooltip = $(link).data('tooltip');
+                        $(link).append('<span class="menu-item-title">' + $(link).data('tooltip') + '</span>');
+                    }
+                    link = $(link).get(0).outerHTML;
+                }
+
+
+                var nav = this.getNavFromType(navType);
+                nav.find('ul').append('<li>' + link + '</li>');
             }
 
             // if (!visible) {
             //     $(link).addClass('hidden');
             // }
-        };
+        }
 
         if (navType == 'menu') {
 
index 30d31364fd9c5187a4b36e2702e96b1080e962a3..e85967e3a575aa1ac787075c5c6c90e336a28080 100644 (file)
@@ -78,6 +78,8 @@ FluidbookResize.prototype = {
             this.updateWindow();
         }
 
+        var headerScale = 1;
+
         var interfaceScale, headerScale;
         if (this.orientation == 'landscape') {
             interfaceScale = Math.min(1, this.ww / this.referenceWidthLandscape, this.hh / this.referenceHeight);