if ($("#nav").find('#' + id).length > 0) {
return;
}
- var l = this.getLink(name, href, id, help, c);
+ var l = $(this.getLink(name, href, id, help, c));
if (before == undefined) {
$("#nav").append(l);
} else {
$("#nav #" + before).before(l);
}
+ return l;
},
+
getLink: function (name, href, id, help, className, icon) {
if (icon == undefined) {
icon = true;
}
- for (var e in this.fluidbook.datas.navOrder) {
- var icon = this.fluidbook.datas.navOrder[e];
+
+ var all = "index,chapters,print,friend,bookmark,archives,basket,fullscreen,sound,3d,help".split(",");
+ var hide = all.diff(this.fluidbook.datas.navOrder);
+ var loop = [].concat(this.fluidbook.datas.navOrder).concat(hide);
+
+ for (var e in loop) {
+ var icon = loop[e];
+ var visible = hide.indexOf(icon) == -1;
+ var link;
+
if (icon == 'home' && !skipHome) {
var homeURL = this.fluidbook.datas.home;
}
try {
if (homeURL != '') {
- this.addLink('nav-home', homeURL, 'home', 'home');
+ link = this.addLink('nav-home', homeURL, 'home', 'home');
}
} catch (err) {
return false;
})
} else if (icon == 'index') {
- this.addLink('nav-index', '#/index', 'index', 'overview');
+ link = this.addLink('nav-index', '#/index', 'index', 'overview');
} else if (icon == 'chapters') {
if (this.fluidbook.datas.displayChaptersIcon) {
if (this.fluidbook.datas.chaptersPage != '') {
- this.addLink('nav-sommaire', '#/page/' + this.fluidbook.datas.chaptersPage, 'chapters', 'chapters');
+ link = this.addLink('nav-sommaire', '#/page/' + this.fluidbook.datas.chaptersPage, 'chapters', 'chapters');
} else if (this.fluidbook.datas.chapters.length > 0) {
- this.addLink('nav-sommaire', '#/chapters', 'chapters', 'chapters');
+ link = this.addLink('nav-sommaire', '#/chapters', 'chapters', 'chapters');
}
}
} else if (icon == 'friend') {
if (this.fluidbook.datas.share) {
- this.addLink('nav-friend', '#/share', 'share', 'share');
+ link = this.addLink('nav-friend', '#/share', 'share', 'share');
$("#share").click(function () {
if ($this.fluidbook.datas.phonegap != 'android') {
return true;
}
} else if (icon == 'bookmark') {
if (this.fluidbook.datas.bookmark) {
- this.addLink('nav-bookmark', '#/bookmark', 'bookmarks', 'bookmarks');
+ link = this.addLink('nav-bookmark', '#/bookmark', 'bookmarks', 'bookmarks');
$("#bookmarks").click(function () {
if (!$this.fluidbook.bookmarks.hasBookmarkedPages()) {
var message = $this.fluidbook.l10n.__("you don't have any bookmarks");
}
} else if (icon == 'pdf' || icon == 'print') {
if ($("#print").length == 0 && (this.fluidbook.datas.print || this.fluidbook.datas.pdf)) {
- this.addLink('nav-print', '#', 'print', '!' + this.fluidbook.l10n.__('print') + ' | ' + this.fluidbook.l10n.__('download pdf'));
+ link = this.addLink('nav-print', '#', 'print', '!' + this.fluidbook.l10n.__('print') + ' | ' + this.fluidbook.l10n.__('download pdf'));
$("#print").on('click', function () {
$this.fluidbook.print();
return false;
}
} else if (icon == 'lang') {
if (this.fluidbook.l10n.multilangEnabled) {
- this.addMultilangLink();
+ link = this.addMultilangLink();
}
} else if (icon == 'archives') {
if (this.fluidbook.datas.archivesLink != '') {
- this.addLink('nav-archives', this.fluidbook.datas.archivesLink, 'archives', '!' + this.fluidbook.datas.archivesLabel);
+ link = this.addLink('nav-archives', this.fluidbook.datas.archivesLink, 'archives', '!' + this.fluidbook.datas.archivesLabel);
} else if (this.fluidbook.datas.externalArchives != '') {
- this.addLink('nav-archives', '#/archives', 'archives', '!' + this.fluidbook.datas.archivesLabel);
+ link = this.addLink('nav-archives', '#/archives', 'archives', '!' + this.fluidbook.datas.archivesLabel);
}
} else if (icon == 'help') {
- this.addLink('nav-help', '#', 'help', '');
+ link = this.addLink('nav-help', '#', 'help', '');
} else if (icon == 'zoom' && !this.fluidbook.support.isMobile) {
- this.addLink('nav-zoomin', '#', 'zoomin', 'zoom in');
- this.addLink('nav-zoomout', '#', 'zoomout', 'zoom out');
+ link = this.addLink('nav-zoomin', '#', 'zoomin', 'zoom in');
+ link = this.addLink('nav-zoomout', '#', 'zoomout', 'zoom out');
$("#zoomin").click(function (e) {
$this.fluidbook.desktop.clickZoom(e, 'in');
return false;
});
} else if (icon == 'fullscreen' && Modernizr.fullscreen && !DATAS.phonegap) {
- this.addLink('nav-fullscreen', '#', 'fullscreen', 'switch between fullscreen and normal');
+ link = this.addLink('nav-fullscreen', '#', 'fullscreen', 'switch between fullscreen and normal');
$("#fullscreen").click(function () {
screenfull.toggle();
return false;
})
}
+
+ console.log(link);
+ console.log(visible);
+ if (!visible) {
+ $(link).addClass('hidden');
+ }
}
if (this.fluidbook.datas.search) {
$("#nav").append(l);
$("#nav #locales").css('background-image', 'url("images/flags/' + flag + '.png")');
+
+ return l;
},
setSearch: function () {
var $this = this;
$(document).on('click', '#next', goNextPage);
$(document).on('click', '#previous', goPreviousPage);
}
-};
\ No newline at end of file
+};
+