this.nav = nav;
this.fluidbook = nav.fluidbook;
this.closeTimeout;
+ this.isOpened = false;
}
FluidbookBurger.prototype = {
navOrder = this.fluidbook.settings.navOrder;
}
- var menuOpener = '<a href="#" id="menuOpener">' + getSpriteIcon('interface-menu') + '<span class="label">' + this.fluidbook.l10n.__('Menu') + '</span></a>';
+ var menuOpener = '<a href="#" id="menuOpener" aria-expanded="false" aria-controls="menu" aria-keyshortcuts="F10">' + getSpriteIcon('interface-menu') + '<span class="label">' + this.fluidbook.l10n.__('Menu') + '</span></a>';
$('#main header').append(menuOpener);
// Add holder list element for menu items
// Close menu when a search result is clicked
$(document).on(this.fluidbook.input.clickEvent, '#menuSearchResults a', function (e) {
- $this.closeMenu();
+ $this.close();
});
// Recalculate available size for menu search results
});
$("#menuOverlay").on(this.fluidbook.input.clickEvent, function () {
- $this.closeMenu();
+ $this.close();
});
$(this.fluidbook).on('fluidbook.help.show', function () {
-
+ $this.close();
});
},
open: function () {
+ this.isOpened = true;
clearTimeout(this.closeTimeout);
$("#menu,#menuOverlay").show();
setTimeout(function () {
$("#menu").addClass('open');
}, 10);
+
+ $("#menuOpener").attr('aria-expanded', 'true');
},
closeAll: function () {
},
close: function () {
+ this.isOpened = false;
clearTimeout(this.closeTimeout);
$("#menu").removeClass('open');
+ $("#menuOpener").attr('aria-expanded', 'false');
this.closeTimeout = setTimeout(function () {
$("#menu,#menuOverlay").hide();
}, 500);
},
+ toggle: function () {
+ if (this.isOpened) {
+ return this.close();
+ }
+ return this.open();
+ },
+
openSearch: function (q, cb) {
if (!this.fluidbook.search.isSearchActive()) {
if (!this.fluidbook.settings.searchFullBurger) {
this.fluidbook.search.submitForm();
}
} else {
- this.burger.open();
+ this.open();
$('#q').focus(); // Put cursor in the search field
}
if ($this.fluidbook.search.isSearchActive()) {
$this.fluidbook.search.closeSearch();
if ($("#horizontalNav").is(':visible')) {
- $this.closeMenu();
+ $this.close();
}
} else {
// If we're closing the menu but the search was open and nothing
$this.fluidbook.search.closeSearch();
}
- $this.burger.close();
+ $this.close();
}
});
// __('switch off the sound')
// __('switch on the sound')
// __('switch on / switch off the sound')
- link = this.addLink(navType, 'nav-sound-on', '#', 'sound-on', 'switch off the sound', 'switch on / switch off the sound', 'F10');
- link2 = this.addLink(navType, 'nav-sound-off', '#', 'sound-off', 'switch on the sound', 'switch on / switch off the sound', 'F10');
+ link = this.addLink(navType, 'nav-sound-on', '#', 'sound-on', 'switch off the sound', 'switch on / switch off the sound', 'Ctrl+M');
+ link2 = this.addLink(navType, 'nav-sound-off', '#', 'sound-off', 'switch on the sound', 'switch on / switch off the sound', 'Ctrl+M');
} else if (icon === 'search') {
// __('search')
// Only the horizontal icon menu has the search icon, which opens the main menu