this.datas = datas;
this.junk = datas.cacheDate;
this.zoom = new FluidbookZoom(this);
+ this.menu = new FluidbookMenu(this);
this.zoom.resetZoom();
this.cache = new FluidbookCache(datas);
this.service = new FluidbookService(this, datas.id);
this.ready();
$("#main").css('visibility', 'visible');
this.hideLoader(0, true);
-
+
if (this.support.transitions2d) {
$("#splash").css('opacity', 0).one(this.support.getTransitionEndEvent(true), function () {
$(this).remove();
}
$($this).trigger('changePage', [page]);
- this.closeView(function () {
+ this.menu.closeView(function () {
$this.pageTransition(page);
$this.zoom.resetZoom();
$this.stats.track(0, page);
}, true);
}
else {
- this.openView(args[1], args[2], args[3], function () {
+ this.menu.openView(args[1], args[2], args[3], function () {
$this.hideSplash();
});
this.zoom.resetZoom();
}
this.wopen(this.datas.url_link, '_blank');
},
- viewMode: function () {
- return $("#view .mview").length > 0;
- },
- openView: function (view, param1, param2, callback) {
- var $this = this;
- this.displayLoader();
- this.resetWaiters();
- setTimeout(function () {
- $this._openView(view, param1, param2, callback);
- }, 20);
- },
+
addWaiter: function (reset) {
if (reset == undefined) {
reset = false;
resetWaiters: function () {
this.waiters = [];
},
- _openView: function (view, param1, param2, callback) {
- var $this = this;
- var preload = {
- index: 'thumbnails',
- search: 'thumbnails',
- bookmark: 'thumbnails',
- video: 'extras'
- };
- if (!OFFLINEAPP && this.gal != null && preload[view] != undefined) {
- var w = this.addWaiter(true);
- this.gal.downloadAndCall(preload[view], function () {
- if ($this.waiterActive(w)) {
- $this.__openView(view, param1, param2, callback);
- }
- });
- } else {
- this.__openView(view, param1, param2, callback);
- }
- },
- __openView: function (view, param1, param2, callback) {
- var $this = this;
- var camelView = view.charAt(0).toUpperCase() + view.substr(1);
- var cb = function () {
- $this.openingView(callback);
- };
- if (view == 'index') {
- this.openIndex(this.l10n.__('overview'), undefined, true, cb);
- } else if (view == 'search') {
- this.searchString = param1;
- var group = param2;
- $("#q").val(param1);
- this.search.find(param1, function (r) {
- $this.displayResults(r, group, cb);
- });
- if (group == undefined) {
- this.stats.track(1, 0, param1);
- }
- } else if (view == 'video') {
- this.openVideo(param1, cb);
- } else if (view == 'audio') {
- this.openAudio(param1, cb);
- } else if (view == 'webvideo') {
- this.openWebVideo(param1, param2, cb);
- } else if (view == 'multimedia') {
- this.openMultimedia(param1, cb);
- } else if (view == 'chapters') {
- this.openChapters(cb);
- } else if (view == 'archives') {
- this.openArchives($("#nav #archives").data('tooltip'), cb);
- } else {
- this['open' + camelView](param1, param2, cb);
- }
- },
- openingView: function (callback) {
- var $this = this;
- this.resize.resizeView();
- this.tooltip.hideTooltip();
- var mview = $('#view .mview:last');
- if (this.support.transitions2d) {
- var vertFrom = {
- translateY: $(window).height() + 'px'
- };
- var vertTo = {
- translateY: '0px'
- };
- var horiFrom = {
- translateX: $(window).width() + 'px'
- };
- var horiTo = {
- translateX: '0px'
- };
- var from = vertFrom;
- var to = vertTo;
- if ($(mview).hasClass('hori')) {
- from = horiFrom;
- to = horiTo;
- }
-
- $(mview).show().removeClass('animate').transform(from);
- setTimeout(function () {
- $(mview).one($this.support.getTransitionEndEvent(), function () {
- $("#main").hide();
- $('body').addClass('view');
- $(mview).removeClass('animate');
- callback();
- $this.hideLoader();
- resize();
- }).addClass('animate').transform(to);
- }, 50);
- } else {
- $("#main").hide();
- $('body').addClass('view');
- $(mview).show();
- callback();
- this.hideLoader();
- resize();
- }
- },
- displayResults: function (data, group, callback) {
- var $this = this;
- var results = data.results;
- var hideNoResults = !this.datas.searchShowNoResultsPages;
- if (data.total <= 0) {
- alert(this.l10n.__('no result found'));
- window.location = "#/page/" + this.currentPage;
- return;
- }
-
- this.openIndex(this.l10n.__('search results for') + ' « ' + this.searchString + " »", group, false, function () {
- var hits = [];
- for (var i = 0; i <= $this.datas.pages; i++) {
- hits[i] = 0;
- }
-
- $.each(results, function (k, v) {
- hits[k] += v;
- });
- var e = encodeURIComponent($this.searchString);
- $(".doubleThumb").each(function () {
- var pages = $(this).data('pages').toString().split(',');
- var hitsp = 0;
- var pagesWithHits = [];
- for (var i in pages) {
- var n = parseInt(pages[i]);
- if (hits[n] > 0) {
- hitsp += hits[n];
- pagesWithHits.push(pages[i]);
- }
- }
-
- if ($(this))
- if ($(this).find('.hits').length > 0) {
- return;
- }
-
- if (hitsp == 0) {
- if (hideNoResults) {
- $(this).remove();
- return;
- }
- $(this).append('<div class="overlay"></div>');
- $(this).append('<div class="hits no">' + $this.l10n.__('no result found') + '</div>');
- } else {
- $(this).append('<div class="hits yes">' + hitsp + ' ' + $this.l10n.__('hit(s)') + '</div>');
- if ($this.pad.enabled) {
- if (pagesWithHits.length == 1) {
- $(this).find('a').attr('href', '#/page/' + pagesWithHits[0]);
- } else {
- $(this).find('a').attr('href', '#/search/' + e + '/' + $(this).attr('page'));
- }
- } else {
- $(this).find('a').attr('href', '#/page/' + $(this).attr('page'));
- }
- }
- });
- $this.termsToHighlight = data.terms;
- if (callback != undefined) {
- callback();
- }
- });
- },
- openMultimedia: function (multimedia, callback) {
- var a = $('a[href="#/multimedia/' + multimedia + '"]');
- var markup = decodeURIComponent($(a).attr('data-multimedia'));
- var view = '<div class="caption"><a href="#" class="back">' + this.l10n.__('back') + '</a></div>';
- view += '<div class="content"><div class="multimediaScale">';
- view += markup;
- view += '</div></div>';
- $("#view").append('<div class="mview" dir="ltr">' + view + '</div>');
- if (callback != undefined) {
- callback();
- }
- },
- openVideo: function (video, callback) {
- var a = $('a[href="#/video/' + video + '"]');
- var markup = decodeURIComponent($(a).attr('data-video'));
- var view = '<div class="caption"><a href="#" class="back">' + this.l10n.__('back') + '</a></div>';
- view += '<div class="content">';
- view += markup;
- view += '</div>';
- $("#view").append('<div class="mview">' + view + '</div>');
- this.stats.track(11);
- this.initVideos();
- var $this = this;
- var times = [250, 500, 750, 1000, 1250];
- $.each(times, function (k, v) {
- setTimeout(function () {
- $this.resize.resizePopupVideos();
- }, v);
- });
- if (callback != undefined) {
- callback();
- }
- this.hideLoader(5);
- },
- openAudio: function (audio, callback) {
- var a = $('a[href="#/audio/' + audio + '"]');
- var markup = decodeURIComponent($(a).attr('data-audio'));
- var view = '<div class="caption"><a href="#" class="back">' + this.l10n.__('back') + '</a></div>';
- view += '<div class="content">';
- view += markup;
- view += '</div>';
- $("#view").append('<div class="mview">' + view + '</div>');
- this.stats.track(11);
- var $this = this;
- var times = [250, 500, 750, 1000, 1250];
- $.each(times, function (k, v) {
- setTimeout(function () {
- $this.resize.resizePopupAudios();
- }, v);
- });
- if (callback != undefined) {
- callback();
- }
- },
- openWebVideo: function (service, video, callback) {
-
- var view = '<div class="caption"><a href="#" class="back">' + this.l10n.__('back') + '</a></div>';
- view += '<div class="content">';
- var h = this.resize.getPopupWebVideoHeight();
- if (service == 'youtube') {
- view += '<iframe class="webvideo" type="text/html" width="100%" height="' + h + '" src="https://www.youtube.com/embed/' + video + '?autoplay=1&modestbranding=1&rel=0&html5=1" frameborder="0"></iframe>';
- } else if (service == 'dailymotion') {
- view += '<iframe class="webvideo" type="text/html" width="100%" height="' + h + '" src="https://www.dailymotion.com/embed/video/' + video + '?autoplay=1&logo=0&related=0&html5=1" width="100%" frameborder="0"></iframe>'
- } else if (service == 'brightcove') {
- view += '<iframe class="webvideo" type="text/html" width="100%" height="' + h + '" src="./video/brightcove.html?pid=' + DATAS.brightcovePlayerId + '&pk=' + encodeURIComponent(DATAS.brightcovePlayerSecret) + '&vid=' + video + '" width="100%" frameborder="0"></iframe>'
- }
- view += '</div>';
- $("#view").append('<div class="mview">' + view + '</div>');
- $("#view .mview:last iframe").each(function () {
- $(this).attr('height', h);
- $(this).css('height', h);
- });
- this.stats.track(11);
- if (callback != undefined) {
- callback();
- }
- },
- openLocales: function (p1, p2, callback) {
- var view = '<div class="caption"><a href="#" class="back">' + this.l10n.__('back') + '</a><h2>Select language</h2></div>';
- view += '<div class="content">';
- view += '<ul class="chapters localesList">';
- var $this = this;
- $.each(this.l10n.multilang, function (k, v) {
- var url = v.url;
- if (url.substr(0, 3) == '../' && !$this.datas.standalone) {
- url = '../' + url;
- }
- /*'datas' => array(__('Langue') => 'lang',
- __('Langue') . ' (' . __('Pays') . ')' => 'lang_country',
- __('Pays') . ' (' . __('Langue') . ')' => 'country_lang'));*/
-
- var name = '';
- if ($this.datas.multilangDisplay == 'lang') {
- name = v.langName;
- } else if ($this.datas.multilangDisplay == 'lang_country') {
- name = v.langName + ' (' + v.countryName + ')';
- } else if ($this.datas.multilangDisplay == 'country_lang') {
- name = v.countryName + ' (' + v.langName + ')';
- }
-
- var c = '';
- if ($this.datas.phonegap) {
- view += '<li data-level="0"><a href="#" data-id="' + url + '" data-locale="' + v.lang + '" class="level0 appswitchlocale"><img src="images/flags/' + v.flag + '.png" alt="' + name + '" />' + name + '</a></li>';
- } else {
- view += '<li data-level="0"><a href="' + url + '" class="level0"><img src="images/flags/' + v.flag + '.png" alt="' + name + '" />' + name + '</a></li>';
- }
- });
- view += '</ul>';
- view += '</div>';
- $("#view").append('<div class="mview">' + view + '</div>');
- if (callback != undefined) {
- callback();
- }
- },
- openShare: function (p1, p2, callback) {
- var view = '<div class="caption"><a href="#" class="back">' + this.l10n.__('back') + '</a><h2>' + this.l10n.__('share') + '</h2></div>';
- view += '<div class="content">';
- view += '<ul class="chapters shareList">';
- var $this = this;
- if (this.datas.friend) {
- view += '<li data-level="0"><a href="#" data-service="email" class="share level0"><img height="25" src="data/images/share-email.svg" /> E-mail</a></li>';
- }
- if (this.datas.facebook) {
- view += '<li data-level="0"><a href="#" data-service="facebook" class="share level0"><img height="25" src="data/images/share-facebook.svg" /> Facebook</a></li>';
- }
- if (this.datas.twitter) {
- view += '<li data-level="0"><a href="#" data-service="twitter" class="share level0"><img height="25" src="data/images/share-twitter.svg" /> Twitter</a></li>';
- }
- if (this.datas.googleplus) {
- view += '<li data-level="0"><a href="#" data-service="googleplus" class="share level0"><img height="25" src="data/images/share-googleplus.svg" /> Google+</a></li>';
- }
- if (this.datas.linkedin) {
- view += '<li data-level="0"><a href="#" data-service="linkedin" class="share level0"><img height="25" src="data/images/share-linkedin.svg" /> LinkedIn</a></li>';
- }
- if (this.datas.viadeo) {
- view += '<li data-level="0"><a href="#" data-service="viadeo" class="share level0"><img height="25" src="data/images/share-viadeo.svg" /> Viadeo</a></li>';
- }
- view += '</ul>';
- view += '</div>';
- $("#view").append('<div class="mview">' + view + '</div>');
- if (callback != undefined) {
- callback();
- }
- },
- openBookmark: function (p1, p2, callback) {
- var view = this.bookmarks.getView();
- if (view !== false) {
- $("#view").append('<div class="mview">' + view + '</div>');
- if (callback != undefined) {
- callback();
- }
- } else {
- var message = this.l10n.__("you don't have any bookmarks");
- if (this.datas.phonegap) {
- navigator.notification.alert(message, function () {
-
- }, this.l10n.__('bookmarks'));
- } else {
- window.alert(message);
- window.history.back();
- }
- this.hideLoader();
- }
- },
- openChapters: function (callback) {
- if (this.chapters == undefined) {
- this.chapters = new FluidbookChapters(this, this.datas.chapters);
- }
-
- var view = '<div class="caption"><a href="#" class="back">' + this.l10n.__('back') + '</a><h2>' + this.l10n.__('chapters') + '</h2></div>';
- view += '<div class="content">';
- view += this.chapters.getView();
- view += '</div>';
- $("#view").append('<div class="mview">' + view + '</div>');
- if (callback != undefined) {
- callback();
- }
- },
- openIndex: function (title, group, closeAll, callback) {
- var c = !closeAll ? ' one' : '';
- var index = '<div class="caption"><a href="#" class="back' + c + '">' + this.l10n.__('back') + '</a><h2>' + title + '</h2></div>';
- index += this.index.getView(group);
- $("#view").append('<div class="mview">' + index + '</div>');
- this.bookmarks.updateBookmarks();
- if (callback != undefined) {
- callback();
- }
- },
- openArchives: function (title, callback) {
- var archives = '<div class="caption"><a href="#" class="back">' + this.l10n.__('back') + '</a><h2>' + title + '</h2></div>';
- archives += '<div class="image" id="archivesview"><img src="data/images/' + this.datas.externalArchives + '" /><div class="links">' + this.datas.links.archives + '</div></div>';
- $("#view").append('<div class="mview archives">' + archives + '</div>');
- if (callback != undefined) {
- callback();
- }
- },
physicalToVirtual: function (page) {
return this.datas.numerotation[page - 1];
},
virtualToPhysical: function (page) {
return this.datas.numerotation.indexOf(page) + 1;
},
- closeView: function (callback, all, animate) {
- var $this = this;
- if (all == undefined) {
- all = false;
- }
- if (animate == undefined) {
- animate = true;
- }
-
- $('video').each(function () {
- this.pause();
- });
-
- if ($('.mview').scrollTop() > 0) {
- $('.mview').scrollTo(0, 500, function () {
- $this.closeView(callback, all, animate);
- });
- return;
- }
- all = all || ($("#view .mview").length <= 1);
- if (!this.viewMode()) {
- callback();
- return;
- }
-
- this.video.pauseAllVideos();
-
- var mview = $("#view .mview:last");
- if (all) {
- var s = $("#view .mview:not(:last)");
- this.video.killVideosIn(s);
- $(s).remove();
- }
-
-
- var to = {
- translateY: $(window).height() + 'px'
- };
- if ($(mview).hasClass('hori')) {
- to = {translateX: $(window).width() + 'px'}
- }
-
- if (animate && this.support.transitions2d) {
- setTimeout(function () {
- $(mview).one($this.support.getTransitionEndEvent(), function () {
- $this.video.killVideosIn(this);
- $(this).remove();
- callback();
- }).addClass('animate').transform(to);
- }, 50);
- } else {
- this.video.killVideosIn(mview);
- $(mview).remove()
- callback();
- }
- if (all) {
- $("#main").show();
- $('body').removeClass('view');
- }
- resize();
- },
getSearchHints: function (q) {
var $this = this;
parent = $link.closest('.link'),
linkId = $(parent).attr('id').split('_', 2)[1],
maxZoom = parseInt($link.data('maxzoom')) || 2,
- zoomImage = 'data/links/zoom_' + linkId + '.png',
+ zoomImage = 'data/links/zoom_' + linkId + '.jpg',
x,
y,
zoomWidth,
return;
}
- var $this=this;
+ var $this = this;
if (this.texts[pageNr] != undefined) {
$("#page_" + pageNr + ' .texts').append(this.texts[pageNr]);
_loadTexts: function (pageNr, callback) {
var w = this.fluidbook.datas.width / 0.75;
var h = this.fluidbook.datas.height / 0.75;
-
- console.log('_load texts ' + pageNr);
-
this.texts[pageNr] = this.loadImage(this.getTextsURL(pageNr), w, h, 'image/svg+xml', callback);
},
loadDatas: function (pageNr, callback) {
if (callback && typeof callback == 'function') {
$(img).one('load', function () {
setTimeout(function () {
- console.log('loaded '+src);
callback();
}, 10);
});
$(img).on('error', function () {
$this.imagesErrors.push(this);
setTimeout(function () {
- console.log('error');
callback();
}, 10);
});
}
if (callback && typeof callback == 'function' && (img.complete || img.readyState == 'complete' || img.readyState == 4)) {
setTimeout(function () {
- console.log('complete');
callback();
}, 10);
}
--- /dev/null
+function FluidbookMenu(fluidbook) {
+ this.fluidbook = fluidbook;
+ this.init();
+}
+
+FluidbookMenu.prototype = {
+ init: function () {
+
+ },
+
+ viewMode: function () {
+ return $("#view .mview").length > 0;
+ },
+ openView: function (view, param1, param2, callback) {
+ var $this = this;
+ this.fluidbook.displayLoader();
+ this.fluidbook.resetWaiters();
+ setTimeout(function () {
+ $this._openView(view, param1, param2, callback);
+ }, 20);
+ },
+
+ _openView: function (view, param1, param2, callback) {
+ var $this = this;
+ var preload = {
+ index: 'thumbnails',
+ search: 'thumbnails',
+ bookmark: 'thumbnails',
+ video: 'extras'
+ };
+ if (!OFFLINEAPP && this.fluidbook.gal != null && preload[view] != undefined) {
+ var w = this.fluidbook.addWaiter(true);
+ this.fluidbook.gal.downloadAndCall(preload[view], function () {
+ if ($this.fluidbook.waiterActive(w)) {
+ $this.__openView(view, param1, param2, callback);
+ }
+ });
+ } else {
+ this.__openView(view, param1, param2, callback);
+ }
+ },
+ __openView: function (view, param1, param2, callback) {
+ var $this = this;
+ var camelView = view.charAt(0).toUpperCase() + view.substr(1);
+ var cb = function () {
+ $this.openingView(callback);
+ };
+ if (view == 'index') {
+ this.openIndex(this.fluidbook.l10n.__('overview'), undefined, true, cb);
+ } else if (view == 'search') {
+ this.searchString = param1;
+ var group = param2;
+ $("#q").val(param1);
+ this.fluidbook.search.find(param1, function (r) {
+ $this.displayResults(r, group, cb);
+ });
+ if (group == undefined) {
+ this.fluidbook.stats.track(1, 0, param1);
+ }
+ } else if (view == 'video') {
+ this.openVideo(param1, cb);
+ } else if (view == 'audio') {
+ this.openAudio(param1, cb);
+ } else if (view == 'webvideo') {
+ this.openWebVideo(param1, param2, cb);
+ } else if (view == 'multimedia') {
+ this.openMultimedia(param1, cb);
+ } else if (view == 'chapters') {
+ this.openChapters(cb);
+ } else if (view == 'archives') {
+ this.openArchives($("#nav #archives").data('tooltip'), cb);
+ } else {
+ this['open' + camelView](param1, param2, cb);
+ }
+ },
+ openingView: function (callback) {
+ var $this = this;
+ this.fluidbook.resize.resizeView();
+ this.fluidbook.tooltip.hideTooltip();
+ var mview = $('#view .mview:last');
+
+ $(mview).show();
+ TweenMax.from($(mview), 0.5, {autoAlpha: 0}, {
+ autoAlpha: 1, onComplete: function () {
+ callback();
+ $this.fluidbook.hideLoader();
+ resize();
+ }
+ });
+ },
+
+ displayResults: function (data, group, callback) {
+ var $this = this;
+ var results = data.results;
+ var hideNoResults = !this.fluidbook.datas.searchShowNoResultsPages;
+ if (data.total <= 0) {
+ alert(this.fluidbook.l10n.__('no result found'));
+ window.location = "#/page/" + this.currentPage;
+ return;
+ }
+
+ this.openIndex(this.fluidbook.l10n.__('search results for') + ' « ' + this.searchString + " »", group, false, function () {
+ var hits = [];
+ for (var i = 0; i <= $this.fluidbook.datas.pages; i++) {
+ hits[i] = 0;
+ }
+
+ $.each(results, function (k, v) {
+ hits[k] += v;
+ });
+ var e = encodeURIComponent($this.searchString);
+ $(".doubleThumb").each(function () {
+ var pages = $(this).data('pages').toString().split(',');
+ var hitsp = 0;
+ var pagesWithHits = [];
+ for (var i in pages) {
+ var n = parseInt(pages[i]);
+ if (hits[n] > 0) {
+ hitsp += hits[n];
+ pagesWithHits.push(pages[i]);
+ }
+ }
+
+ if ($(this))
+ if ($(this).find('.hits').length > 0) {
+ return;
+ }
+
+ if (hitsp == 0) {
+ if (hideNoResults) {
+ $(this).remove();
+ return;
+ }
+ $(this).append('<div class="overlay"></div>');
+ $(this).append('<div class="hits no">' + $this.fluidbook.l10n.__('no result found') + '</div>');
+ } else {
+ $(this).append('<div class="hits yes">' + hitsp + ' ' + $this.fluidbook.l10n.__('hit(s)') + '</div>');
+ if ($this.fluidbook.pad.enabled) {
+ if (pagesWithHits.length == 1) {
+ $(this).find('a').attr('href', '#/page/' + pagesWithHits[0]);
+ } else {
+ $(this).find('a').attr('href', '#/search/' + e + '/' + $(this).attr('page'));
+ }
+ } else {
+ $(this).find('a').attr('href', '#/page/' + $(this).attr('page'));
+ }
+ }
+ });
+ $this.termsToHighlight = data.terms;
+ if (callback != undefined) {
+ callback();
+ }
+ });
+ },
+ openMultimedia: function (multimedia, callback) {
+ var a = $('a[href="#/multimedia/' + multimedia + '"]');
+ var markup = decodeURIComponent($(a).attr('data-multimedia'));
+ var view = '<div class="caption"><a href="#" class="back">' + this.fluidbook.l10n.__('back') + '</a></div>';
+ view += '<div class="content"><div class="multimediaScale">';
+ view += markup;
+ view += '</div></div>';
+ $("#view").append('<div class="mview" dir="ltr">' + view + '</div>');
+ if (callback != undefined) {
+ callback();
+ }
+ },
+ openVideo: function (video, callback) {
+ var a = $('a[href="#/video/' + video + '"]');
+ var markup = decodeURIComponent($(a).attr('data-video'));
+ var view = '<div class="caption"><a href="#" class="back">' + this.fluidbook.l10n.__('back') + '</a></div>';
+ view += '<div class="content">';
+ view += markup;
+ view += '</div>';
+ $("#view").append('<div class="mview">' + view + '</div>');
+ this.fluidbook.stats.track(11);
+ this.fluidbook.initVideos();
+ var $this = this;
+ var times = [250, 500, 750, 1000, 1250];
+ $.each(times, function (k, v) {
+ setTimeout(function () {
+ $this.fluidbook.resize.resizePopupVideos();
+ }, v);
+ });
+ if (callback != undefined) {
+ callback();
+ }
+ this.fluidbook.hideLoader(5);
+ },
+ openAudio: function (audio, callback) {
+ var a = $('a[href="#/audio/' + audio + '"]');
+ var markup = decodeURIComponent($(a).attr('data-audio'));
+ var view = '<div class="caption"><a href="#" class="back">' + this.fluidbook.l10n.__('back') + '</a></div>';
+ view += '<div class="content">';
+ view += markup;
+ view += '</div>';
+ $("#view").append('<div class="mview">' + view + '</div>');
+ this.fluidbook.stats.track(11);
+ var $this = this;
+ var times = [250, 500, 750, 1000, 1250];
+ $.each(times, function (k, v) {
+ setTimeout(function () {
+ $this.fluidbook.resize.resizePopupAudios();
+ }, v);
+ });
+ if (callback != undefined) {
+ callback();
+ }
+ },
+ openWebVideo: function (service, video, callback) {
+
+ var view = '<div class="caption"><a href="#" class="back">' + this.fluidbook.l10n.__('back') + '</a></div>';
+ view += '<div class="content">';
+
+ var h = this.fluidbook.resize.getPopupWebVideoHeight();
+
+ if (service == 'youtube') {
+ view += '<iframe class="webvideo" type="text/html" width="100%" height="' + h + '" src="https://www.youtube.com/embed/' + video + '?autoplay=1&modestbranding=1&rel=0&html5=1" frameborder="0"></iframe>';
+ } else if (service == 'dailymotion') {
+ view += '<iframe class="webvideo" type="text/html" width="100%" height="' + h + '" src="https://www.dailymotion.com/embed/video/' + video + '?autoplay=1&logo=0&related=0&html5=1" width="100%" frameborder="0"></iframe>'
+ } else if (service == 'brightcove') {
+ view += '<iframe class="webvideo" type="text/html" width="100%" height="' + h + '" src="./video/brightcove.html?pid=' + DATAS.brightcovePlayerId + '&pk=' + encodeURIComponent(DATAS.brightcovePlayerSecret) + '&vid=' + video + '" width="100%" frameborder="0"></iframe>'
+ }
+ view += '</div>';
+ $("#view").append('<div class="mview">' + view + '</div>');
+ $("#view .mview:last iframe").each(function () {
+ $(this).attr('height', h);
+ $(this).css('height', h);
+ });
+ this.fluidbook.stats.track(11);
+ if (callback != undefined) {
+ callback();
+ }
+ },
+ openLocales: function (p1, p2, callback) {
+ var view = '<div class="caption"><a href="#" class="back">' + this.fluidbook.l10n.__('back') + '</a><h2>Select language</h2></div>';
+ view += '<div class="content">';
+ view += '<ul class="chapters localesList">';
+ var $this = this;
+ $.each(this.fluidbook.l10n.multilang, function (k, v) {
+ var url = v.url;
+ if (url.substr(0, 3) == '../' && !$this.fluidbook.datas.standalone) {
+ url = '../' + url;
+ }
+ /*'datas' => array(__('Langue') => 'lang',
+ __('Langue') . ' (' . __('Pays') . ')' => 'lang_country',
+ __('Pays') . ' (' . __('Langue') . ')' => 'country_lang'));*/
+
+ var name = '';
+ if ($this.fluidbook.datas.multilangDisplay == 'lang') {
+ name = v.langName;
+ } else if ($this.fluidbook.datas.multilangDisplay == 'lang_country') {
+ name = v.langName + ' (' + v.countryName + ')';
+ } else if ($this.fluidbook.datas.multilangDisplay == 'country_lang') {
+ name = v.countryName + ' (' + v.langName + ')';
+ }
+
+ var c = '';
+ if ($this.fluidbook.datas.phonegap) {
+ view += '<li data-level="0"><a href="#" data-id="' + url + '" data-locale="' + v.lang + '" class="level0 appswitchlocale"><img src="images/flags/' + v.flag + '.png" alt="' + name + '" />' + name + '</a></li>';
+ } else {
+ view += '<li data-level="0"><a href="' + url + '" class="level0"><img src="images/flags/' + v.flag + '.png" alt="' + name + '" />' + name + '</a></li>';
+ }
+ });
+ view += '</ul>';
+ view += '</div>';
+ $("#view").append('<div class="mview">' + view + '</div>');
+ if (callback != undefined) {
+ callback();
+ }
+ },
+ openShare: function (p1, p2, callback) {
+ var view = '<div class="caption"><a href="#" class="back">' + this.fluidbook.l10n.__('back') + '</a><h2>' + this.fluidbook.l10n.__('share') + '</h2></div>';
+ view += '<div class="content">';
+ view += '<ul class="chapters shareList">';
+ var $this = this;
+ if (this.fluidbook.datas.friend) {
+ view += '<li data-level="0"><a href="#" data-service="email" class="share level0"><img height="25" src="data/images/share-email.svg" /> E-mail</a></li>';
+ }
+ if (this.fluidbook.datas.facebook) {
+ view += '<li data-level="0"><a href="#" data-service="facebook" class="share level0"><img height="25" src="data/images/share-facebook.svg" /> Facebook</a></li>';
+ }
+ if (this.fluidbook.datas.twitter) {
+ view += '<li data-level="0"><a href="#" data-service="twitter" class="share level0"><img height="25" src="data/images/share-twitter.svg" /> Twitter</a></li>';
+ }
+ if (this.fluidbook.datas.googleplus) {
+ view += '<li data-level="0"><a href="#" data-service="googleplus" class="share level0"><img height="25" src="data/images/share-googleplus.svg" /> Google+</a></li>';
+ }
+ if (this.fluidbook.datas.linkedin) {
+ view += '<li data-level="0"><a href="#" data-service="linkedin" class="share level0"><img height="25" src="data/images/share-linkedin.svg" /> LinkedIn</a></li>';
+ }
+ if (this.fluidbook.datas.viadeo) {
+ view += '<li data-level="0"><a href="#" data-service="viadeo" class="share level0"><img height="25" src="data/images/share-viadeo.svg" /> Viadeo</a></li>';
+ }
+ view += '</ul>';
+ view += '</div>';
+ $("#view").append('<div class="mview">' + view + '</div>');
+ if (callback != undefined) {
+ callback();
+ }
+ },
+ openBookmark: function (p1, p2, callback) {
+ var view = this.fluidbook.bookmarks.getView();
+ if (view !== false) {
+ $("#view").append('<div class="mview">' + view + '</div>');
+ if (callback != undefined) {
+ callback();
+ }
+ } else {
+ var message = this.fluidbook.l10n.__("you don't have any bookmarks");
+ if (this.fluidbook.datas.phonegap) {
+ navigator.notification.alert(message, function () {
+
+ }, this.fluidbook.l10n.__('bookmarks'));
+ } else {
+ window.alert(message);
+ window.history.back();
+ }
+ this.fluidbook.hideLoader();
+ }
+ },
+ openChapters: function (callback) {
+ if (this.fluidbook.chapters == undefined) {
+ this.fluidbook.chapters = new FluidbookChapters(this.fluidbook, this.fluidbook.datas.chapters);
+ }
+
+ var view = '<div class="caption"><a href="#" class="back">' + this.fluidbook.l10n.__('back') + '</a><h2>' + this.fluidbook.l10n.__('chapters') + '</h2></div>';
+ view += '<div class="content">';
+ view += this.fluidbook.chapters.getView();
+ view += '</div>';
+ $("#view").append('<div class="mview">' + view + '</div>');
+ if (callback != undefined) {
+ callback();
+ }
+ },
+ openIndex: function (title, group, closeAll, callback) {
+ var c = !closeAll ? ' one' : '';
+ var index = '<div class="caption"><a href="#" class="back' + c + '">' + this.fluidbook.l10n.__('back') + '</a><h2>' + title + '</h2></div>';
+ index += this.fluidbook.index.getView(group);
+ $("#view").append('<div class="mview">' + index + '</div>');
+ this.fluidbook.bookmarks.updateBookmarks();
+ if (callback != undefined) {
+ callback();
+ }
+ },
+ openArchives: function (title, callback) {
+ var archives = '<div class="caption"><a href="#" class="back">' + this.fluidbook.l10n.__('back') + '</a><h2>' + title + '</h2></div>';
+ archives += '<div class="image" id="archivesview"><img src="data/images/' + this.fluidbook.datas.externalArchives + '" /><div class="links">' + this.fluidbook.datas.links.archives + '</div></div>';
+ $("#view").append('<div class="mview archives">' + archives + '</div>');
+ if (callback != undefined) {
+ callback();
+ }
+ },
+ closeView: function (callback, all, animate) {
+ var $this = this;
+ if (all == undefined) {
+ all = false;
+ }
+ if (animate == undefined) {
+ animate = true;
+ }
+
+ $('video').each(function () {
+ this.pause();
+ });
+
+ if ($('.mview').scrollTop() > 0) {
+ $('.mview').scrollTo(0, 500, function () {
+ $this.closeView(callback, all, animate);
+ });
+ return;
+ }
+
+ all = all || ($("#view .mview").length <= 1);
+ if (!this.viewMode()) {
+ callback();
+ return;
+ }
+
+ this.fluidbook.video.pauseAllVideos();
+
+ var mview = $("#view .mview:last");
+ if (all) {
+ var s = $("#view .mview:not(:last)");
+ this.fluidbook.video.killVideosIn(s);
+ $(s).remove();
+ }
+
+
+ var to = {
+ translateY: $(window).height() + 'px'
+ };
+ if ($(mview).hasClass('hori')) {
+ to = {translateX: $(window).width() + 'px'}
+ }
+
+ if (animate && this.fluidbook.support.transitions2d) {
+ setTimeout(function () {
+ $(mview).one($this.fluidbook.support.getTransitionEndEvent(), function () {
+ $this.fluidbook.video.killVideosIn(this);
+ $(this).remove();
+ callback();
+ }).addClass('animate').transform(to);
+ }, 50);
+ } else {
+ this.fluidbook.video.killVideosIn(mview);
+ $(mview).remove()
+ callback();
+ }
+ if (all) {
+ $("#main").show();
+ $('body').removeClass('view');
+ }
+ resize();
+ },
+};
\ No newline at end of file
this.videoFormats = $.merge(probably, maybe, not);
this.preferedFormat = this.videoFormats[0];
- fb("Video prefered format : " + this.preferedFormat + " (" + this.videoFormats.join(', ') + ")");
}
FluidbookVideo.prototype = {
}
zoom = Math.max(Math.min(zoom, this.max), 1);
- if (this.fluidbook.viewMode()) {
+ if (this.fluidbook.menu.viewMode()) {
zoom = 1;
}
if (this.zoom == zoom) {
--- /dev/null
+function FluidbookChapters(fluidbook, chapters) {
+ this.fluidbook = fluidbook;
+ this.chapters = chapters;
+ this.style = 'classic';
+ if (this.fluidbook.datas.mobileChaptersStyle) {
+ this.style = this.fluidbook.datas.mobileChaptersStyle;
+ }
+ this.html = '';
+ this.lastColor;
+}
+
+FluidbookChapters.prototype = {
+ getView: function() {
+ if (this.html == '') {
+ this.makeView();
+ }
+ return this.html;
+ },
+ makeView: function() {
+ this.makeClassicMenu();
+ if (this.fluidbook.datas.chaptersCascade) {
+ this.makeCascadeMenu();
+ }
+ },
+ makeCascadeMenu: function() {
+ var h = $(this.html);
+
+ for (var i = 3; i >= 0; i--) {
+ $(h).find('li[data-level=' + i + ']').each(function() {
+ var siblings = $(this).nextUntil('li[data-level!=' + (i + 1) + ']', 'li[data-level=' + (i + 1) + ']');
+ if (siblings.length > 0) {
+ $(this).append('<ul></ul>');
+ var nav = $(this).find('ul');
+ $(nav).append(siblings);
+ $(nav).hide();
+ }
+ });
+ }
+ this.html = $(h).get(0).outerHTML;
+
+ if (this.style == 'ina') {
+ $(document).on('click', 'ul.chapters a .right', function(e) {
+ var p = $(this).data('page');
+ if (p != '') {
+ $this.fluidbook.setCurrentPage(p);
+ e.stopImmediatePropagation();
+ e.stopPropagation();
+ e.preventDefault();
+ return false;
+ }
+ });
+ }
+
+ $(document).on('click', 'ul.chapters a', function() {
+ var li = $(this).parent();
+ var subnav = $(li).children('ul');
+ if ($(subnav).length) {
+ $(subnav).slideToggle();
+ return false;
+ } else {
+ return true;
+ }
+ });
+ },
+ makeClassicMenu: function() {
+ var $this = this;
+ this.html = '<ul class="chapters">';
+ $.each(this.chapters, function(k, v) {
+ $this.html += $this.addItem(v);
+ });
+ this.html += '</ul>';
+ },
+ addItem: function(chapter) {
+ if (chapter.label == '--' || chapter.label == '++') {
+ return "";
+ }
+ var color = chapter.color;
+ if (color == '') {
+ if (this.lastColor != undefined) {
+ color = this.lastColor;
+ }
+ }
+ if (color != '') {
+ this.lastColor = color;
+ }
+
+ if (chapter.label.substr(0, 3) == '!!!') {
+ chapter.label = chapter.label.substring(3);
+ chapter.level = '-1';
+ }
+
+ var p = (this.fluidbook.virtualToPhysical(chapter.page));
+
+ var res = '';
+ if (this.style == 'classic') {
+ res += '<li data-level="' + chapter.level + '"><a href="#/page/' + p + '" class="level' + chapter.level + '">';
+ } else if (this.style == 'ina') {
+ res += '<li style="background-color:#' + color + ';" data-level="' + chapter.level + '"><a href="#/page/' + p + '" class="nodark level' + chapter.level + '">';
+ }
+ res += chapter.label;
+ res += '<div class="right" data-page="' + p + '">';
+
+ if (this.style == 'classic') {
+ if (color == '') {
+ if (chapter.page != '') {
+ res += '<span class="pagen">' + chapter.page + '</span>';
+ }
+ } else {
+ res += '<div class="puce" style="background-color:#' + color + ';"></div>';
+ }
+ } else {
+ if (chapter.page != '') {
+ res += '<span class="pagen">' + chapter.page + '</span>';
+ }
+ res += '<div class="puce noshadow"></div>';
+ }
+ res += '</div>'
+ res += '</a></li>';
+
+ return res;
+ }
+};
+
--- /dev/null
+function FluidbookIndex(fluidbook) {
+ this.fluidbook = fluidbook;
+ this.init();
+}
+
+FluidbookIndex.prototype = {
+ init: function() {
+ this.normalHTML = '';
+ this.padHTML = '';
+ },
+ getView: function(group) {
+ if (this.fluidbook.pad.enabled) {
+ return this.getPadView(group);
+ } else {
+ return this.getNormalView();
+ }
+ },
+ getPadView: function(group) {
+ return this.fluidbook.bookmarks.getIndex(true, group);
+ },
+ getNormalView: function() {
+
+ if (this.normalHTML == '') {
+ this.normalHTML += '<div class="content"><div id="indexView">';
+ var j = 0;
+ var ix1 = '', ix2 = '', ix = '';
+ var c = '';
+ var s1, s2;
+
+ for (var i = 0; i <= this.fluidbook.datas.pages; i += 2) {
+ var pages = [];
+ j = i + 1;
+ ix1 = '';
+ ix2 = '';
+ c = '';
+
+ if (this.fluidbook.l10n.dir == 'ltr') {
+ s1 = 'left';
+ s2 = 'right'
+ } else {
+ s1 = 'right';
+ s2 = 'left'
+ }
+
+ if (i > 0) {
+ ix1 += '<div class="thumb ' + s1 + '"><a href="#/page/' + i + '">' + this.fluidbook.loader.getImage('data/thumbnails/p' + i + '.jpg') + '</a><span class="number">' + this.fluidbook.physicalToVirtual(i) + '</span>';
+ if (this.fluidbook.bookmarks.enabled) {
+ ix1 += this.fluidbook.bookmarks.getBookmarkForPage(i, true);
+ }
+ pages.push(i);
+ ix1 += '</div>';
+
+ } else {
+ c = ' simple ' + s2;
+ }
+
+ if (this.fluidbook.l10n.dir == 'rtl') {
+ s1 = 'left';
+ s2 = 'right'
+ } else {
+ s1 = 'right';
+ s2 = 'left'
+ }
+
+ if (j < this.fluidbook.datas.pages) {
+ ix2 += '<div class="thumb ' + s1 + '"><a href="#/page/' + j + '">' + this.fluidbook.loader.getImage('data/thumbnails/p' + j + '.jpg') + '</a><span class="number">' + this.fluidbook.physicalToVirtual(j) + '</span>';
+ if (this.fluidbook.bookmarks.enabled) {
+ ix2 += this.fluidbook.bookmarks.getBookmarkForPage(j, true);
+ }
+ ix2 += '</div>';
+ pages.push(j);
+ } else {
+ c = ' simple ' + s2;
+ }
+ ix = ix1 + ix2;
+ this.normalHTML += '<div class="doubleThumb' + c + '" page="' + i + '" data-pages="' + pages.join(',') + '">' + ix;
+ this.normalHTML += '</div>';
+ }
+ for (i = 0; i < 5; i++) {
+ this.normalHTML += '<div class="padding"></div>';
+ }
+ this.normalHTML += '</div></div>';
+ }
+
+ return this.normalHTML;
+ }
+}
+++ /dev/null
-function FluidbookChapters(fluidbook, chapters) {\r
- this.fluidbook = fluidbook;\r
- this.chapters = chapters;\r
- this.style = 'classic';\r
- if (this.fluidbook.datas.mobileChaptersStyle) {\r
- this.style = this.fluidbook.datas.mobileChaptersStyle;\r
- }\r
- this.html = '';\r
- this.lastColor;\r
-}\r
-\r
-FluidbookChapters.prototype = {\r
- getView: function() {\r
- if (this.html == '') {\r
- this.makeView();\r
- }\r
- return this.html;\r
- },\r
- makeView: function() {\r
- this.makeClassicMenu();\r
- if (this.fluidbook.datas.chaptersCascade) {\r
- this.makeCascadeMenu();\r
- }\r
- },\r
- makeCascadeMenu: function() {\r
- var h = $(this.html);\r
-\r
- for (var i = 3; i >= 0; i--) {\r
- $(h).find('li[data-level=' + i + ']').each(function() {\r
- var siblings = $(this).nextUntil('li[data-level!=' + (i + 1) + ']', 'li[data-level=' + (i + 1) + ']');\r
- if (siblings.length > 0) {\r
- $(this).append('<ul></ul>');\r
- var nav = $(this).find('ul');\r
- $(nav).append(siblings);\r
- $(nav).hide();\r
- }\r
- });\r
- }\r
- this.html = $(h).get(0).outerHTML;\r
-\r
- if (this.style == 'ina') {\r
- $(document).on('click', 'ul.chapters a .right', function(e) {\r
- var p = $(this).data('page');\r
- if (p != '') {\r
- $this.fluidbook.setCurrentPage(p);\r
- e.stopImmediatePropagation();\r
- e.stopPropagation();\r
- e.preventDefault();\r
- return false;\r
- }\r
- });\r
- }\r
-\r
- $(document).on('click', 'ul.chapters a', function() {\r
- var li = $(this).parent();\r
- var subnav = $(li).children('ul');\r
- if ($(subnav).length) {\r
- $(subnav).slideToggle();\r
- return false;\r
- } else {\r
- return true;\r
- }\r
- });\r
- },\r
- makeClassicMenu: function() {\r
- var $this = this;\r
- this.html = '<ul class="chapters">';\r
- $.each(this.chapters, function(k, v) {\r
- $this.html += $this.addItem(v);\r
- });\r
- this.html += '</ul>';\r
- },\r
- addItem: function(chapter) {\r
- if (chapter.label == '--' || chapter.label == '++') {\r
- return "";\r
- }\r
- var color = chapter.color;\r
- if (color == '') {\r
- if (this.lastColor != undefined) {\r
- color = this.lastColor;\r
- }\r
- }\r
- if (color != '') {\r
- this.lastColor = color;\r
- }\r
-\r
- if (chapter.label.substr(0, 3) == '!!!') {\r
- chapter.label = chapter.label.substring(3);\r
- chapter.level = '-1';\r
- }\r
-\r
- var p = (this.fluidbook.virtualToPhysical(chapter.page));\r
-\r
- var res = '';\r
- if (this.style == 'classic') {\r
- res += '<li data-level="' + chapter.level + '"><a href="#/page/' + p + '" class="level' + chapter.level + '">';\r
- } else if (this.style == 'ina') {\r
- res += '<li style="background-color:#' + color + ';" data-level="' + chapter.level + '"><a href="#/page/' + p + '" class="nodark level' + chapter.level + '">';\r
- }\r
- res += chapter.label;\r
- res += '<div class="right" data-page="' + p + '">';\r
-\r
- if (this.style == 'classic') {\r
- if (color == '') {\r
- if (chapter.page != '') {\r
- res += '<span class="pagen">' + chapter.page + '</span>';\r
- }\r
- } else {\r
- res += '<div class="puce" style="background-color:#' + color + ';"></div>';\r
- }\r
- } else {\r
- if (chapter.page != '') {\r
- res += '<span class="pagen">' + chapter.page + '</span>';\r
- }\r
- res += '<div class="puce noshadow"></div>';\r
- }\r
- res += '</div>'\r
- res += '</a></li>';\r
-\r
- return res;\r
- }\r
-};\r
-\r
+++ /dev/null
-function FluidbookIndex(fluidbook) {
- this.fluidbook = fluidbook;
- this.init();
-}
-
-FluidbookIndex.prototype = {
- init: function() {
- this.normalHTML = '';
- this.padHTML = '';
- },
- getView: function(group) {
- if (this.fluidbook.pad.enabled) {
- return this.getPadView(group);
- } else {
- return this.getNormalView();
- }
- },
- getPadView: function(group) {
- return this.fluidbook.bookmarks.getIndex(true, group);
- },
- getNormalView: function() {
-
- if (this.normalHTML == '') {
- this.normalHTML += '<div class="content"><div id="indexView">';
- var j = 0;
- var ix1 = '', ix2 = '', ix = '';
- var c = '';
- var s1, s2;
-
- for (var i = 0; i <= this.fluidbook.datas.pages; i += 2) {
- var pages = [];
- j = i + 1;
- ix1 = '';
- ix2 = '';
- c = '';
-
- if (this.fluidbook.l10n.dir == 'ltr') {
- s1 = 'left';
- s2 = 'right'
- } else {
- s1 = 'right';
- s2 = 'left'
- }
-
- if (i > 0) {
- ix1 += '<div class="thumb ' + s1 + '"><a href="#/page/' + i + '">' + this.fluidbook.loader.getImage('data/thumbnails/p' + i + '.jpg') + '</a><span class="number">' + this.fluidbook.physicalToVirtual(i) + '</span>';
- if (this.fluidbook.bookmarks.enabled) {
- ix1 += this.fluidbook.bookmarks.getBookmarkForPage(i, true);
- }
- pages.push(i);
- ix1 += '</div>';
-
- } else {
- c = ' simple ' + s2;
- }
-
- if (this.fluidbook.l10n.dir == 'rtl') {
- s1 = 'left';
- s2 = 'right'
- } else {
- s1 = 'right';
- s2 = 'left'
- }
-
- if (j < this.fluidbook.datas.pages) {
- ix2 += '<div class="thumb ' + s1 + '"><a href="#/page/' + j + '">' + this.fluidbook.loader.getImage('data/thumbnails/p' + j + '.jpg') + '</a><span class="number">' + this.fluidbook.physicalToVirtual(j) + '</span>';
- if (this.fluidbook.bookmarks.enabled) {
- ix2 += this.fluidbook.bookmarks.getBookmarkForPage(j, true);
- }
- ix2 += '</div>';
- pages.push(j);
- } else {
- c = ' simple ' + s2;
- }
- ix = ix1 + ix2;
- this.normalHTML += '<div class="doubleThumb' + c + '" page="' + i + '" data-pages="' + pages.join(',') + '">' + ix;
- this.normalHTML += '</div>';
- }
- for (i = 0; i < 5; i++) {
- this.normalHTML += '<div class="padding"></div>';
- }
- this.normalHTML += '</div></div>';
- }
-
- return this.normalHTML;
- }
-}
@import "variables";
-@import "book-variables";
-@menu-button-background: overlay(@menu-background, #c0c0c0);
-
-.dkdkdkdkd {
- color: @menu-button-background;
-}
/* Screenshot */
.screenshot .mview {
+@import "book-variables";
+
+@menu-button-background: overlay(@menu-background, #c0c0c0);
@font: 'Open Sans', Arial, Helvetica, sans-serif;
\ No newline at end of file