]> _ Git - fluidbook-html5.git/commitdiff
Manage action links (share)
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 9 Jun 2015 12:40:21 +0000 (12:40 +0000)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 9 Jun 2015 12:40:21 +0000 (12:40 +0000)
Improve sharing popup events

js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.service.js
js/main.js

index 27103559baf53e697d64bf53f47e1828a59dd956..83b1968ae2b16a72f5336d25154efe47ba0c4152 100644 (file)
@@ -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 () {
index ce53aa6d9221f1f04e964d1cd28fd35d11713519..02b5a8658eb87faa5d889628c4d51a1dabc525e8 100644 (file)
@@ -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
index f1d5990c185a79404d76e8047b70a62acd54934b..9954c48edb919eb3b7ddbe336d6aa0475217a3c4 100644 (file)
@@ -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 = '<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)
-
-                       $(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 = '<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)
+
+            $(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