From 8e48da207fe55124870ae59322d999380ace2a49 Mon Sep 17 00:00:00 2001 From: Stephen Cameron Date: Tue, 31 Oct 2017 14:43:48 +0100 Subject: [PATCH] WIP #1762 @1.5 --- js/libs/fluidbook/fluidbook.nav.js | 40 +++++++++++++++--------------- style/nav-horizontal.less | 3 ++- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.nav.js b/js/libs/fluidbook/fluidbook.nav.js index 8afa23d4..85cc3c6d 100644 --- a/js/libs/fluidbook/fluidbook.nav.js +++ b/js/libs/fluidbook/fluidbook.nav.js @@ -432,35 +432,35 @@ FluidbookNav.prototype = { } else if (icon == 'extra') { - // If the "extra" image has been set, it will be used in preference to the "afterSearch" links - if (this.fluidbook.datas.navExtraImage != '' || this.fluidbook.datas.navExtraLink != '') { + var id = 'extra', + $nav = this.getNavFromType(navType), + elementID = navType + '_' + id, + navExtraImage; - var id = 'extra', - $nav = this.getNavFromType(navType), - elementID = navType + '_' + id, - navExtraImage; + if ($nav.find('#' + elementID).length > 0) { + continue; + } - if ($nav.find('#' + elementID).length > 0) { - continue; - } + if (navType == 'horizontalNav') { - if (navType == 'horizontalNav') { + if (this.fluidbook.datas.navExtraImage != '' && this.fluidbook.datas.navExtraLink != '') { navExtraImage = this.fluidbook.datas.navExtraImage; link = ''; - } else if (navType == 'menu') { - navExtraImage = this.fluidbook.datas.navExtraImageMobile || this.fluidbook.datas.navExtraImage; // Fallback to desktop image - link = ' ' + this.fluidbook.datas.navExtraTooltip + ''; - } + } else if (this.fluidbook.datas.afterSearch != '' && this.fluidbook.datas.themeEnableAfterSearch && navType == 'horizontalNav') { - $nav.find('ul').append('
  • ' + link + '
  • '); - if (link2 !== null) { - $nav.find('ul').append('
  • ' + link2 + '
  • '); + // Use the "afterSearch" image and links set in the theme and link editor + $nav.find('ul').append('
  • ' + this.fluidbook.loader.getImage('data/images/' + this.fluidbook.datas.afterSearch) + '
  • '); } - // Use the "afterSearch" image and links set in the theme and link editor - } else if (this.fluidbook.datas.afterSearch != '' && this.fluidbook.datas.themeEnableAfterSearch && navType == 'horizontalNav') { - $nav.find('ul').append('
  • ' + this.fluidbook.loader.getImage('data/images/' + this.fluidbook.datas.afterSearch) + '
  • '); + + } else if (navType == 'menu' && (this.fluidbook.datas.navExtraImage != '' || this.fluidbook.datas.navExtraImageMobile != '') && this.fluidbook.datas.navExtraLink != '') { + navExtraImage = this.fluidbook.datas.navExtraImageMobile || this.fluidbook.datas.navExtraImage; // Fallback to desktop image + link = ' ' + this.fluidbook.datas.navExtraTooltip + ''; + } + + if (link !== null) { + $nav.find('ul').append('
  • ' + link + '
  • '); } } diff --git a/style/nav-horizontal.less b/style/nav-horizontal.less index 62329b02..2c074fbf 100644 --- a/style/nav-horizontal.less +++ b/style/nav-horizontal.less @@ -43,8 +43,9 @@ // Optional extra image &_extra { - img { + > img { vertical-align: middle; + margin: 0 17px; } } } -- 2.39.5