Added sitename on menubar

This commit is contained in:
Pierre 2017-05-21 18:10:55 +02:00
parent 6e50fa0894
commit ba3f2fb246
2 changed files with 35 additions and 5 deletions

View File

@ -151,6 +151,10 @@ ComunicWeb.common.page = {
var pageTarget = createElem("div", mainContenerElem); var pageTarget = createElem("div", mainContenerElem);
pageTarget.id = "pageTarget"; pageTarget.id = "pageTarget";
} }
else{
//We can empty page target (much faster)
pageTarget.innerHTML = "";
}
//Set wrapper class //Set wrapper class
pageTarget.className = "content-wrapper"; pageTarget.className = "content-wrapper";

View File

@ -25,7 +25,7 @@ ComunicWeb.pages.menuBar = {
//So we have to initializate it //So we have to initializate it
//Create menubar element //Create menubar element
var menuBar = createElem("div"); var menuBar = createElem("header");
byId("wrapper").insertBefore(menuBar, byId("wrapper").childNodes[0]); byId("wrapper").insertBefore(menuBar, byId("wrapper").childNodes[0]);
menuBar.id = "menuBar"; menuBar.id = "menuBar";
@ -36,13 +36,39 @@ ComunicWeb.pages.menuBar = {
/** /**
* Initializate a menubar * Initializate a menubar
* *
* @param {HTMLElement} menuElem The menu container * @param {HTMLElement} menuContainer The menu container
* @return {Boolan} True for a success * @return {Boolan} True for a success
*/ */
init: function(menuElem){ init: function(menuContainer){
//Log action //Log action
ComunicWeb.debug.logMessage("Info: Initializate a menuBar on element : '"+menuElem.id+"'"); ComunicWeb.debug.logMessage("Info: Initializate a menuBar in element : '"+menuContainer.id+"'");
//Change menu container informations
menuContainer.className = "main-header";
//Create main menu
var menuElem = createElem("div", menuContainer);
menuElem.className = "navbar navbar-static-top";
//Create nav element
var navElem = createElem("nav", menuElem);
navElem.className = "navbar navbar-static-top";
//Create conatiner
var containerElem = createElem("div", navElem);
containerElem.className = "container";
//Create navbar header
var navbarHeader = createElem("div", containerElem);
navbarHeader.className = "navbar-header";
//Create site name link
var siteNameElem = createElem("a", navbarHeader);
siteNameElem.className = "navbar-brand";
siteNameElem.innerText = "Comunic";
siteNameElem.onclick = (function(){
ComunicWeb.common.page.openPage("home");
});
}, },
}; };