From bf372d53226dc41ad1d22e45fafeeb14ab9c445a Mon Sep 17 00:00:00 2001 From: Pierre Date: Sun, 21 May 2017 18:26:18 +0200 Subject: [PATCH] Created a restart function --- assets/css/common/page/waitSplashScreen.css | 8 ++++++++ assets/js/common/functionsSchema.js | 4 +++- assets/js/common/page.js | 11 ++++++++++- assets/js/common/system.js | 13 +++++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/assets/css/common/page/waitSplashScreen.css b/assets/css/common/page/waitSplashScreen.css index 8bcae2db..b33f6dcb 100644 --- a/assets/css/common/page/waitSplashScreen.css +++ b/assets/css/common/page/waitSplashScreen.css @@ -27,4 +27,12 @@ text-align: center; opacity: 0.5; padding-top: 30%; +} + +/** + * Wait message + */ +.waitSplashScreen .text { + padding: 50px; + font-size: 200%; } \ No newline at end of file diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index d23a9d60..2967e4a0 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -113,8 +113,10 @@ var ComunicWeb = { /** * Show a full wait splash screen + * + * @param {String} message A message to explain the reason of the splash screen (optionnal) */ - showWaitSplashScreen: function(){}, + showWaitSplashScreen: function(message){}, /** * Show a transparent wait splash screen diff --git a/assets/js/common/page.js b/assets/js/common/page.js index ac38e941..d65c7b56 100644 --- a/assets/js/common/page.js +++ b/assets/js/common/page.js @@ -39,14 +39,23 @@ ComunicWeb.common.page = { /** * Show a full wait splash screen + * + * @param {String} message A message to explain the reason of the splash screen (optionnal) */ - showWaitSplashScreen: function(){ + showWaitSplashScreen: function(message){ //First, empty the screen this.emptyPage(); //Log message ComunicWeb.debug.logMessage("Display a wait splash screen the screen."); + //Create message element (if required) + if(message){ + var messageElem = createElem("div", document.body); + messageElem.className = "text"; + messageElem.innerHTML = message; + } + //Create image element var imgElem = document.createElement("img"); imgElem.src = ComunicWeb.__config.assetsURL+"img/roundProgress.gif"; diff --git a/assets/js/common/system.js b/assets/js/common/system.js index 5e6525fa..0675fa29 100644 --- a/assets/js/common/system.js +++ b/assets/js/common/system.js @@ -54,4 +54,17 @@ ComunicWeb.common.system = { //Sucess return true; }, + + /** + * Restart the application + * + * @return {Boolean} True for a success + */ + restart: function(){ + //Show a wait splashscreen message + ComunicWeb.common.page.showWaitSplashScreen("Restarting..."); + + //Reload the page + location.href = document.location; + } }; \ No newline at end of file