9 lines
3.6 KiB
JavaScript
9 lines
3.6 KiB
JavaScript
var DOM,pageManager,api,Notification,navSubMenu=function(a){var c=$("#MENU-SIDE > span[data-link="+pageManager.page+'] + div.sub > span[data-sublink="'+pageManager.vars[0]+'"]'),b=null,b=a instanceof Element?a:null,b="string"==typeof a?$("#MENU-SIDE > span[data-link="+pageManager.page+'] + div.sub > span[data-sublink="'+a+'"]'):b,b=null==b?$("#MENU-SIDE > span[data-link="+pageManager.page+"] + div.sub > span[data-sublink]"):b;if(null==b)return!1;null!=c&&c.remClass("active");c=$$("#CONTAINER > section[data-sublink].active");
|
|
for(a=0;a<c.length;a++)c[a].remClass("active");if(null!=b)for(b.addClass("active"),c=$$('#CONTAINER > section[data-sublink="'+b.getData("sublink")+'"]'),a=0;a<c.length;a++)c[a].addClass("active");if(!b.getData("sublink"))return!1;a=pageManager.vars[0]!=b.getData("sublink");pageManager.vars[0]=b.getData("sublink");a&&pageManager.updateURL()},navMenu=function(a){var c=$('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.page+'"]'),b=null,b=a instanceof Element?a:null,b="string"==typeof a?$('#WRAPPER > #MENU-SIDE > span[data-link="'+
|
|
a+'"]'):b,b=null==b?$('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.pagelist[0]+'"]'):b;if(null==b)return!1;null!=c&&c.remClass("active");null!=b&&b.addClass("active");b.getData("link")&&(DOM.HEADER.addClass("loading"),b.getData("link")!=pageManager.page&&pageManager.setPage(b.getData("link")),pageManager.activeXHR.addEventListener("loadend",function(){console.log(pageManager.vars[0],$$("#CONTAINER > section[data-sublink]"));1<=pageManager.vars.length&&null!=$('#CONTAINER > section[data-sublink="'+
|
|
pageManager.vars[0]+'"]')?navSubMenu(pageManager.vars[0]):navSubMenu(null);var a=$("#MENU-SIDE > span[data-link="+pageManager.page+"] + div.sub");null!=a&&a.addEventListener("click",function(a){for(a=a.target;a!=document.body&&!a.getData("sublink");)a=a.parentNode;a.getData("sublink")&&navSubMenu(a)},!1);DOM.HEADER.remClass("loading")},!1))};DOM={WRAPPER:$("body > #WRAPPER"),HEADER:$("body > #WRAPPER > #HEADER"),MENUSIDE:$("body > #WRAPPER > #MENU-SIDE"),CONTAINER:$("body > #WRAPPER > #CONTAINER")};
|
|
api=new APIClass("/api/");Notification=new NotificationClass($("#notification-container"));Notification.defaultTimeout=4E3;
|
|
Notification.errorCodes={"-1":"Erreur de r\u00e9seau, veuillez recharger la page et r\u00e9essayer",0:"Erreur interne",1:"Erreur interne",2:"Erreur interne",3:"Le fichier est introuvable",4:"Erreur interne",5:"Erreur interne",6:"Erreur interne",7:"Erreur interne",8:"Erreur interne",9:"Certaines donn\u00e9es sont manquantes",10:"Erreur interne",11:"Erreur interne",12:"Erreur interne",13:"Erreur interne",14:"Erreur interne",15:"Erreur interne",16:"Vous n'avez pas la permission d'effectuer cette action",
|
|
17:"Le t\u00e9l\u00e9chargement a \u00e9chou\u00e9",18:"Le fichier est invalide (format incorrect)"};lsi.setStorage(localStorage);DOM.MENUSIDE.addEventListener("click",function(a){for(a=a.target;a!=document.body&&!a.getData("link");)a=a.parentNode;a.getData("link")&&navMenu(a.getData("link"))},!1);function reload(){navMenu(pageManager.page)}var LOGIN={show:document.getElementById("user-data"),hide:document.getElementById("login-close"),page:document.getElementById("LOGIN")};
|
|
LOGIN.show.addEventListener("click",function(a){LOGIN.page.className="active"},!1);LOGIN.hide.addEventListener("click",function(a){LOGIN.page.className=""},!1);api.send({path:"download/menu"},function(a){if(0==a.ModuleError){pagelist=[];for(var c=0;c<a.menu.length;c++)pagelist.push(a.menu[c].attributes["data-link"]);pageManager=new pageManagerClass;pageManager.setPage(null,"/view",DOM.CONTAINER,pagelist,null);navMenu(pageManager.page)}});
|