var gal = null;
var home = window.location.toString();
-$(function() {
- FastClick.attach(document.body);
-
- $_GET = parseGet();
- INITED = false;
-
- if (Modernizr.applicationcache) {
- applicationCache.addEventListener('updateready', cacheUpdated, false);
- applicationCache.addEventListener('downloading', function(e) {
- console.log('cache downloading');
- }, false);
- applicationCache.addEventListener('cached', function(e) {
- console.log('cache completed');
- fluidbook.video.initCache();
- }, false);
- applicationCache.addEventListener('noupdate', function(e) {
- console.log('cache nothing to update');
- fluidbook.video.initCache();
- }, false);
- applicationCache.addEventListener('checking', function(e) {
- console.log('cache check');
- }, false);
- applicationCache.addEventListener('error', function(e) {
- console.log('cache error');
- }, false);
- }
+try {
+ $(function() {
+ $("#message").hide();
+ $("#splash").show();
- if (DATAS.phonegap) {
- loadPhonegap();
- } else {
- init();
- }
-});
+ FastClick.attach(document.body);
-function loadPhonegap() {
-
- var cordova = 'data/cordova.js';
- var cordovaStorage = window.localStorage.getItem('cordova');
- if (cordovaStorage) {
- cordova = window.localStorage.getItem('cordova');
- }
+ $_GET = parseGet();
+ INITED = false;
- document.addEventListener('deviceready', onDeviceReady, false);
- document.addEventListener("resume", onAppResume, false);
+ if (Modernizr.applicationcache) {
+ applicationCache.addEventListener('updateready', cacheUpdated, false);
+ applicationCache.addEventListener('downloading', function(e) {
+ console.log('cache downloading');
+ }, false);
+ applicationCache.addEventListener('cached', function(e) {
+ console.log('cache completed');
+ fluidbook.video.initCache();
+ }, false);
+ applicationCache.addEventListener('noupdate', function(e) {
+ console.log('cache nothing to update');
+ fluidbook.video.initCache();
+ }, false);
+ applicationCache.addEventListener('checking', function(e) {
+ console.log('cache check');
+ }, false);
+ applicationCache.addEventListener('error', function(e) {
+ console.log('cache error');
+ }, false);
+ }
- loadJSLibrary(
- cordova
- , function() {
+ if (DATAS.phonegap) {
+ loadPhonegap();
+ } else {
+ init();
+ }
});
-}
-function onAppResume() {
- if (!INITED) {
- return;
- }
- fluidbook.hideLoader(1);
-}
+ function loadPhonegap() {
-function onDeviceReady() {
- var manifest = window.sessionStorage.getItem('manifest.' + DATAS.id);
- var fsprefix = window.sessionStorage.getItem('galfsprefix');
+ var cordova = 'data/cordova.js';
+ var cordovaStorage = window.localStorage.getItem('cordova');
+ if (cordovaStorage) {
+ cordova = window.localStorage.getItem('cordova');
+ }
- if (DATAS.phonegap == '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 (DATAS.phonegap == 'android') {
+ document.addEventListener('deviceready', onDeviceReady, false);
+ document.addEventListener("resume", onAppResume, false);
+ loadJSLibrary(
+ cordova
+ , function() {
+ });
}
- if (navigator.onLine && manifest) {
- var readyToLoad = false;
- var finishedLoading = false;
- gal = new GameAssetLoader(JSON.parse(manifest), fsprefix);
- gal.init(function() {
- startAfterLoading = true;
- init();
- });
+ function onAppResume() {
+ if (!INITED) {
+ return;
+ }
+ fluidbook.hideLoader(1);
+ }
- gal.onLoaded(function(info) {
- $(window).trigger('GALBundleLoaded', [info]);
- });
+ function onDeviceReady() {
+ var manifest = window.sessionStorage.getItem('manifest.' + DATAS.id);
+ var fsprefix = window.sessionStorage.getItem('galfsprefix');
- gal.check('content_4', function(info) {
- if (info.success) {
- fluidbook.changeAddress();
- }
- });
+ if (DATAS.phonegap == '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 (DATAS.phonegap == 'android') {
- gal.check('extras', function(info) {
- if (info.success) {
- window.localStorage.setItem('offline.' + DATAS.id, '1');
- }
- })
+ }
- $(window).on('GALBundleLoaded', function(e, info) {
- if (info.bundleName == 'content_4') {
- fluidbook.changeAddress();
- }
- if (info.bundleName == 'extras') {
- window.localStorage.setItem('offline.' + DATAS.id, '1');
- }
- try {
- if (fluidbook && fluidbook.loader) {
- fluidbook.loader.retryErrorImages();
+ if (navigator.onLine && manifest) {
+ var readyToLoad = false;
+ var finishedLoading = false;
+ gal = new GameAssetLoader(JSON.parse(manifest), fsprefix);
+ gal.init(function() {
+ startAfterLoading = true;
+ init();
+ });
+
+ gal.onLoaded(function(info) {
+ $(window).trigger('GALBundleLoaded', [info]);
+ });
+
+ gal.check('content_4', function(info) {
+ if (info.success) {
+ fluidbook.changeAddress();
}
- } catch (err) {
+ });
- }
- });
- } else {
- init();
- }
-}
+ gal.check('extras', function(info) {
+ if (info.success) {
+ window.localStorage.setItem('offline.' + DATAS.id, '1');
+ }
+ })
+
+ $(window).on('GALBundleLoaded', function(e, info) {
+ if (info.bundleName == 'content_4') {
+ fluidbook.changeAddress();
+ }
+ if (info.bundleName == 'extras') {
+ window.localStorage.setItem('offline.' + DATAS.id, '1');
+ }
+ try {
+ if (fluidbook && fluidbook.loader) {
+ fluidbook.loader.retryErrorImages();
+ }
+ } catch (err) {
-function loadJSLibrary(url, callback) {
- if (jsLibraries.indexOf(url) > -1) {
- if (callback != undefined) {
- callback();
+ }
+ });
+ } else {
+ init();
}
- 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() {
+ 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);
}
- script.src = url;
- document.getElementsByTagName("head")[0].appendChild(script);
-}
+ function init() {
+ if (INITED == true) {
+ return;
+ }
-function init() {
- if (INITED == true) {
- return;
- }
+ INITED = true;
- INITED = true;
+ fluidbook = new Fluidbook(DATAS);
+ if (null != gal) {
+ fluidbook.gal = gal;
+ }
+ fluidbook.loadPlugins();
+ fluidbook.loader.preloadPages();
- fluidbook = new Fluidbook(DATAS);
- if (null != gal) {
- fluidbook.gal = gal;
- }
- fluidbook.loadPlugins();
- fluidbook.loader.preloadPages();
+ desktopScale = 1;
+ desktopScaleAmount = 1.5;
- desktopScale = 1;
- desktopScaleAmount = 1.5;
+ if ($_GET.s == '1') {
+ $("#main").css('display', 'block');
+ $('html').addClass('screenshot');
+ }
- if ($_GET.s == '1') {
- $("#main").css('display', 'block');
- $('html').addClass('screenshot');
+ initEvents();
}
- initEvents();
-}
-
-function initEvents() {
- resize(true);
+ function initEvents() {
+ resize(true);
- $(window).bind('hashchange', function() {
- if (maskHashChange) {
- return;
- }
- fluidbook.stats.trackPageChange();
- fluidbook.changeAddress();
- return false;
- });
+ $(window).bind('hashchange', function() {
+ if (maskHashChange) {
+ return;
+ }
+ fluidbook.stats.trackPageChange();
+ fluidbook.changeAddress();
+ return false;
+ });
- $(document).on('click', "#popinOverlay", function() {
- closePopin();
- return false;
- });
+ $(document).on('click', "#popinOverlay", function() {
+ closePopin();
+ return false;
+ });
- $(document).on('click', 'a.popin', function() {
- var iframeid = 'iframe_' + Math.round(Math.random() * 100000);
+ $(document).on('click', 'a.popin', function() {
+ var iframeid = 'iframe_' + Math.round(Math.random() * 100000);
- var html = '<div style="width:' + $(this).data('width') + 'px;height:' + $(this).data('height') + 'px"><iframe id="' + iframeid + '" width="' + $(this).data('width') + '" height="' + $(this).data('height') + '" src="' + $(this).data('src') + '" frameborder="0"></iframe></div>';
- $("#popinOverlay").append(html).show();
+ var html = '<div style="width:' + $(this).data('width') + 'px;height:' + $(this).data('height') + 'px"><iframe id="' + iframeid + '" width="' + $(this).data('width') + '" height="' + $(this).data('height') + '" src="' + $(this).data('src') + '" frameborder="0"></iframe></div>';
+ $("#popinOverlay").append(html).show();
- var frame = $("#" + iframeid)
+ 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')){
+ $(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;
});
- 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);
+
+ var topmanifest = window.sessionStorage.getItem('topmanifest');
+ window.gallocale = new GameAssetLoader(JSON.parse(topmanifest), window.sessionStorage.getItem('galfsprefix'));
+ window.gallocale.init(function() {
+ window.gallocale.downloadAndCall('p_' + id, function() {
+ var url = window.home;
+ var replace = "/" + fluidbook.datas.id + "/";
+ var replaceby = "/" + id + "/";
+ url = url.replace(replace, replaceby);
+ var c = window.localStorage.getItem('collection');
+ window.location = url;
+ });
+ });
+ } catch (err) {
- $(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);
-
- var topmanifest = window.sessionStorage.getItem('topmanifest');
- window.gallocale = new GameAssetLoader(JSON.parse(topmanifest), window.sessionStorage.getItem('galfsprefix'));
- window.gallocale.init(function() {
- window.gallocale.downloadAndCall('p_' + id, function() {
- var url = window.home;
- var replace = "/" + fluidbook.datas.id + "/";
- var replaceby = "/" + id + "/";
- url = url.replace(replace, replaceby);
- var c = window.localStorage.getItem('collection');
- window.location = url;
- });
- });
- } catch (err) {
-
- }
- return false;
+ return false;
- });
+ });
- $("#logo").click(clickLogo);
+ $("#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);
+ $(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;
}
- 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);
+ 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;
}
- return false;
- }
- if ($(this).attr('href') == '#') {
- window.location.hash = '/page/' + fluidbook.currentPage;
- 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', '.share', function() {
+ var f = 'send' + ucfirst($(this).data('service'));
+ fluidbook[f]();
+ });
- $(document).on('click', 'a', function() {
- if (!DATAS.phonegap) {
+ $(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;
- }
- 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);
+ setTimeout(function() {
+ resize();
+ }, 1000);
- setInterval(function() {
- fluidbook.pollZoom();
- }, 250);
+ setInterval(function() {
+ fluidbook.pollZoom();
+ }, 250);
- if (!startAfterLoading) {
- fluidbook.changeAddress();
+ if (!startAfterLoading) {
+ fluidbook.changeAddress();
+ }
}
+} catch (err) {
+
}
function checkScroll() {