} else if (view == 'iframe') {
this.openIframe(param1, cb);
} else if (view == 'search') {
-
+ this.openSearch(param1, cb);
} else {
this['open' + camelView](param1, param2, cb);
}
},
+ openSearch: function (q, cb) {
+ this.fluidbook.nav.openSearch(q, cb);
+ },
openingView: function (callback) {
var $this = this;
this.fluidbook.resize.resizeView();
break;
case 'index':
fullscreen = true;
- $("#indexViewHolder").css('width',Math.floor(ww / 230) * 230);
+ $("#indexViewHolder").css('width', Math.floor(ww / 230) * 230);
break;
case 'share':
w = 200;
$(document).on('click', '#horizontalNav_searchIcon', function (event) {
event.preventDefault()
- if (!fluidbook.search.isSearchActive()) {
- fluidbook.search.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();
-
- $('#q').focus(); // Put cursor in the search field
+ $this.openSearch();
});
// Full screen toggle
},
+ openSearch: function (q, cb) {
+ if (!fluidbook.search.isSearchActive()) {
+ fluidbook.search.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 (q !== undefined) {
+ $("#q").val(q);
+ this.fluidbook.search.submitForm();
+ }
+ $('#q').focus(); // Put cursor in the search field
+ if (cb !== undefined) {
+ cb();
+ }
+ },
+
getMenuCloseButton: function () {
var $this = this,
buttonID = 'menuClose';
return false;
}
+ window.location.hash = '/search/' + q;
+
this.fluidbook.stats.track(1, this.fluidbook.currentPage, q);
var $this = this;
this.find(q, function (results) {