Created a restart function

This commit is contained in:
Pierre 2017-05-21 18:26:18 +02:00
parent 42cd5dcd1c
commit bf372d5322
4 changed files with 34 additions and 2 deletions

View File

@ -28,3 +28,11 @@
opacity: 0.5; opacity: 0.5;
padding-top: 30%; padding-top: 30%;
} }
/**
* Wait message
*/
.waitSplashScreen .text {
padding: 50px;
font-size: 200%;
}

View File

@ -113,8 +113,10 @@ var ComunicWeb = {
/** /**
* Show a full wait splash screen * 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 * Show a transparent wait splash screen

View File

@ -39,14 +39,23 @@ ComunicWeb.common.page = {
/** /**
* Show a full wait splash screen * 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 //First, empty the screen
this.emptyPage(); this.emptyPage();
//Log message //Log message
ComunicWeb.debug.logMessage("Display a wait splash screen the screen."); 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 //Create image element
var imgElem = document.createElement("img"); var imgElem = document.createElement("img");
imgElem.src = ComunicWeb.__config.assetsURL+"img/roundProgress.gif"; imgElem.src = ComunicWeb.__config.assetsURL+"img/roundProgress.gif";

View File

@ -54,4 +54,17 @@ ComunicWeb.common.system = {
//Sucess //Sucess
return true; 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;
}
}; };