From: Vincent Vanwaelscappel Date: Tue, 9 Jun 2015 12:40:21 +0000 (+0000) Subject: Manage action links (share) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=458a6936f3c2db1355e516375234e9eeb3af795b;p=fluidbook-html5.git Manage action links (share) Improve sharing popup events --- diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index 27103559..83b1968a 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -1185,31 +1185,31 @@ Fluidbook.prototype = { this.service.open('twitterShare', { url: this.getLocationToShare(), post: this.datas.twitter_description.replace('%title%', this.datas.title) - }); + }, 'width=650,height=400'); this.stats.track(13); }, sendFacebook: function () { this.service.open('facebookShare', { url: this.getLocationToShare() - }); + }, 'width=650,height=400'); this.stats.track(12); }, sendGoogleplus: function () { this.service.open('googleplusShare', { url: this.getLocationToShare() - }); + }, 'width=650,height=400'); this.stats.track(12); }, sendLinkedin: function () { this.service.open('linkedinShare', { url: this.getLocationToShare() - }); + }, 'width=650,height=400'); this.stats.track(12); }, sendViadeo: function () { this.service.open('viadeoShare', { url: this.getLocationToShare() - }); + }, 'width=650,height=400'); this.stats.track(12); }, print: function () { diff --git a/js/libs/fluidbook/fluidbook.service.js b/js/libs/fluidbook/fluidbook.service.js index ce53aa6d..02b5a865 100644 --- a/js/libs/fluidbook/fluidbook.service.js +++ b/js/libs/fluidbook/fluidbook.service.js @@ -1,30 +1,30 @@ function FluidbookService(fluidbook, id) { - this.fluidbook = fluidbook; - this.baseURL = 'http://workshop.fluidbook.com/services/'; - this.id = id; + this.fluidbook = fluidbook; + this.baseURL = 'http://workshop.fluidbook.com/services/'; + this.id = id; } FluidbookService.prototype = { - call: function(func, datas, handler, context) { - datas['id'] = this.id; - return $.ajax({ - url: this.baseURL + func, - context: context, - format: 'xml', - crossDomain: true, - data: datas, - success: function(data) { - handler.call(this, data) - } - }); - }, - open: function(func, datas) { - datas['id'] = this.id; - var u = []; - $.each(datas, function(k, v) { - u.push(k + '=' + encodeURIComponent(v)); - }); - var url = this.baseURL + func + '?' + u.join('&'); - this.fluidbook.wopen(url, '_blank'); - } + call: function (func, datas, handler, context) { + datas['id'] = this.id; + return $.ajax({ + url: this.baseURL + func, + context: context, + format: 'xml', + crossDomain: true, + data: datas, + success: function (data) { + handler.call(this, data) + } + }); + }, + open: function (func, datas, options) { + datas['id'] = this.id; + var u = []; + $.each(datas, function (k, v) { + u.push(k + '=' + encodeURIComponent(v)); + }); + var url = this.baseURL + func + '?' + u.join('&'); + this.fluidbook.wopen(url, '_blank', options); + } } \ No newline at end of file diff --git a/js/main.js b/js/main.js index f1d5990c..9954c48e 100644 --- a/js/main.js +++ b/js/main.js @@ -16,551 +16,554 @@ var PLATFORM = 'web'; var DEVICE_READY = false; try { - $(function() { - $("#message").hide(); - $("#splash").show(); - - FastClick.attach(document.body); - - $_GET = parseGet(); - INITED = false; - - if (Modernizr.applicationcache) { - applicationCache.addEventListener('updateready', cacheUpdated, false); - applicationCache.addEventListener('downloading', function(e) { - fb('cache downloading'); - }, false); - applicationCache.addEventListener('cached', function(e) { - fb('cache completed'); - fluidbook.video.initCache(); - }, false); - applicationCache.addEventListener('noupdate', function(e) { - fb('cache nothing to update'); - fluidbook.video.initCache(); - }, false); - applicationCache.addEventListener('checking', function(e) { - fb('cache check'); - }, false); - applicationCache.addEventListener('error', function(e) { - fb('cache error'); - }, false); - } - - if (DATAS && DATAS.phonegap) { - loadPhonegap(); - } else { - init(); - } - }); - - function loadPhonegap() { - var cordovaPath = 'data/cordova.js'; - var cordovaStorage = window.localStorage.getItem('cordova'); - OFFLINEAPP = window.localStorage.getItem('offlineapp') == '1'; - if (window.localStorage.getItem('offline.' + DATAS.id) == '1') { - FINISHLOADING = true; - } - - if (cordovaStorage) { - cordovaPath = window.localStorage.getItem('cordova'); - } - - document.addEventListener('deviceready', onDeviceReady, false); - document.addEventListener("resume", onAppResume, false); - - loadJSLibrary( - cordovaPath - , cordovaLoaded); - if (window.cordova) { - fb('cordova already loaded'); - cordovaLoaded(); - } - } - - function cordovaLoaded() { - setTimeout(function() { - onDeviceReady(); - }, 5000); - } - - function onDeviceOffline() { - if (OFFLINEAPP) { - return; - } - if (FINISHLOADING) { - return; - } - - navigator.notification.alert(__('This publication is not available offline. To read it, an internet connection is required'), - function() { - window.location = window.sessionStorage.getItem('apphome'); - }, __('An internet connection is required')); - } - - function onAppResume() { - if (!INITED) { - return; - } - fluidbook.hideLoader(1); - } - - function onDeviceReady() { - if (DEVICE_READY) { - return; - } - - fb('device ready !'); - - DEVICE_READY = true; - - document.addEventListener("offline", onDeviceOffline, false); - - var manifest; - - var fsprefix = window.sessionStorage.getItem('galfsprefix'); - - PLATFORM = DATAS.phonegap; - - if (PLATFORM == 'ios') { - window.ExternalFileUtil = { - openWith: function(path, uti, success, fail, offset) { - return cordova.exec(success, fail, "ExternalFileUtil", "openWith", [path, uti, offset.left, offset.top]); - } - }; - } else if (PLATFORM == 'android') { - - } - - var collection; - try { - collection = json_parse(window.localStorage.getItem('collection')); - } catch (err) { - fb('error parsing collection'); - } - - if (collection.res != undefined && collection.res) { - resolution = collection.res; - } - - if (OFFLINEAPP) { - resolution = 150; - } - - if (!OFFLINEAPP) { - fb('set manifest from manifest pub'); - manifest = collection.manifestPub[DATAS.id]; - } - - - if (navigator.onLine && !OFFLINEAPP) { - fb('init online'); - - var readyToLoad = false; - var finishedLoading = false; - gal = new GameAssetLoader(manifest, fsprefix); - - gal.init(galLoaded); - - var timeout = setTimeout(function() { - window.location.reload(true); - }, 1000); - - gal.onLoaded(function(info) { - fb('gal loaded'); - clearTimeout(timeout); - $(window).trigger('GALBundleLoaded', [info]); - }); - - gal.check('content_4', function(info) { - if (info.success) { - fluidbook.changeAddress(); - } - }); - - gal.check('extras', function(info) { - if (info.success) { - fb('set offline flag'); - FINISHLOADING = true; - window.localStorage.setItem('offline.' + DATAS.id, '1'); - } - }); - - $(window).on('GALBundleLoaded', function(e, info) { - fb('Loaded :: ' + info.bundleName); - - if (info.bundleName == 'content_4') { - fluidbook.changeAddress(); - } - if (info.bundleName == 'extras') { - fb('set offline flag'); - FINISHLOADING = true; - window.localStorage.setItem('offline.' + DATAS.id, '1'); - } - try { - if (fluidbook && fluidbook.loader) { - fluidbook.loader.retryErrorImages(); - } - } catch (err) { - - } - }); - } else { - init(); - } - } - - function loadJSLibrary(url, callback) { - if (jsLibraries.indexOf(url) > -1) { - if (callback != undefined) { - callback(); - } - return; - } - jsLibraries[jsLibraries.length] = url; - - var script = document.createElement("script") - script.type = "text/javascript"; - - if (script.readyState) { //IE - script.onreadystatechange = function() { - if (script.readyState == "loaded" || - script.readyState == "complete") { - script.onreadystatechange = null; - if (callback != undefined) { - callback(); - } - } - }; - } else { //Others - script.onload = function() { - if (callback != undefined) { - callback(); - } - }; - } - - script.src = url; - document.getElementsByTagName("head")[0].appendChild(script); - } - - function galLoaded() { - startAfterLoading = true; - init(); - } - - function init() { - if (INITED == true) { - return; - } - - INITED = true; - - fluidbook = new Fluidbook(DATAS); - if (null != gal) { - fluidbook.gal = gal; - } - fluidbook.loadPlugins(); - fluidbook.loader.preloadPages(); - - desktopScale = 1; - desktopScaleAmount = 1.5; - - if ($_GET.s == '1') { - $('html').addClass('screenshot'); - $("#splash").hide(); - fluidbook.ready(); - } - - initEvents(); - } - - function initEvents() { - resize(true); - - $(window).bind('hashchange', function() { - if (maskHashChange) { - return; - } - fluidbook.stats.trackPageChange(); - fluidbook.changeAddress(); - return false; - }); - - $(document).on('webkitfullscreenchange mozfullscreenchange msfullscreenchange fullscreenchange', function() { - resize(); - setTimeout(function() { - resize(); - }, 100); - }); - - $(document).on('click', "#popinOverlay", function() { - closePopin(); - return false; - }); - - $(document).on('click', 'a.popin', function() { - var iframeid = 'iframe_' + Math.round(Math.random() * 100000); - - var html = '
'; - $("#popinOverlay").append(html).show(); - - var frame = $("#" + iframeid) - - $(frame).load(function() { - var f = $(frame).contents(); - $(f).click(function(e) { - if ($(e.target).hasClass('closePopup')) { - closePopin(); - return; - } - $(e.target).parents().each(function() { - if ($(this).hasClass('closePopup')) { - closePopin(); - return; - } - }); - }); - }); - - resize(); - return false; - }); - - $(document).on('click', 'a.appswitchlocale', function() { - try { - fluidbook.displayLoader(); - if ($(".mview").length > 0) { - $("#main").hide(); - $("#view").addClass('fadeout'); - } else { - $("#main").addClass('fadeout'); - } - var $this = this; - var locale = $(this).data('locale'); - var id = $(this).data('id'); - window.localStorage.setItem('locale', locale); - - if (OFFLINEAPP) { - window.location = getPublicationURL(id); - } else { - var topmanifest = window.localStorage.getItem('topmanifest'); - window.gallocale = new GameAssetLoader(json_parse(topmanifest, 'topmanifest'), window.sessionStorage.getItem('galfsprefix')); - window.gallocale.init(function() { - window.gallocale.downloadAndCall('p_' + id, function() { - window.location = getPublicationURL(id); - }); - }); - } - } catch (err) { - - } - return false; - - }); - - $("#logo").click(clickLogo); - - $(document).on('click', ".mview .back", function() { - if ($(this).hasClass('closeView')) { - fluidbook.closeView(function() { - }, false); - if ($(this).attr('href') != '#') { - maskHashChange = true; - window.location = $(this).attr('href'); - setTimeout(function() { - maskHashChange = false; - }, 200); - - } - return false; - } - if ($(this).hasClass('one')) { - fluidbook.closeView(function() { - }, false); - - if ($(this).attr('href') != '#') { - maskHashChange = true; - window.location = $(this).attr('href'); - setTimeout(function() { - maskHashChange = false; - }, 200); - } else { - maskHashChange = true; - history.back(); - setTimeout(function() { - maskHashChange = false; - }, 200); - } - return false; - } - if ($(this).attr('href') == '#') { - window.location.hash = '/page/' + fluidbook.currentPage; - return false; - } - }); - - $(document).on('click', '.share', function() { - var f = 'send' + ucfirst($(this).data('service')); - fluidbook[f](); - }); - - $(document).on('click', 'a', function() { - if (!DATAS.phonegap) { - return true; - } - var target = $(this).attr('target'); - if (target == '_blank' || target == '_system') { - fluidbook.wopen($(this).attr('href'), $(this).attr('target')); - return false; - } - return true; - }); - - - setTimeout(function() { - resize(); - }, 1000); - - setInterval(function() { - fluidbook.pollZoom(); - }, 250); - - if (!startAfterLoading) { - fluidbook.changeAddress(); - } - } + $(function () { + $("#message").hide(); + $("#splash").show(); + + FastClick.attach(document.body); + + $_GET = parseGet(); + INITED = false; + + if (Modernizr.applicationcache) { + applicationCache.addEventListener('updateready', cacheUpdated, false); + applicationCache.addEventListener('downloading', function (e) { + fb('cache downloading'); + }, false); + applicationCache.addEventListener('cached', function (e) { + fb('cache completed'); + fluidbook.video.initCache(); + }, false); + applicationCache.addEventListener('noupdate', function (e) { + fb('cache nothing to update'); + fluidbook.video.initCache(); + }, false); + applicationCache.addEventListener('checking', function (e) { + fb('cache check'); + }, false); + applicationCache.addEventListener('error', function (e) { + fb('cache error'); + }, false); + } + + if (DATAS && DATAS.phonegap) { + loadPhonegap(); + } else { + init(); + } + }); + + function loadPhonegap() { + var cordovaPath = 'data/cordova.js'; + var cordovaStorage = window.localStorage.getItem('cordova'); + OFFLINEAPP = window.localStorage.getItem('offlineapp') == '1'; + if (window.localStorage.getItem('offline.' + DATAS.id) == '1') { + FINISHLOADING = true; + } + + if (cordovaStorage) { + cordovaPath = window.localStorage.getItem('cordova'); + } + + document.addEventListener('deviceready', onDeviceReady, false); + document.addEventListener("resume", onAppResume, false); + + loadJSLibrary( + cordovaPath + , cordovaLoaded); + if (window.cordova) { + fb('cordova already loaded'); + cordovaLoaded(); + } + } + + function cordovaLoaded() { + setTimeout(function () { + onDeviceReady(); + }, 5000); + } + + function onDeviceOffline() { + if (OFFLINEAPP) { + return; + } + if (FINISHLOADING) { + return; + } + + navigator.notification.alert(__('This publication is not available offline. To read it, an internet connection is required'), + function () { + window.location = window.sessionStorage.getItem('apphome'); + }, __('An internet connection is required')); + } + + function onAppResume() { + if (!INITED) { + return; + } + fluidbook.hideLoader(1); + } + + function onDeviceReady() { + if (DEVICE_READY) { + return; + } + + fb('device ready !'); + + DEVICE_READY = true; + + document.addEventListener("offline", onDeviceOffline, false); + + var manifest; + + var fsprefix = window.sessionStorage.getItem('galfsprefix'); + + PLATFORM = DATAS.phonegap; + + if (PLATFORM == 'ios') { + window.ExternalFileUtil = { + openWith: function (path, uti, success, fail, offset) { + return cordova.exec(success, fail, "ExternalFileUtil", "openWith", [path, uti, offset.left, offset.top]); + } + }; + } else if (PLATFORM == 'android') { + + } + + var collection; + try { + collection = json_parse(window.localStorage.getItem('collection')); + } catch (err) { + fb('error parsing collection'); + } + + if (collection.res != undefined && collection.res) { + resolution = collection.res; + } + + if (OFFLINEAPP) { + resolution = 150; + } + + if (!OFFLINEAPP) { + fb('set manifest from manifest pub'); + manifest = collection.manifestPub[DATAS.id]; + } + + + if (navigator.onLine && !OFFLINEAPP) { + fb('init online'); + + var readyToLoad = false; + var finishedLoading = false; + gal = new GameAssetLoader(manifest, fsprefix); + + gal.init(galLoaded); + + var timeout = setTimeout(function () { + window.location.reload(true); + }, 1000); + + gal.onLoaded(function (info) { + fb('gal loaded'); + clearTimeout(timeout); + $(window).trigger('GALBundleLoaded', [info]); + }); + + gal.check('content_4', function (info) { + if (info.success) { + fluidbook.changeAddress(); + } + }); + + gal.check('extras', function (info) { + if (info.success) { + fb('set offline flag'); + FINISHLOADING = true; + window.localStorage.setItem('offline.' + DATAS.id, '1'); + } + }); + + $(window).on('GALBundleLoaded', function (e, info) { + fb('Loaded :: ' + info.bundleName); + + if (info.bundleName == 'content_4') { + fluidbook.changeAddress(); + } + if (info.bundleName == 'extras') { + fb('set offline flag'); + FINISHLOADING = true; + window.localStorage.setItem('offline.' + DATAS.id, '1'); + } + try { + if (fluidbook && fluidbook.loader) { + fluidbook.loader.retryErrorImages(); + } + } catch (err) { + + } + }); + } else { + init(); + } + } + + function loadJSLibrary(url, callback) { + if (jsLibraries.indexOf(url) > -1) { + if (callback != undefined) { + callback(); + } + return; + } + jsLibraries[jsLibraries.length] = url; + + var script = document.createElement("script") + script.type = "text/javascript"; + + if (script.readyState) { //IE + script.onreadystatechange = function () { + if (script.readyState == "loaded" || + script.readyState == "complete") { + script.onreadystatechange = null; + if (callback != undefined) { + callback(); + } + } + }; + } else { //Others + script.onload = function () { + if (callback != undefined) { + callback(); + } + }; + } + + script.src = url; + document.getElementsByTagName("head")[0].appendChild(script); + } + + function galLoaded() { + startAfterLoading = true; + init(); + } + + function init() { + if (INITED == true) { + return; + } + + INITED = true; + + fluidbook = new Fluidbook(DATAS); + if (null != gal) { + fluidbook.gal = gal; + } + fluidbook.loadPlugins(); + fluidbook.loader.preloadPages(); + + desktopScale = 1; + desktopScaleAmount = 1.5; + + if ($_GET.s == '1') { + $('html').addClass('screenshot'); + $("#splash").hide(); + fluidbook.ready(); + } + + initEvents(); + } + + function initEvents() { + resize(true); + + $(window).bind('hashchange', function () { + if (maskHashChange) { + return; + } + fluidbook.stats.trackPageChange(); + fluidbook.changeAddress(); + return false; + }); + + $(document).on('webkitfullscreenchange mozfullscreenchange msfullscreenchange fullscreenchange', function () { + resize(); + setTimeout(function () { + resize(); + }, 100); + }); + + $(document).on('click', "#popinOverlay", function () { + closePopin(); + return false; + }); + + $(document).on('click', 'a.popin', function () { + var iframeid = 'iframe_' + Math.round(Math.random() * 100000); + + var html = '
'; + $("#popinOverlay").append(html).show(); + + var frame = $("#" + iframeid) + + $(frame).load(function () { + var f = $(frame).contents(); + $(f).click(function (e) { + if ($(e.target).hasClass('closePopup')) { + closePopin(); + return; + } + $(e.target).parents().each(function () { + if ($(this).hasClass('closePopup')) { + closePopin(); + return; + } + }); + }); + }); + + resize(); + return false; + }); + + $(document).on('click', 'a.appswitchlocale', function () { + try { + fluidbook.displayLoader(); + if ($(".mview").length > 0) { + $("#main").hide(); + $("#view").addClass('fadeout'); + } else { + $("#main").addClass('fadeout'); + } + var $this = this; + var locale = $(this).data('locale'); + var id = $(this).data('id'); + window.localStorage.setItem('locale', locale); + + if (OFFLINEAPP) { + window.location = getPublicationURL(id); + } else { + var topmanifest = window.localStorage.getItem('topmanifest'); + window.gallocale = new GameAssetLoader(json_parse(topmanifest, 'topmanifest'), window.sessionStorage.getItem('galfsprefix')); + window.gallocale.init(function () { + window.gallocale.downloadAndCall('p_' + id, function () { + window.location = getPublicationURL(id); + }); + }); + } + } catch (err) { + + } + return false; + + }); + + $("#logo").click(clickLogo); + + $(document).on('click', ".mview .back", function () { + if ($(this).hasClass('closeView')) { + fluidbook.closeView(function () { + }, false); + if ($(this).attr('href') != '#') { + maskHashChange = true; + window.location = $(this).attr('href'); + setTimeout(function () { + maskHashChange = false; + }, 200); + + } + return false; + } + if ($(this).hasClass('one')) { + fluidbook.closeView(function () { + }, false); + + if ($(this).attr('href') != '#') { + maskHashChange = true; + window.location = $(this).attr('href'); + setTimeout(function () { + maskHashChange = false; + }, 200); + } else { + maskHashChange = true; + history.back(); + setTimeout(function () { + maskHashChange = false; + }, 200); + } + return false; + } + if ($(this).attr('href') == '#') { + window.location.hash = '/page/' + fluidbook.currentPage; + return false; + } + }); + + $(document).on('click', '.share', function () { + var f = 'send' + ucfirst($(this).data('service')); + fluidbook[f](); + fluidbook.closeView(function () { + }, false); + return false; + }); + + $(document).on('click', 'a', function () { + if (!DATAS.phonegap) { + return true; + } + var target = $(this).attr('target'); + if (target == '_blank' || target == '_system') { + fluidbook.wopen($(this).attr('href'), $(this).attr('target')); + return false; + } + return true; + }); + + + setTimeout(function () { + resize(); + }, 1000); + + setInterval(function () { + fluidbook.pollZoom(); + }, 250); + + if (!startAfterLoading) { + fluidbook.changeAddress(); + } + } } catch (err) { - fb(err); + fb(err); } function checkScroll() { - if (fluidbook.viewMode()) { - return; - } - if (window.innerWidth == 0) { - return; - } - var left = ($(window).width() / 2) - window.scrollX; - var right = window.innerWidth - left; - - var reading = (left >= right) ? 'left' : 'right'; - fluidbook.readingPage(reading); + if (fluidbook.viewMode()) { + return; + } + if (window.innerWidth == 0) { + return; + } + var left = ($(window).width() / 2) - window.scrollX; + var right = window.innerWidth - left; + + var reading = (left >= right) ? 'left' : 'right'; + fluidbook.readingPage(reading); } function changeAddress(event) { - fluidbook.changeAddress(event); + fluidbook.changeAddress(event); } function resize(init) { - if (init == undefined || init == null) { - init = false; - } - fluidbook.resize.resize(init); - - var ww = $(window).width(); - var wh = $(window).height(); - $("#popinOverlay>div").each(function() { - $(this).css({ - top: (wh - $(this).outerHeight()) / 2, - left: (ww - $(this).outerWidth()) / 2 - }); - }); + if (init == undefined || init == null) { + init = false; + } + fluidbook.resize.resize(init); + + var ww = $(window).width(); + var wh = $(window).height(); + $("#popinOverlay>div").each(function () { + $(this).css({ + top: (wh - $(this).outerHeight()) / 2, + left: (ww - $(this).outerWidth()) / 2 + }); + }); } function goNextPage(e) { - if (fluidbook.help.isVisible()) { - return; - } - var y = e.offsetY == undefined ? e.originalEvent.layerY : e.offsetY; - - if (y < 65) { - if (fluidbook.pad.enabled) { - fluidbook.goNextChapter(); - } else { - fluidbook.goNextPage(); - } - } else { - fluidbook.goLastPage(); - } - return false; + if (fluidbook.help.isVisible()) { + return; + } + var y = e.offsetY == undefined ? e.originalEvent.layerY : e.offsetY; + + if (y < 65) { + if (fluidbook.pad.enabled) { + fluidbook.goNextChapter(); + } else { + fluidbook.goNextPage(); + } + } else { + fluidbook.goLastPage(); + } + return false; } function goPreviousPage(e) { - if (fluidbook.help.isVisible()) { - return; - } - var y = e.offsetY == undefined ? e.originalEvent.layerY : e.offsetY; - if (y < 65) { - if (fluidbook.pad.enabled) { - fluidbook.goPreviousChapter(); - } else { - fluidbook.goPreviousPage(); - } - - } else { - fluidbook.goFirstPage(); - } - return false; + if (fluidbook.help.isVisible()) { + return; + } + var y = e.offsetY == undefined ? e.originalEvent.layerY : e.offsetY; + if (y < 65) { + if (fluidbook.pad.enabled) { + fluidbook.goPreviousChapter(); + } else { + fluidbook.goPreviousPage(); + } + + } else { + fluidbook.goFirstPage(); + } + return false; } function clickLogo() { - fluidbook.clickLogo(); - return false; + fluidbook.clickLogo(); + return false; } function preloadBackground(page, resolution) { - fluidbook.preloadBackground(page, resolution); + fluidbook.preloadBackground(page, resolution); } function setBackground(page, resolution) { - fluidbook.setBackground(page, resolution); + fluidbook.setBackground(page, resolution); } function searchHints() { - if ($("#q").val().length >= 3) { - fluidbook.getSearchHints($("#q").val()); - } else { - try { - fluidbook.hideSearchHints(); - } catch (err) { - - } - } + if ($("#q").val().length >= 3) { + fluidbook.getSearchHints($("#q").val()); + } else { + try { + fluidbook.hideSearchHints(); + } catch (err) { + + } + } } function __(str) { - return fluidbook.l10n.__(str); + return fluidbook.l10n.__(str); } function cacheUpdated(e) { - applicationCache.swapCache(); - if (window.confirm(fluidbook.l10n.__('An update of the publication is available. Do you want to load it ?'))) { - window.location.reload(); - } + applicationCache.swapCache(); + if (window.confirm(fluidbook.l10n.__('An update of the publication is available. Do you want to load it ?'))) { + window.location.reload(); + } } function closePopin() { - $("#popinOverlay").html('').hide(); + $("#popinOverlay").html('').hide(); } -(function() { - var proxied = window.alert; - window.alert = function() { - if (navigator.notification) { - navigator.notification.alert(arguments[0], function() { - }, "Alert", "Ok"); - } else { - // do something here - return proxied.apply(this, arguments); - } - }; +(function () { + var proxied = window.alert; + window.alert = function () { + if (navigator.notification) { + navigator.notification.alert(arguments[0], function () { + }, "Alert", "Ok"); + } else { + // do something here + return proxied.apply(this, arguments); + } + }; })(); function getPublicationURL(id) { - var url = window.home; - var replace = "/" + fluidbook.datas.id + "/"; - var replaceby = "/" + id + "/"; - url = url.replace(replace, replaceby); - return url; + var url = window.home; + var replace = "/" + fluidbook.datas.id + "/"; + var replaceby = "/" + id + "/"; + url = url.replace(replace, replaceby); + return url; } \ No newline at end of file