From bd47a97d36b226e20710c5c206a7e4810d4b1f6e Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 28 Oct 2014 13:34:49 +0000 Subject: [PATCH] --- _index.html | 2 +- js/libs/fluidbook/fluidbook.js | 301 ++++++++++++++++----------------- 2 files changed, 151 insertions(+), 152 deletions(-) diff --git a/_index.html b/_index.html index c971828a..a614a7c4 100644 --- a/_index.html +++ b/_index.html @@ -5,7 +5,7 @@ - + diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index 2957b8db..7749a3a9 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -17,7 +17,7 @@ Fluidbook.MIDDLE = 7; Fluidbook.TOP = 8; Fluidbook.BOTTOM = 9; Fluidbook.prototype = { - init: function(datas) { + init: function (datas) { this.datas = datas; this.junk = datas.cacheDate; this.cache = new FluidbookCache(datas); @@ -77,15 +77,15 @@ Fluidbook.prototype = { } this.initLoading(); }, - initLoading: function() { + initLoading: function () { this.displayLoader(); }, - reloadErrorImages: function() { - $('img').each(function() { + reloadErrorImages: function () { + $('img').each(function () { }); }, - hideSplash: function() { + hideSplash: function () { if ($("#splash").length == 0) { return; } @@ -96,26 +96,26 @@ Fluidbook.prototype = { this.loader.canPreload(); var $this = this; - setTimeout(function() { + setTimeout(function () { $this._hideSplash(); }, 3000); }, - _hideSplash: function() { + _hideSplash: function () { this.ready(); $("#main").css('visibility', 'visible'); this.hideLoader(0, true); if (this.support.transitions2d) { - $("#splash").css('opacity', 0).one(this.support.getTransitionEndEvent(true), function() { + $("#splash").css('opacity', 0).one(this.support.getTransitionEndEvent(true), function () { $(this).remove(); }); } else { - $("#splash").fadeOut(500, function() { + $("#splash").fadeOut(500, function () { $(this.remove()); }) } }, - ready: function() { + ready: function () { if (this.isReady) { return; } @@ -127,22 +127,22 @@ Fluidbook.prototype = { resize(); $(this).trigger('fluidbookready'); }, - loadPlugins: function() { - $.each(this.datas.plugins, function(k, plugin) { + loadPlugins: function () { + $.each(this.datas.plugins, function (k, plugin) { try { var functionName = plugin.replace(/\./g, '_'); eval(functionName + '();'); } catch (err) { } }); - $.each(this.datas.htmlmultimedia, function(k, code) { + $.each(this.datas.htmlmultimedia, function (k, code) { try { eval(code); } catch (err) { } }); }, - resetZoom: function() { + resetZoom: function () { var $this = this; if (this.support.iOS) { } else if (!this.support.isMobile) { @@ -150,14 +150,14 @@ Fluidbook.prototype = { } }, - setZoom: function(zoom) { + setZoom: function (zoom) { if (zoom) { $("#pages").addClass('zoom'); } else { $("#pages").removeClass('zoom'); } }, - initPage: function(pageNr, doublePage, position) { + initPage: function (pageNr, doublePage, position) { if ($("#page_" + pageNr).length > 0) { return; } @@ -165,10 +165,10 @@ Fluidbook.prototype = { var page = '
'; $(doublePage).append(page); }, - hidePage: function(position) { + hidePage: function (position) { $("#pages ." + position).hide(); }, - initLinks: function(pageNr) { + initLinks: function (pageNr) { if (pageNr == undefined) { pageNr = this.currentPage; } @@ -191,40 +191,40 @@ Fluidbook.prototype = { if (this.datas.linkBlinkTime > 0) { ///this.animateLinks(); } - setTimeout(function() { + setTimeout(function () { $this.initVideos(); }, 1000); }, - animateLinks: function() { + animateLinks: function () { var links = $(".link a.displayArea"); var bookmarks = $("#links .bookmark:not([data-enabled])"); if (Modernizr.csstransitions) { $(links).addClass('animating'); $(bookmarks).css('opacity', 1).addClass('animating'); - setTimeout(function() { + setTimeout(function () { $(links).css('opacity', 0); $(bookmarks).css('opacity', 0); - setTimeout(function() { + setTimeout(function () { $(links).removeClass('animating').css('opacity', 1); $(bookmarks).removeClass('animating').css('opacity', ""); }, 1100); }, 50); } else { - $(links).addClass('animating').fadeOut(1000, function() { + $(links).addClass('animating').fadeOut(1000, function () { $(links).removeClass('animating').show(); - }).mouseover(function() { + }).mouseover(function () { $(links).stop().removeClass('animating').css('opacity', 1).show(); return true; }); } }, - initVideos: function() { + initVideos: function () { var $this = this; - $(".videoContainer").each(function() { + $(".videoContainer").each(function () { $this.video.initVideo(this); }); }, - getNextOffset: function() { + getNextOffset: function () { var offset = 2; if (this.displayOnePage) { offset = 1; @@ -232,35 +232,35 @@ Fluidbook.prototype = { this.transitionAxis = 'x'; return offset; }, - goNextPage: function() { + goNextPage: function () { if (this.transitionning) { return; } this.transitionAxis = 'x'; this.setCurrentPage(this.normalizePage(this.currentPage) + this.getNextOffset()); }, - goFirstPage: function() { + goFirstPage: function () { if (this.transitionning) { return; } this.transitionAxis = 'x'; this.setCurrentPage(1); }, - goPreviousPage: function() { + goPreviousPage: function () { if (this.transitionning) { return; } this.transitionAxis = 'x'; this.setCurrentPage(this.normalizePage(this.currentPage) - this.getNextOffset()); }, - goLastPage: function() { + goLastPage: function () { if (this.transitionning) { return; } this.transitionAxis = 'x'; this.setCurrentPage(this.datas.pages); }, - goNextChapter: function() { + goNextChapter: function () { if (this.transitionning) { return; } @@ -271,7 +271,7 @@ Fluidbook.prototype = { this.transitionAxis = 'x'; this.setCurrentPage(this.normalizePage(next)); }, - goPreviousChapter: function() { + goPreviousChapter: function () { if (this.transitionning) { return; } @@ -282,7 +282,7 @@ Fluidbook.prototype = { this.transitionAxis = 'x'; this.setCurrentPage(this.normalizePage(prev)); }, - goNextChapterPage: function() { + goNextChapterPage: function () { if (this.transitionning) { return; } @@ -294,7 +294,7 @@ Fluidbook.prototype = { this.transitionAxis = 'y'; this.setCurrentPage(this.normalizePage(next)); }, - goPreviousChapterPage: function() { + goPreviousChapterPage: function () { if (this.transitionning) { return; } @@ -306,17 +306,17 @@ Fluidbook.prototype = { this.transitionAxis = 'y'; this.setCurrentPage(this.normalizePage(prev)); }, - normalizePage: function(page) { + normalizePage: function (page) { page = Math.max(1, Math.min(page, this.datas.pages)); if (!this.displayOnePage && page % 2 == 1) { page--; } return page; }, - setCurrentPage: function(page) { + setCurrentPage: function (page) { window.location.hash = "#/page/" + this.normalizePage(page); }, - changeAddress: function() { + changeAddress: function () { var $this = this; var page; var args = window.location.hash.split('/'); @@ -334,7 +334,7 @@ Fluidbook.prototype = { } $($this).trigger('changePage', [page]); - this.closeView(function() { + this.closeView(function () { $this.pageTransition(page); $this.resetZoom(); $this.stats.track(0, page); @@ -342,7 +342,7 @@ Fluidbook.prototype = { }, true); } else { - this.openView(args[1], args[2], args[3], function() { + this.openView(args[1], args[2], args[3], function () { $this.hideSplash(); }); this.resetZoom(); @@ -350,7 +350,7 @@ Fluidbook.prototype = { return; }, - pageTransition: function(pageNr) { + pageTransition: function (pageNr) { this.tooltip.hideTooltip(); if (pageNr == undefined) { pageNr = this.currentPage; @@ -373,7 +373,7 @@ Fluidbook.prototype = { return this.pageTransition3D(pageNr); }, - pageTransition3D: function(pageNr) { + pageTransition3D: function (pageNr) { var $this = this; if ($("#pages").hasClass('_3dtransition')) { @@ -386,12 +386,12 @@ Fluidbook.prototype = { var doublePage = $("#nextDoublePage"); var currentDoublePage = $("#currentDoublePage"); this.displayLoader(); - this.loader.preloadPagesBeforeTransition([turning.currentLeft, turning.currentRight], function() { + this.loader.preloadPagesBeforeTransition([turning.currentLeft, turning.currentRight], function () { $("#pages").addClass('_3dtransition'); - $this.loader.setContentsInDoublePage(currentDoublePage, turning.flat, true, function() { - $this.loader.setContentsInDoublePage(doublePage, turning.flip, true, function() { + $this.loader.setContentsInDoublePage(currentDoublePage, turning.flat, true, function () { + $this.loader.setContentsInDoublePage(doublePage, turning.flip, true, function () { $this.beforeTransition(pageNr, 3); - $(doublePage).addClass(turning.nextFromClass + 'end').one($this.support.getTransitionEndEvent(), function() { + $(doublePage).addClass(turning.nextFromClass + 'end').one($this.support.getTransitionEndEvent(), function () { if ($this.transitionning == false) { return; } @@ -402,7 +402,7 @@ Fluidbook.prototype = { } // Set the flat contents with the new page - $this.loader.setContentsInDoublePage(doublePage, turning.end, false, function() { + $this.loader.setContentsInDoublePage(doublePage, turning.end, false, function () { $(doublePage).removeClass('_3d').removeClass(turning.nextFromClass + 'start').removeClass(turning.nextFromClass + 'end'); // Remove former part $("#currentDoublePage").remove(); @@ -415,7 +415,7 @@ Fluidbook.prototype = { }); }); }, - getTurningPages: function(newPage) { + getTurningPages: function (newPage) { var res = {}; res.dir = 1; if (newPage < this.currentPage) { @@ -461,10 +461,10 @@ Fluidbook.prototype = { res.loading = [res.currentLeft, res.currentRight]; return json_parse(JSON.stringify(res)); }, - reloadCurrentPage: function() { + reloadCurrentPage: function () { this.pageTransition(this.currentPage); }, - readingPage: function(side) { + readingPage: function (side) { if (!this.displayOnePage) { var page = this.currentPage; var change = false; @@ -480,7 +480,7 @@ Fluidbook.prototype = { } } }, - hideUnnecessaryButtons: function(page) { + hideUnnecessaryButtons: function (page) { var speed = 500; if (page == undefined) { page = this.currentPage; @@ -514,7 +514,7 @@ Fluidbook.prototype = { } } }, - updateShadows: function(page, animationDuration) { + updateShadows: function (page, animationDuration) { if (animationDuration == undefined) { animationDuration = 0; } @@ -552,21 +552,21 @@ Fluidbook.prototype = { $("#shadow>.right:visible").fadeOut(duration); } }, - showAllButtons: function() { + showAllButtons: function () { $("#next,#previous").addClass('help').show(); }, - pageTransition2D: function(pageNr) { + pageTransition2D: function (pageNr) { this.transitionning = true; var $this = this; var turning = this.getTurningPages(pageNr); $("#pages").append('
'); var doublePage = $("#nextDoublePage"); this.displayLoader(); - this.loader.preloadPagesBeforeTransition(turning.end, function() { - $this.loader.setContentsInDoublePage(doublePage, turning.end, true, function() { + this.loader.preloadPagesBeforeTransition(turning.end, function () { + $this.loader.setContentsInDoublePage(doublePage, turning.end, true, function () { $this.beforeTransition(pageNr, 2); $("#currentDoublePage").addClass('_2d').addClass('axis_' + $this.transitionAxis).addClass(turning.currentToClass); - $(doublePage).removeClass(turning.nextFromClass).one($this.support.getTransitionEndEvent(), function(event) { + $(doublePage).removeClass(turning.nextFromClass).one($this.support.getTransitionEndEvent(), function (event) { if ($this.transitionning == false) { return; } @@ -577,7 +577,7 @@ Fluidbook.prototype = { }); }); }, - pageTransition2DPortrait: function(pageNr) { + pageTransition2DPortrait: function (pageNr) { this.transitionning = true; var $this = this; var turning = this.getTurningPages(pageNr); @@ -588,11 +588,11 @@ Fluidbook.prototype = { } this.displayLoader(); - this.loader.preloadPagesBeforeTransition(turning.end, function() { - $this.loader.setContentsInDoublePage(doublePage, turning.end, true, function() { + this.loader.preloadPagesBeforeTransition(turning.end, function () { + $this.loader.setContentsInDoublePage(doublePage, turning.end, true, function () { $this.beforeTransition(pageNr, 2); $("#currentDoublePage").addClass('axis_' + $this.transitionAxis).addClass('_2d').addClass(turning.currentToClass); - $(doublePage).removeClass(turning.nextFromClass).one($this.support.getTransitionEndEvent(), function() { + $(doublePage).removeClass(turning.nextFromClass).one($this.support.getTransitionEndEvent(), function () { fb('received event'); if ($this.transitionning == false) { return; @@ -604,7 +604,7 @@ Fluidbook.prototype = { }); }); }, - pageTransition1D: function(pageNr) { + pageTransition1D: function (pageNr) { var page = pageNr; var doublePage = $("#currentDoublePage"); var $this = this; @@ -613,11 +613,11 @@ Fluidbook.prototype = { } var turning = this.getTurningPages(pageNr); this.beforeTransition(pageNr); - this.loader.setContentsInDoublePage(doublePage, turning.end, true, function() { + this.loader.setContentsInDoublePage(doublePage, turning.end, true, function () { $this.afterTransition(page); }); }, - beforeTransition: function(page, d) { + beforeTransition: function (page, d) { if (d == undefined) { d = 1; } @@ -630,7 +630,7 @@ Fluidbook.prototype = { this.updateShadows(page, animationDuration); fb('beforeTransition ' + page); }, - afterTransition: function(page) { + afterTransition: function (page) { if (this.transitionning === false) { //return; } @@ -638,7 +638,7 @@ Fluidbook.prototype = { var $this = this; this.currentPage = page; this.setPageNumbers(); - setTimeout(function() { + setTimeout(function () { $this.loader.preloadAround(page); }, 1000); this.initLinks(); @@ -670,35 +670,35 @@ Fluidbook.prototype = { } }, - setPageNumbers: function() { + setPageNumbers: function () { $("#pagesnumbers .left").html(this.getPageNumberOfSide('left')); $("#pagesnumbers .right").html(this.getPageNumberOfSide('right')); }, - getPageNumberOfSide: function(side) { + getPageNumberOfSide: function (side) { var p = $("#currentDoublePage").find('.' + side); if (p.length == 0) { return ''; } return this.physicalToVirtual($(p).data('page')); }, - clickLogo: function() { + clickLogo: function () { if (this.datas.url_link == '' || this.datas.url_link == 'http://') { return; } this.wopen(this.datas.url_link, '_blank'); }, - viewMode: function() { + viewMode: function () { return $("#view .mview").length > 0; }, - openView: function(view, param1, param2, callback) { + openView: function (view, param1, param2, callback) { var $this = this; this.displayLoader(); this.resetWaiters(); - setTimeout(function() { + setTimeout(function () { $this._openView(view, param1, param2, callback); }, 20); }, - addWaiter: function(reset) { + addWaiter: function (reset) { if (reset == undefined) { reset = false; } @@ -709,13 +709,13 @@ Fluidbook.prototype = { this.waiters.push(rand); return rand; }, - waiterActive: function(id) { + waiterActive: function (id) { return this.waiters.indexOf(id) > -1; }, - resetWaiters: function() { + resetWaiters: function () { this.waiters = []; }, - _openView: function(view, param1, param2, callback) { + _openView: function (view, param1, param2, callback) { var $this = this; var preload = {index: 'thumbnails', search: 'thumbnails', @@ -723,7 +723,7 @@ Fluidbook.prototype = { video: 'extras'}; if (!OFFLINEAPP && this.gal != null && preload[view] != undefined) { var w = this.addWaiter(true); - this.gal.downloadAndCall(preload[view], function() { + this.gal.downloadAndCall(preload[view], function () { if ($this.waiterActive(w)) { $this.__openView(view, param1, param2, callback); } @@ -732,10 +732,10 @@ Fluidbook.prototype = { this.__openView(view, param1, param2, callback); } }, - __openView: function(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() { + var cb = function () { $this.openingView(callback); }; if (view == 'index') { @@ -744,7 +744,7 @@ Fluidbook.prototype = { this.searchString = param1; var group = param2; $("#q").val(param1); - this.search.find(param1, function(r) { + this.search.find(param1, function (r) { $this.displayResults(r, group, cb); }); if (group == undefined) { @@ -766,7 +766,7 @@ Fluidbook.prototype = { this['open' + camelView](param1, param2, cb); } }, - openingView: function(callback) { + openingView: function (callback) { var $this = this; this.resize.resizeView(); this.tooltip.hideTooltip(); @@ -792,8 +792,8 @@ Fluidbook.prototype = { } $(mview).show().removeClass('animate').transform(from); - setTimeout(function() { - $(mview).one($this.support.getTransitionEndEvent(), function() { + setTimeout(function () { + $(mview).one($this.support.getTransitionEndEvent(), function () { $("#main").hide(); $('body').addClass('view'); $(mview).removeClass('animate'); @@ -811,7 +811,7 @@ Fluidbook.prototype = { resize(); } }, - displayResults: function(data, group, callback) { + displayResults: function (data, group, callback) { var $this = this; var results = data.results; var hideNoResults = !this.datas.searchShowNoResultsPages; @@ -821,17 +821,17 @@ Fluidbook.prototype = { return; } - this.openIndex(this.l10n.__('search results for') + ' « ' + this.searchString + " »", group, false, function() { + 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) { + $.each(results, function (k, v) { hits[k] += v; }); var e = encodeURIComponent($this.searchString); - $(".doubleThumb").each(function() { + $(".doubleThumb").each(function () { var pages = $(this).data('pages').toString().split(','); var hitsp = 0; var pagesWithHits = []; @@ -874,7 +874,7 @@ Fluidbook.prototype = { } }); }, - openMultimedia: function(multimedia, callback) { + openMultimedia: function (multimedia, callback) { var a = $('a[href="#/multimedia/' + multimedia + '"]'); var markup = decodeURIComponent($(a).attr('data-multimedia')); var view = '
' + this.l10n.__('back') + '
'; @@ -886,7 +886,7 @@ Fluidbook.prototype = { callback(); } }, - openVideo: function(video, callback) { + openVideo: function (video, callback) { var a = $('a[href="#/video/' + video + '"]'); var markup = decodeURIComponent($(a).attr('data-video')); var view = '
' + this.l10n.__('back') + '
'; @@ -898,8 +898,8 @@ Fluidbook.prototype = { this.initVideos(); var $this = this; var times = [250, 500, 750, 1000, 1250]; - $.each(times, function(k, v) { - setTimeout(function() { + $.each(times, function (k, v) { + setTimeout(function () { $this.resize.resizePopupVideos(); }, v); }); @@ -907,7 +907,7 @@ Fluidbook.prototype = { callback(); } }, - openAudio: function(audio, callback) { + openAudio: function (audio, callback) { var a = $('a[href="#/audio/' + audio + '"]'); var markup = decodeURIComponent($(a).attr('data-audio')); var view = '
' + this.l10n.__('back') + '
'; @@ -918,8 +918,8 @@ Fluidbook.prototype = { this.stats.track(11); var $this = this; var times = [250, 500, 750, 1000, 1250]; - $.each(times, function(k, v) { - setTimeout(function() { + $.each(times, function (k, v) { + setTimeout(function () { $this.resize.resizePopupAudios(); }, v); }); @@ -927,7 +927,7 @@ Fluidbook.prototype = { callback(); } }, - openWebVideo: function(service, video, callback) { + openWebVideo: function (service, video, callback) { var view = '
' + this.l10n.__('back') + '
'; view += '
'; @@ -938,7 +938,7 @@ Fluidbook.prototype = { } view += '
'; $("#view").append('
' + view + '
'); - $("#view .mview:last iframe").each(function() { + $("#view .mview:last iframe").each(function () { $(this).attr('height', ($(this).width() * 9) / 16); }); this.stats.track(11); @@ -946,12 +946,12 @@ Fluidbook.prototype = { callback(); } }, - openLocales: function(p1, p2, callback) { + openLocales: function (p1, p2, callback) { var view = '
' + this.l10n.__('back') + '

Select language

'; view += '
'; view += '