From d5c49ed4b6d59c86992056d61aaab2e055259b33 Mon Sep 17 00:00:00 2001 From: Stephen Cameron Date: Tue, 30 Jan 2018 20:03:47 +0100 Subject: [PATCH] Improvements and semi-refactor with Vincent. WIP #1852 @8.5 --- _index.html | 2 +- js/libs/fluidbook/fluidbook.js | 17 +++++++- js/libs/fluidbook/fluidbook.landingpage.js | 49 ++++++++++++++++------ js/main.js | 12 ++++-- style/fluidbook.less | 21 +++++++--- 5 files changed, 76 insertions(+), 25 deletions(-) diff --git a/_index.html b/_index.html index 0feb8f32..bef146fd 100644 --- a/_index.html +++ b/_index.html @@ -85,7 +85,7 @@
-
+
diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index aaff3359..b6419e95 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -133,10 +133,9 @@ Fluidbook.prototype = { var $this = this; setTimeout(function () { $this._hideSplash(); - }, 3000); + }, 300); }, _hideSplash: function () { - this.ready(); $("#main,#viewOverlay,#view").css('visibility', 'visible'); this.hideLoader(0, true); @@ -153,6 +152,16 @@ Fluidbook.prototype = { $(this).trigger('fluidbook.splash.hide'); }, + + onReady: function(callback) { + if (this.isReady) { + callback(); + } else { + $(this).on('fluidbook.ready', function() { + callback(); + }); + } + }, ready: function () { if (this.isReady) { return; @@ -298,6 +307,10 @@ Fluidbook.prototype = { var args = window.location.hash.split('/'); if (args.length <= 1 || args[1] == '' || args[1] == undefined) { + if (this.landingpage.hasLandingPage) { + window.location.hash = '/landing'; + return; + } return this.setCurrentPage('1'); } else if (args[1] == 'closeview') { return this.setCurrentPage(this.currentPage); diff --git a/js/libs/fluidbook/fluidbook.landingpage.js b/js/libs/fluidbook/fluidbook.landingpage.js index b53e11dd..955f94d2 100644 --- a/js/libs/fluidbook/fluidbook.landingpage.js +++ b/js/libs/fluidbook/fluidbook.landingpage.js @@ -10,11 +10,25 @@ FluidbookLandingPage.prototype = { var $this = this; if (this.fluidbook.datas.landingPage != undefined && this.fluidbook.datas.landingPage != '') { - this.hasLandingPage = true; - window.location.hash = '/landing'; + } + + setTimeout(function(){$this.setupLandingPage();}, 10); + + // When the splash page hides, we are ready to show the landing page (if one exists) + // $(this.fluidbook).on('fluidbook.ready', function() { + // setTimeout($this.show, 500); + // }); - $("#landingPage").append('