FluidbookNav.prototype = {
initMenu: function () {
- var $this = this,
- dir = this.fluidbook.l10n.dir,
+ var $this = this, dir = this.fluidbook.l10n.dir,
inverted = this.fluidbook._boolean(this.fluidbook.settings.invertMenuPosition),
side = ((dir === 'ltr' && inverted) || (dir === 'rtl' && !inverted)) ? 'right' : 'left';
return !$(this).is('#menu_download,#menu_print');
}
return true;
- },
- preventDefault: function () {
+ }, preventDefault: function () {
return false;
},
},
- "extensions": extensions,
- "offCanvas": {
- "position": side,
- "zposition": "front",
- },
- "navbar": {
+ "extensions": extensions, "offCanvas": {
+ "position": side, "zposition": "front",
+ }, "navbar": {
//add: false // Removes main title bars completely
title: "" // Hides the default "Menu" text
- },
- "rtl": {
+ }, "rtl": {
"use": "detect" // Auto detect when in RTL mode based on html dir attribute
},
// Add scrollbar to main menu
$('#menuList > ul, #chapterList').perfectScrollbar({
- suppressScrollX: true,
- minScrollbarLength: 40,
- //maxScrollbarLength: 60
+ suppressScrollX: true, minScrollbarLength: 40, //maxScrollbarLength: 60
});
- },
- closeMenu: function () {
+ }, closeMenu: function () {
this.menuAPI.close();
- },
- // getIcon: function (name) {
+ }, // getIcon: function (name) {
// var src = 'data/images/' + name + '.';
// if (this.fluidbook.support.SVG) {
// src += 'svg';
// return this.fluidbook.loader.getImage(src, this._dimensions[name][0], this._dimensions[name][1]);
// },
addLink: function (navType, name, href, id, title, help, keyboardShortcut, before, className, showIcon) {
- var $nav = this.getNavFromType(navType),
- elementID = navType + '_' + id;
+ var $nav = this.getNavFromType(navType), elementID = navType + '_' + id;
if ($nav.find('#' + elementID).length > 0) {
return;
$nav.find("ul #" + before).before(li);
}
return $("#" + elementID).get(0);
- },
- getLink: function (name, href, id, title, help, className, showIcon, navType, keyboardShortcut) {
+ }, getLink: function (name, href, id, title, help, className, showIcon, navType, keyboardShortcut) {
if (showIcon === undefined) {
showIcon = true;
}
} else {
return '<a href="' + href + '"' + res + '</a>';
}
- },
- getNavFromType: function (navType) {
+ }, getNavFromType: function (navType) {
switch (navType) {
case 'horizontalNav':
return this.horizontalNav;
console.error('navType ' + navType + ' not found!');
return false;
}
- },
- setNav: function (navType) {
+ }, setNav: function (navType) {
if (typeof navType === 'undefined') {
return false;
* __('switch on the sound')
* __('notes')
*/
- var $this = this,
- navOrder = this.fluidbook.settings.navOrder; // Default desktop order, maybe be overridden later
+ var $this = this, navOrder = this.fluidbook.settings.navOrder; // Default desktop order, maybe be overridden later
var v2 = '';
if (this.fluidbook.settings.iconSet < 15) {
// All possible icons and default ordering
- var all = [
- "extra",
- "index",
- "chapters",
- "search",
- "friend",
- "print",
- "pdf",
- 'notes',
- "bookmark",
- "archives",
- "basket",
- "fullscreen",
- "sound",
- "3d",
- "help",
- "lang",
- "extra1",
- "extra2",
- "extra3",
- "extra4",
- "extra5",
- ];
+ var all = ["extra", "index", "chapters", "search", "friend", "print", "pdf", 'notes', "bookmark", "archives", "basket", "fullscreen", "sound", "3d", "help", "lang", "extra1", "extra2", "extra3", "extra4", "extra5",];
// Fallback to default list if navOrder is still empty for some reason
if (navOrder.length === 0) {
}
} else if (icon === 'extra') {
- var id = 'extra',
- $nav = this.getNavFromType(navType),
- elementID = navType + '_' + id,
- navExtraImage,
+ var id = 'extra', $nav = this.getNavFromType(navType), elementID = navType + '_' + id, navExtraImage,
navLinkTarget = '';
// Check to see if navExtraLink is external or not and set target accordingly
var url = 'data/images/' + extraIcon;
extraNPerURL[url] = n;
$.ajax({
- url: url,
- type: 'GET',
- dataType: 'xml',
- success: function (data) {
+ url: url, type: 'GET', dataType: 'xml', success: function (data) {
var n1 = extraNPerURL[this.url];
var svg = $(data).find('svg');
// Fix #2111
},
getMenuCloseButton: function () {
- var $this = this,
- buttonID = 'menuClose';
+ var $this = this, buttonID = 'menuClose';
// Click handler to close menu
$(document).on(this.fluidbook.input.clickEvent, '#' + buttonID, function (e) {
// and return the user to the main menu instead of closing the menu
if ($this.fluidbook.search.isSearchActive()) {
$this.fluidbook.search.closeSearch();
- if (!$("#horizontalNav").is(':visible')) {
+ if ($("#horizontalNav").is(':visible')) {
$this.menuAPI.close();
-
}
} else {
// If we're closing the menu but the search was open and nothing
// Build nested lists from chapters
makeChapterLists: function (chapters) {
- var currentLevel = 0,
- loopIndex = 0,
- html = '<ul id="chapterList">';
+ var currentLevel = 0, loopIndex = 0, html = '<ul id="chapterList">';
var $this = this;