mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Added utilities
This commit is contained in:
parent
55f0e55bbd
commit
6ecd49d1b0
@ -124,19 +124,31 @@ ComunicWeb.common.page = {
|
|||||||
ComunicWeb.common.url.changeURI(document.title, pageURI);
|
ComunicWeb.common.url.changeURI(document.title, pageURI);
|
||||||
|
|
||||||
//Get the main contener of the page
|
//Get the main contener of the page
|
||||||
//var mainContenerElem = document.getElementById("wrapper");
|
var mainContenerElem = document.getElementById("wrapper");
|
||||||
|
|
||||||
//If we didn't get anything, clean the page and create a wrapper element
|
//If we didn't get anything, clean the page and create a wrapper element
|
||||||
if(!mainContenerElem){
|
if(!mainContenerElem){
|
||||||
var mainContenerElem = this.emptyPage(true);
|
var mainContenerElem = this.emptyPage(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//We check if the page is a full screen page
|
||||||
|
if(pageInfos.disableMenus){
|
||||||
|
//We force the screen to be cleaned
|
||||||
|
var mainContenerElem = this.emptyPage(true);
|
||||||
|
var pageTarget = mainContenerElem;
|
||||||
|
}
|
||||||
|
//Else
|
||||||
|
else {
|
||||||
|
//We try to locate menubar
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//Check if some additionnal data was specified
|
//Check if some additionnal data was specified
|
||||||
if(!additionnalData)
|
if(!additionnalData)
|
||||||
additionnalData = {};
|
additionnalData = {};
|
||||||
|
|
||||||
//Call the method related to the page
|
//Call the method related to the page
|
||||||
eval(pageInfos.methodHandler + ("(additionnalData, mainContenerElem);"));
|
eval(pageInfos.methodHandler + ("(additionnalData, pageTarget);"));
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
32
assets/js/common/utils.js
Normal file
32
assets/js/common/utils.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* Utilities functions
|
||||||
|
*
|
||||||
|
* @author Pierre HUBERT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new HTML node
|
||||||
|
*
|
||||||
|
* @param {String} nodeType The type of the HTML node
|
||||||
|
* @param {HTMLElement} appendTo Optionnal, defines node on which the new node will be applied
|
||||||
|
* @return {HTMLElement} The newly created element
|
||||||
|
*/
|
||||||
|
function createElem(nodeType, appendTo){
|
||||||
|
var newElem = document.createElement(nodeType);
|
||||||
|
|
||||||
|
if(appendTo)
|
||||||
|
appendTo.appendChild(newElem);
|
||||||
|
|
||||||
|
//Return result
|
||||||
|
return newElem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an HTML element specified by an ID
|
||||||
|
*
|
||||||
|
* @param {String} nodeName The ID of the element
|
||||||
|
* @return {HTMLElement} The elemnt / False for a failure
|
||||||
|
*/
|
||||||
|
function byId(nodeName){
|
||||||
|
return document.getElementById(nodeName);
|
||||||
|
}
|
@ -11,6 +11,7 @@ ComunicWeb.pagesList = {
|
|||||||
home: {
|
home: {
|
||||||
pageTitle: "Comunic, v2",
|
pageTitle: "Comunic, v2",
|
||||||
methodHandler: "ComunicWeb.pages.home.home.openHomePage",
|
methodHandler: "ComunicWeb.pages.home.home.openHomePage",
|
||||||
|
disableMenus: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,6 +20,7 @@ ComunicWeb.pagesList = {
|
|||||||
login: {
|
login: {
|
||||||
pageTitle: "Login page",
|
pageTitle: "Login page",
|
||||||
methodHandler: "ComunicWeb.pages.login.openLoginPage",
|
methodHandler: "ComunicWeb.pages.login.openLoginPage",
|
||||||
|
disableMenus: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user