// Add holder list element for menu items
$("#menu").append('<div id="menuList"' + v2 + '><ul></ul></div>');
- console.log("flooooat", this.floatmode)
-
if(this.floatmode) {
$('body').append(this.initSearch());
} else {
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 += '<button id="menuSearchClose" role="button" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape">';
+ res += '<div id="menuSearchClose" role="button" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape">';
res += getSpriteIcon('interface-close');
- res += '</button>';
+ res += '</div>';
res += '</form>';
res += '<div id="menuSearchHints" class="mm-nopanel"></div>';
res += '<div id="menuSearchResults" class="mm-nopanel"></div>';
function FluidbookSearch(fluidbook) {
this.fluidbook = fluidbook;
+ //this.searchfloat = new FluidbookSearchFloat(fluidbook);
this.indexLoaded = false;
this.indexLoading = false;
this.termsToHighlight = [];
});
this.initResultsNav();
-
- console.log("search",$this.fluidbook.nav)
},
debugSearch: function (keyword) {
this.resultsNav = $('#' + this.resultsNavID);
//=== Event handlers
+ $(document).on(this.fluidbook.input.clickEvent, 'body.floatmode #menuSearchHints a', function () {
+ // Find the page number of the result so we can see where it sits in the list of returned results
+ var pageNumber = parseInt($("#menuSearchResults a").find('.doubleThumb').attr('page'));
+ $this.openResultsNav(pageNumber);
+ });
+
$(document).on(this.fluidbook.input.clickEvent, '#menuSearchResults a', function () {
// Find the page number of the result so we can see where it sits in the list of returned results
var pageNumber = parseInt($(this).find('.doubleThumb').attr('page'));
this.updateResultsNav(resultPage);
this.hideableElements.addClass('hidden');
this.resultsNav.removeClass('hidden');
+ $('body.floatmode #menuSearch').hide();
+ setTimeout(function () {
+ $('body.floatmode #menuSearch').addClass('hidden').show();
+ }, 100);
$('body').addClass(this.resultsActiveClass);
setTimeout(function () {
if ($this.fluidbook.input.isUsingKeyboard()) {
this.fluidbook.nav.burger.hideMenuItems(); // Hide menu items to give space for hints div
this.menuSearchHints.fadeIn(300);
- $("#menuSearch").fadeIn(300);
+ $("#menuSearch").removeClass("hidden")
},
getSearchHints: function (q) {
var $this = this;
this.find(q, function (results) {
- $this.openResults(results);
+ $this.openResults(results, this.fluidbook.floatmode);
});
},
this.highlightSearchTerms(this.fluidbook.currentPage);
// Redirect to the only result page if the flag is enabled
- if (gotoPageIfOneResult && spreadEnabled === 1) {
+ if(this.fluidbook.nav.burger.floatmode && gotoPageIfOneResult) {
setTimeout(function () {
fluidbook.setCurrentPage($this.menuSearchResults.find('.doubleThumb[data-enabled="1"]').attr('page'));
+ var pageNumber = parseInt($("#menuSearchResults a").find('.doubleThumb').attr('page'));
+ $this.openResultsNav(pageNumber);
fluidbook.nav.burger.close();
}, 100);
return;
+ } else {
+ if (gotoPageIfOneResult && spreadEnabled === 1) {
+ setTimeout(function () {
+ fluidbook.setCurrentPage($this.menuSearchResults.find('.doubleThumb[data-enabled="1"]').attr('page'));
+ fluidbook.nav.burger.close();
+ }, 100);
+ return;
+ }
}
this.menuSearchResults.fadeIn(300).scrollTop(0);