]> _ Git - fluidbook-html5.git/commitdiff
Done #1647 @2
authorStephen Cameron <stephen@cubedesigners.com>
Wed, 6 Sep 2017 17:07:37 +0000 (19:07 +0200)
committerStephen Cameron <stephen@cubedesigners.com>
Wed, 6 Sep 2017 17:07:37 +0000 (19:07 +0200)
js/libs/fluidbook/fluidbook.nav.js
style/nav-horizontal.less

index 67507ba5cafc8416537b32254e0506284b6d6879..d80ff7cf106a3e5a492400fab9c8c96e1981f924 100644 (file)
@@ -259,16 +259,16 @@ FluidbookNav.prototype = {
 
 
         // All possible icons and default ordering
-        var all = "index,chapters,search,friend,print,bookmark,archives,basket,fullscreen,sound,3d,help,lang".split(",");
+        var all = "extra,index,chapters,search,friend,print,bookmark,archives,basket,fullscreen,sound,3d,help,lang".split(",");
         // var hide = array_diff(all, this.fluidbook.datas.navOrder); // Array of icons that aren't in the navOrder list and should be hidden
         // var loop = [].concat(this.fluidbook.datas.navOrder).concat(hide);
         var loop = this.fluidbook.datas.navOrder;
         var localeIconIndex;
 
         // If the locales icon is included, it should always be placed last in the list for formatting reasons
-        if ((localeIconIndex = loop.indexOf('lang')) !== -1) {
-            loop.push(loop.splice(localeIconIndex, 1)[0]); // Push to end of array
-        }
+        // if ((localeIconIndex = loop.indexOf('lang')) !== -1) {
+        //     loop.push(loop.splice(localeIconIndex, 1)[0]); // Push to end of array
+        // }
 
         for (var e in loop) {
             var icon = loop[e];
@@ -398,6 +398,32 @@ FluidbookNav.prototype = {
                     link = this.addLink(navType, 'interface-search', '#', 'searchIcon', 'search', 'search');
                 }
 
+            } else if (icon == 'extra') {
+
+                if (this.fluidbook.datas.navExtraImage == '' || this.fluidbook.datas.navExtraLink == '') {
+                    continue;
+                }
+
+                var id = 'extra',
+                    $nav = this.getNavFromType(navType),
+                    elementID = navType + '_' + id,
+                    navExtraImage;
+
+                if ($nav.find('#' + elementID).length > 0) {
+                    continue;
+                }
+
+                if (navType == 'horizontalNav') {
+                    navExtraImage = this.fluidbook.datas.navExtraImage;
+                } else if (navType == 'menu') {
+                    navExtraImage = this.fluidbook.datas.navExtraImageMobile || this.fluidbook.datas.navExtraImage; // Fallback to desktop image
+                }
+
+                link = '<a id="' + elementID + '" href="' + this.fluidbook.datas.navExtraLink + '"><img src="data/images/' + navExtraImage + '"></a>';
+
+                $nav.find('ul').append('<li>' + link + '</li>');
+
+
             }
 
             // if (!visible) {
index 55ab26cffb55891e5cbeaacae22d571938204ad0..551b49f6d4c62c503594765665639a233b04a9e6 100644 (file)
       }
     }
   }
+
+  // Optional extra image
+  &_extra {
+    img {
+      vertical-align: middle;
+    }
+  }
 }
 
 #iconList {