FluidbookNav.prototype = {
initMenu: function () {
var $this = this;
- // navbars = [
- // {
- // "position": "bottom",
- // "content": [
- // '<a href="#">[Sharing links]</a>'
- // ]
- // }
- // ];
- //
- // if (this.fluidbook.datas.search) {
- // navbars.push({
- // "position": "top",
- // "content": [ this.getSearch() ]
- // });
- // }
this.menu.mmenu({
"navbar": {
//add: false // Removes main title bars completely
title: "" // Hides the default "Menu" text
- },
- //"navbars": navbars
+ }
});
this.menuAPI = this.menu.data('mmenu');
this.menuAPI.bind("open:finish", function () {
$('body').addClass('menu-open');
$this.menuIsOpen = true;
+
+ $('#q').focus();
});
this.menuAPI.bind("close:finish", function () {
$this.menuAPI.open();
});
+ // Close menu when a search result is clicked
+ $(document).on('click', '#menuSearchResults a', function (e) {
+ $this.menuAPI.close();
+ });
+
},
- getIcon: function (name) {
- var src = 'data/images/' + name + '.';
- if (this.fluidbook.support.SVG) {
- src += 'svg';
- } else {
- src += 'png';
- }
- if (this._dimensions[name] == undefined) {
- return '';
- }
- return this.fluidbook.loader.getImage(src, this._dimensions[name][0], this._dimensions[name][1]);
- },
+ // getIcon: function (name) {
+ // var src = 'data/images/' + name + '.';
+ // if (this.fluidbook.support.SVG) {
+ // src += 'svg';
+ // } else {
+ // src += 'png';
+ // }
+ // if (this._dimensions[name] == undefined) {
+ // return '';
+ // }
+ // return this.fluidbook.loader.getImage(src, this._dimensions[name][0], this._dimensions[name][1]);
+ // },
addLink: function (name, href, id, help, before, c) {
if (this.menu.find('#' + id).length > 0) {
return;
var $this = this;
// index, chapters, print, friend, bookmark, pdf, archives, basket, fullscreen, sound, 3d, help
- var menuOpener = '<a href="#" id="menuOpener">' + this.fluidbook.l10n.__('Menu') + '</a>';
+ 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
} else if (icon == 'fullscreen' && Modernizr.fullscreen && !DATAS.phonegap) {
this.addLink('interface-fullscreen', '#', 'fullscreen', 'switch between fullscreen and normal');
$("#fullscreen").click(function () {
+ $this.menuAPI.close();
screenfull.toggle();
return false;
})
// Handle empty result set
if (results.total <= 0) {
- fluidbook.menuSearchResults.html(this.fluidbook.l10n.__('no result found'));
+ fluidbook.menuSearchResults.html('<div class="no-results">' + this.fluidbook.l10n.__('no result found') + '</div>');
+ fluidbook.hideSearchHints();
+ fluidbook.menuSearchResults.fadeIn(300);
return false;
}
//$("#q").keyup(searchHints);
$(document).on('keyup', '#q', function(key) {
- if (13 == key.which) return; // Ignore enter key otherwise hints are re-displayed after form is submitted
- searchHints();
+ switch (key.which) {
+ case 13: // Enter key
+ case 37: // Left arrow
+ case 38: // Up arrow
+ case 39: // Right arrow
+ case 40: // Down arrow
+ return; // Ignore these keys
+ break;
+ default:
+ searchHints();
+ }
});
$(document).on('click', ".hint", function () {
border-color: @menu-text;
}
-//.mm-hasnavbar-top-1 .mm-panels {
-// top: 60px;
-//}
+// Main list settings
+.mm-listview {
+ font-size: 16px;
+ line-height: 40px;
+}
+
+// Disable borders between list items
+.mm-listview>li:not(.mm-divider):after, .mm-navbar {
+ border: none;
+}
+
+// Extra padding for submenus with title bars
+.mm-panels>.mm-panel.mm-hasnavbar {
+ padding-top: 60px;
+}
// Page overlay opacity
html.mm-opening .mm-menu.mm-opened[class*=mm-pagedim]~#mm-blocker {
color: @menu-text;
a, span {
- padding: 10px;
+ padding: 10px 10px 10px 30px;
img {
display: inline-block;
position: absolute;
right: 10px;
top: 10px;
- color: @menu-text;
+ color: @icon-color;
+
+ .svg-icon {
+ width: 20px;
+ vertical-align: middle;
+ margin-left: 15px;
+ }
}
#menuSearch {
// Main menu with icons
#menuList {
- padding-top: 60px; // Offset for the fixed search box...
+ padding-top: 80px; // Offset for the fixed search box plus some extra padding
&:before {
height: 0; // Fix spacing with search box
border: none;
height: 60px;
font-size: 16px;
- padding: 0 1em 0 2.8em;
+ padding: 0 1em 0 70px;
width: 260px;
}
height: 20px;
margin-top: 1px; // Fixes weird clipping of top of icon
}
+
+ .ltr & {
+ margin: 0;
+ }
+
+ .rtl & {
+ margin: 0 5px 0 0;
+ }
}
#menuSearchResults, #menuSearchHints {
display: none; // Hidden by default, displayed via JS
}
+#menuSearchHints {
+ padding-top: 15px;
+
+ .hint {
+ padding: 13px 30px;
+ font-size: 16px;
+ display: block;
+ width: 100%;
+ height: auto;
+ position: relative;
+
+ // > arrow
+ &:after {
+ content: '';
+ position: absolute;
+ border-top: 2px solid transparent;
+ border-left: 2px solid transparent;
+ border-color: currentColor;
+ display: block;
+ width: 8px;
+ height: 8px;
+ margin: auto;
+ top: 0;
+ bottom: 0;
+ right: 25px;
+ transform: rotate(135deg);
+ }
+
+ em {
+ font-style: normal;
+ }
+ }
+}
+
#menuSearchResults {
- max-height: ~"calc(100vh - 60px)";
+ max-height: ~"calc(100vh - 100px)";
overflow-y: auto;
padding-top: 20px;
.doubleThumb {
display: block !important;
margin: 10px auto 40px auto !important;
+ &:not(.simple), &.simple .thumb img {
+ box-shadow: 10px 4px 10px 0px rgba(68, 68, 68, 0.5);
+ }
+ }
+
+ .hits {
+ font-size: 16px !important;
}
.padding {
display: none !important;
}
+
+ .no-results {
+ padding: 5px 25px;
+ }
}
\ No newline at end of file