res += getSpriteIcon(name);
}
- if (title != undefined && title != '') {
- res += ' ' + this.fluidbook.l10n.__(title);
+ // Only the Menu should have titles
+ if (navType == 'menu') {
+ if (title != undefined && title != '') {
+ res += ' ' + this.fluidbook.l10n.__(title);
+ }
}
// If there's no link defined, return the text an icon wrapped in a <span> (useful for MMenu)
var $this = this;
// index, chapters, print, friend, bookmark, pdf, archives, basket, fullscreen, sound, 3d, help
+ // MMenu specific elements
if (navType == 'menu') {
var menuOpener = '<a href="#" id="menuOpener">' + this.fluidbook.l10n.__('Menu') + getSpriteIcon('interface-menu') + '</a>';
$('#main header').append(menuOpener);
// Add holder list element for menu items
- this.menu.append('<ul id="menuList"></ul>');
+ $nav.append('<ul id="menuList"></ul>');
// Add Search form
if (this.fluidbook.datas.search) {
$('#menuList').prepend('<li id="menuSearch">' + this.getSearch() + '</li>');
}
+
+ // Horizontal icon nav
+ } else if (navType == 'horizontalNav') {
+
+ $nav.append('<ul id="iconList"></ul>');
+
}
}
- var all = "index,chapters,print,friend,bookmark,archives,basket,fullscreen,sound,3d,help".split(",");
+ var all = "index,chapters,search,friend,print,bookmark,archives,basket,fullscreen,sound,3d,help".split(",");
var hide = array_diff(all, this.fluidbook.datas.navOrder);
var loop = [].concat(this.fluidbook.datas.navOrder).concat(hide);
if (navType == 'horizontalNav') {
if (this.fluidbook.datas.share) {
- link = this.addLink(navType, 'nav-friend', '#/share', 'share', 'share');
+ link = this.addLink(navType, 'interface-share', '#/share', 'share', 'share', 'share');
$("#share").click(function () {
if ($this.fluidbook.datas.phonegap != 'android') {
return true;
$this.menuAPI.close();
screenfull.toggle();
return false;
- })
+ });
+
+ } else if (icon == 'search') {
+
+ // Only the horizontal icon menu has the search icon, which opens the main menu
+ if (this.fluidbook.datas.search && navType == 'horizontalNav') {
+ link = this.addLink(navType, 'interface-search', '#', 'searchIcon', 'search', 'search');
+ $("#searchIcon").click(function (event) {
+ event.preventDefault()
+
+ if (!fluidbook.isSearchActive()) {
+ fluidbook.initSearchHints(); // Clears menu and only displays search box
+ $this.menuAPI.closeAllPanels(); // Make sure we're on the main panel with the search box
+ }
+ $this.menuAPI.open();
+ });
+ }
+
}
if (!visible) {
}
- // Todo: handle search icon in horizontal menu only...
- // if (this.fluidbook.datas.search) {
- // this.setSearch();
- // }
if (this.fluidbook.datas.afterSearch != '' && this.fluidbook.datas.themeEnableAfterSearch) {
this.setAfterSearch();
}
if ($this.fluidbook.isSearchActive()) {
$this.fluidbook.closeSearch();
} else {
+
+ // If we're closing the menu but the search was open and nothing
+ // was searched for, we need to reset the menu...
+ var sHints = $this.fluidbook.menuSearchHints,
+ sResults = $this.fluidbook.menuSearchResults;
+
+ // Make sure the search really is empty
+ if (sHints && sHints.html().length == 0 && sResults && sResults.html().length == 0) {
+ $this.fluidbook.closeSearch();
+ }
+
$this.menuAPI.close();
}