$(document).on('click touchend', '[data-action]', function () {
+
var map = {'pdf': 'print', 'fullScreen': "fullscreen", 'locales': 'localesContainers'};
var action = $(this).data('action');
+ var extra = $(this).data('extra');
if (action == 'share') {
// Let share class handle this
return true;
action = map[action];
}
+ if (action == 'chapters' && extra) {
+ window.location.hash='#/chapters/'+extra;
+ return false;
+ }
+
var navitem = $("#horizontalNav_" + action);
if (navitem.length > 0) {
$(navitem).get(0).click();
}
});
- if(animateBookmarks) {
+ if (animateBookmarks) {
var bookmarks = $("#links .bookmark:not([data-enabled])");
$(bookmarks).addClass('animating').css('opacity', 1);
TweenMax.to($(bookmarks), $this.fluidbook.datas.linkBlinkTime, {
}
});
}
-
-
},
zoomLink: function (link) {
} else if (view == 'multimedia') {
this.openMultimedia(param1, cb);
} else if (view == 'chapters') {
- this.openChapters(cb);
+ this.openChapters(param1, cb);
} else if (view == 'archives') {
this.openArchives($("#nav #archives").data('tooltip'), cb);
} else if (view == 'text') {
}
}
,
- openChapters: function (callback) {
+ openChapters: function (submenu, callback) {
if (this.fluidbook.chapters == undefined) {
this.fluidbook.chapters = new FluidbookChapters(this.fluidbook, this.fluidbook.datas.chapters);
}
- var view = '<div class="caption">' + this.closeButton() + '<h2>' + this.fluidbook.l10n.__('chapters') + '</h2></div>';
+ var v = this.fluidbook.chapters.getView(submenu);
+ var menuId = 'mview-chapters-' + v.sub;
+
+ var view = '<div class="caption">' + this.closeButton() + '<h2>' + v.title + '</h2></div>';
view += '<div class="content">';
- view += this.fluidbook.chapters.getView();
+ view += v.view;
view += '</div>';
- $("#view").append('<div class="mview" data-menu="chapters">' + view + '</div>');
+
+ var color = "";
+ if (v.color != 'default') {
+ color = ' c_' + v.color;
+ }
+
+ $("#view").append('<div id="' + menuId + '" class="mview' + color + '" data-menu="chapters">' + view + '</div>');
if (callback != undefined) {
callback();
}
h = nh * s;
}
- x = (w - (nw * s) ) / 2;
+ x = (w - (nw * s)) / 2;
y = (h - (nh * s)) / 2;
}
this.chapters = chapters;
this.style = 'classic';
this.cascade = this.fluidbook.datas.chaptersCascade;
+ this.cascadeEventsInited = false;
if (this.fluidbook.datas.mobileChaptersStyle) {
this.style = this.fluidbook.datas.mobileChaptersStyle;
}
- this.html = '';
+ this.html = [];
+ this.titles = {'null': this.fluidbook.l10n.__('chapters')};
+ this.colors = {'null': 'default'};
this.lastColor;
}
FluidbookChapters.prototype = {
- getView: function () {
- if (this.html == '') {
- this.makeView();
+ getView: function (sub) {
+ if (sub == undefined || sub == null || sub == '') {
+ sub = 'null';
}
- return this.html;
+ if (this.html[sub] == null) {
+ this.makeView(sub);
+ }
+ return {sub:sub,view: this.html[sub], title: this.titles[sub], color: this.colors[sub]};
},
- makeView: function () {
- this.makeClassicMenu();
+ makeView: function (sub) {
+ this.makeClassicMenu(sub);
if (this.cascade) {
- this.makeCascadeMenu();
+ this.makeCascadeMenu(sub);
}
},
- makeCascadeMenu: function () {
- var h = $(this.html);
+ makeCascadeMenu: function (sub) {
+ var h = $(this.html[sub]);
for (var i = 3; i >= 0; i--) {
$(h).find('li[data-level=' + i + ']').each(function () {
}
});
}
- this.html = $(h).get(0).outerHTML;
+ this.html[sub] = $(h).get(0).outerHTML;
+
+ if (!this.cascadeEventsInited) {
+ this.initCascadeEvents();
+ }
+ },
+ initCascadeEvents: function () {
+ this.cascadeEventsInited = true;
if (this.style == 'ina') {
$(document).on('click', 'ul.chapters a .right', function (e) {
var p = $(this).data('page');
}
});
},
- makeClassicMenu: function () {
+
+ makeClassicMenu: function (sub) {
+ var $this = this;
+ var base;
+ var baseLevel = 0;
+ if (sub == 'null') {
+ base = this.chapters;
+ } else {
+ var base = [];
+ var vu = false;
+ var level;
+ $.each(this.chapters, function (k, v) {
+ if (!vu) {
+ if (v.page == '#' + sub) {
+ vu = true;
+ level = v.level;
+ baseLevel = v.level + 1;
+ $this.titles[sub] = v.label;
+ $this.colors[sub] = v.color;
+ }
+ return true;
+ } else {
+ if (v.level > level) {
+ base.push(v);
+ } else {
+ return false;
+ }
+ }
+ });
+ }
+
var $this = this;
- this.html = '<ul class="chapters">';
- $.each(this.chapters, function (k, v) {
- $this.html += $this.addItem(v);
+ this.html[sub] = '<ul class="chapters">';
+ $.each(base, function (k, v) {
+ $this.html[sub] += $this.addItem(v, baseLevel);
});
- this.html += '</ul>';
+ this.html[sub] += '</ul>';
},
- addItem: function (chapter) {
+ addItem: function (chapter, baseLevel) {
+ if (baseLevel == undefined) {
+ baseLevel = 0;
+ }
+
if (chapter.label == '--' || chapter.label == '++') {
return "";
}
var res = '';
var href;
+ var level = chapter.level - baseLevel;
if (chapter.page != '') {
var p = this.fluidbook.virtualToPhysical(chapter.page);
href = this.cascade ? 'href="#"' : "nohref";
}
if (this.style == 'classic') {
- res += '<li data-level="' + chapter.level + '"><a ' + href + ' class="level' + chapter.level + '">';
+ res += '<li data-level="' + level + '"><a ' + href + ' class="level' + level + '">';
} else if (this.style == 'ina') {
- res += '<li style="background-color:#' + color + ';" data-level="' + chapter.level + '"><a ' + href + ' class="nodark level' + chapter.level + '">';
+ res += '<li style="background-color:#' + color + ';" data-level="' + level + '"><a ' + href + ' class="nodark level' + level + '">';
}
res += '<span>' + chapter.label + '</span>';
if (href != 'nohref') {
left: -1px;
}
- .background{
+ .background {
position: absolute;
top: 0px;
left: 0px;
top: 0px;
}
- &.right{
+ &.right {
.shade {
left: 0px;
}
}
- &.left{
- .shade{
+ &.left {
+ .shade {
right: 0px;
}
}
}
.mview {
- background-color: @menu-background;
+ .menu-color(@menu-background, @menu-button-background);
color: @menu-text;
position: absolute;
top: 0;
text-align: right;
a {
line-height: 12px;
- background-color: @menu-button-background;
border-radius: 2px;
text-transform: uppercase;
margin: 0 0 0 10px;
height: 60px;
padding: 22px;
line-height: 1;
- background-color: @menu-button-background;
z-index: 1;
.rtl & {
display: block;
text-align: left;
padding: 5px 32px;
+ transition: background-color 250ms;
.rtl & {
text-align: right;
}
font-weight: 600;
font-style: normal;
}
+
+@import "additional.less";
\ No newline at end of file
-ms-transition: all unit(@page-transition-duration*@factor, s) ease-in-out;
-o-transition: all unit(@page-transition-duration*@factor, s) ease-in-out;
transition: all unit(@page-transition-duration*@factor, s) ease-in-out;
+}
+
+.menu-color(@base-color) {
+ @green: max(45, min(255 - 45, green(@base-color)));
+ @red: max(45, min(255 - 45, red(@base-color)));
+ @blue: max(45, min(255 - 45, blue(@base-color)));
+ @secondary: overlay(rgb(@red, @green, @blue), #c0c0c0);
+ .menu-color-a(@base-color, @secondary);
+}
+
+.menu-color(@base-color,@secondary) {
+ .menu-color-a(@base-color, @secondary);
+}
+
+.menu-color-a(@background,@button) {
+ background: @background;
+
+ .fonctions {
+ a {
+ background-color: @button;
+ }
+ }
+
+ .caption {
+ div.button, a {
+ &.back {
+ background-color: @button;
+ }
+ }
+ }
+
+ .chapters{
+ a:hover{
+
+ background-color: @button;
+ }
+ }
}
\ No newline at end of file