// Add holder list element for menu items
$("#menu").append('<div id="menuList"' + v2 + '><ul></ul></div>');
+ // Add button for search float in mobile
+ if(!this.nav.horizontalOnly) {
+ $("#menuList ul").prepend('<li><a href="#" id="menu_search" class="icon-search" role="button" data-tooltip="Search" aria-label="Search" aria-keyshortcuts="Control+F">'+ getSpriteIcon('nav-search') + '<span class="menu-item-title">' +this.fluidbook.l10n.__('Search')+ '</span></a></li>')
+ }
+
if(this.fluidbook.search.isSearchfloatActive) {
$('body').append(this.initSearch());
} else {
var inverted = this.nav.isInverted();
var side = ((dir === 'ltr' && inverted) || (dir === 'rtl' && !inverted)) ? 'right' : 'left';
-
$("#menu").insertAfter('#main');
$('<div id="menuOverlay"></div>').insertAfter('#menu');
$(document).on(this.fluidbook.input.clickEvent, '#menuOpener', function (e) {
e.preventDefault();
$this.open();
- $this.openSearch();
+ //$this.openSearch();
});
// Close menu when a search result is clicked
clearTimeout(this.closeTimeout);
if (!this.isOpened) {
$('body').addClass('menu-open');
- $("#menuOverlay").show();
- if(!this.fluidbook.search.isSearchfloatActive) {
- $("#menu").show()
+ $("#menuOverlay").show()
+
+ if(!this.fluidbook.nav.horizontalOnly) {
+ if(!this.fluidbook.search.isSearchfloatActive || (this.fluidbook.search.isSearchfloatActive && $('#menuSearch').hasClass('hidden'))) {
+ $("#menu").show();
+ }
}
+
setTimeout(function () {
$("#menu").addClass('open');
- this.fluidbook.resize.resizeMenu();
+ $this.fluidbook.resize.resizeMenu();
if (focusClose) {
setTimeout(function () {
if ($this.fluidbook.input.isUsingKeyboard()) {
return;
}
this.isOpened = false;
+ const $this = this;
$('body').addClass('menu-open');
clearTimeout(this.closeTimeout);
$("#menu").removeClass('open');
$("body.floatmode #menuSearch").addClass('hidden');
}
this.closeTimeout = setTimeout(function () {
- $("#menu,#menuOverlay").hide();
+ $("#menu").hide();
+ if($this.fluidbook.search.isSearchfloatActive && $("#menuSearch").hasClass("hidden")) {
+ $("#menuOverlay").hide();
+ }
}, 500);
+
+ if(this.fluidbook.search.isSearchfloatActive && !this.nav.horizontalOnly) {
+ $("#menuOverlay").css({
+ "opacity": 0,
+ "pointer-events": "none"
+ })
+ }
},
toggle: function () {
},
hideMenuItems: function () {
+ if(this.fluidbook.search.isSearchfloatActive) {
+ return false;
+ }
gsap.to($('#menuList >ul > li, #shareLinks,footer#mobile-credits'), {
duration: 0.1, opacity: 0, display: 'none'
});
} else {
this.open(false);
+ if(this.fluidbook.search.isSearchfloatActive && !this.nav.horizontalOnly) {
+ $("#menuOverlay").css({
+ "opacity": 1,
+ "pointer-events": "auto"
+ })
+ $("#menu").removeClass("open")
+ this.closeTimeout = setTimeout(function () {
+ $("#menu").addClass("open").hide()
+ }, 500);
+ }
+
if(this.fluidbook.search.isSearchfloatActive && !floatSearchVisible) {
$("#menuSearch").hide().removeClass('hidden')
setTimeout(function(){
this.burger = new FluidbookBurger(this);
this.horizontalNav = $("#horizontalNav");
this._inited = {};
+ this.horizontalOnly = fluidbook.settings.menuBreakpoint < 320 && fluidbook.settings.menuBreakpoint !== "";
this.setNav('horizontalNav');
if ($("#iconList").html() !== '') {
});
// Search icon in horizontal menu
- $(document).on(this.fluidbook.input.clickEvent, '#horizontalNav_searchIcon', function (event) {
+ $(document).on(this.fluidbook.input.clickEvent, '#horizontalNav_searchIcon, #menu_search', function (event) {
event.preventDefault();
$this.burger.openSearch();
});
FluidbookSearchFloat.prototype = {
init: function() {
// Empty
- }
+ },
+
+ getHtml: function() {
+ var res = '<form action="#" id="searchForm" method="post">';
+ res += '<input id="q" name="q" type="search" value="" aria-label="' + this.fluidbook.l10n.__('search keywords or reference') + '" placeholder="' + this.fluidbook.l10n.__('search keywords or reference') + '" autocorrect="off" autocomplete="off" autocapitalize="off" />';
+ res += '<a href="#" id="submitSearch" class="icon-submitSearch" role="button" tabindex="-1" aria-label="' + this.fluidbook.l10n.__('submit search') + '"><svg viewBox="0 0 512 512" class="nav-search nav-icon svg-icon" aria-hidden="true"><use xlink:href="#nav-search"></use></svg></a>';
+ res += '<div id="menuSearchClose" role="button" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape" tabindex="0">';
+ res += getSpriteIcon('interface-close');
+ res += '</div>';
+ res += '</form>';
+ res += '<div id="menuSearchHints" class="mm-nopanel"></div>';
+ res += '<div id="menuSearchResults" class="mm-nopanel"></div>';
+
+ return res;
+ },
}
\ No newline at end of file
function FluidbookSearch(fluidbook) {
this.fluidbook = fluidbook;
- this.isSearchfloatActive = null;
+ this.isSearchfloatActive = false;
this.indexLoaded = false;
this.indexLoading = false;
this.termsToHighlight = [];
this.menuSearchHints.fadeIn(300);
$("#menuSearch").removeClass("hidden")
+
+ /*if(!this.fluidbook.nav.horizontalOnly && this.fluidbook.search.isSearchfloatActive) {
+ $("#menu").removeClass('open');
+ $("#menuOverlay").show();
+ this.closeTimeout = setTimeout(function () {
+ $("#menu").hide().addClass('open')
+ }, 500);
+ }*/
},
getSearchHints: function (q) {