fixed infinite loader when loading current page
This commit is contained in:
parent
7992c15449
commit
eb79b1d8bb
|
@ -127,17 +127,16 @@ function navMenu(section, persistence){
|
||||||
if( !persistence && current != target )
|
if( !persistence && current != target )
|
||||||
pageManager.vars = [];
|
pageManager.vars = [];
|
||||||
|
|
||||||
|
if( current != target )
|
||||||
|
DOM.HEADER.addClass('loading'); // Animation de chargement
|
||||||
|
|
||||||
// On charge la page si data-link trouve
|
// On charge la page si data-link trouve
|
||||||
if( target.getData('link') ){
|
if( target.getData('link') ){
|
||||||
DOM.HEADER.addClass('loading'); // Animation de chargement
|
|
||||||
|
|
||||||
|
|
||||||
//pageManager.activeXHR.addEventListener('loadend',
|
//pageManager.activeXHR.addEventListener('loadend',
|
||||||
|
|
||||||
var handlerX = function(){
|
var handlerX = function(){
|
||||||
|
|
||||||
|
|
||||||
// On gere la navigation du sous-menu (si defini, utilise)
|
// On gere la navigation du sous-menu (si defini, utilise)
|
||||||
var subSectionExists = pageManager.vars.length > 0 && document.querySelector('#CONTAINER > .sub-menu-side > [data-sublink="'+pageManager.vars[0]+'"]') != null;
|
var subSectionExists = pageManager.vars.length > 0 && document.querySelector('#CONTAINER > .sub-menu-side > [data-sublink="'+pageManager.vars[0]+'"]') != null;
|
||||||
if( subSectionExists ) // Si le lien du menu associe existe
|
if( subSectionExists ) // Si le lien du menu associe existe
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
function navSubMenu(e){var a=document.querySelector('#CONTAINER > .sub-menu-side > span[data-sublink="'+pageManager.vars[0]+'"]'),n=null;if(n=e instanceof Element?e:null,n="string"==typeof e?document.querySelector('#CONTAINER > .sub-menu-side > span[data-sublink="'+e+'"]'):n,n=null==n?document.querySelector("#CONTAINER > .sub-menu-side > span[data-sublink]"):n,null==n)return!1;null!=a&&a.remClass("active");for(var t=document.querySelectorAll("#CONTAINER > section[data-sublink].active"),r=0;r<t.length;r++)t[r].remClass("active");if(null!=n){n.addClass("active");var u=document.querySelector('#CONTAINER > section[data-sublink="'+n.getData("sublink")+'"]');null!=u&&u.addClass("active")}if(!n.getData("sublink"))return!1;var l=pageManager.vars[0]!=n.getData("sublink");pageManager.vars[0]=n.getData("sublink"),l&&pageManager.updateURL()}function navMenu(e,a){var n=document.querySelector('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.page+'"]'),t=null;if(t=e instanceof Element?e:null,t="string"==typeof e?document.querySelector('#WRAPPER > #MENU-SIDE > span[data-link="'+e+'"]'):t,t=t||document.querySelector('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.pagelist[0]+'"]'),null==t)return!1;a=a===!0?!0:!1,n&&n.remClass("active"),t&&t.addClass("active");if(a||n==t||(pageManager.vars=[]),t.getData("link")){DOM.HEADER.addClass("loading");var r=function(){var e=pageManager.vars.length>0&&null!=document.querySelector('#CONTAINER > .sub-menu-side > [data-sublink="'+pageManager.vars[0]+'"]');navSubMenu(e?pageManager.vars[0]:null),document.querySelector("#CONTAINER > .sub-menu-side").addEventListener("click",function(e){for(var a=e.target;a!=document.body&&!a.getData("sublink");)a=a.parentNode;a.getData("sublink")&&navSubMenu(a)},!1),DOM.HEADER.remClass("loading")};pageManager.page!=t.getData("link")&&pageManager.setPage(t.getData("link")),pageManager.activeXHR?pageManager.activeXHR.addEventListener("loadend",r,!1):r.call()}}DOM={WRAPPER:$("WRAPPER"),HEADER:$("HEADER"),MENUSIDE:$("MENU-SIDE"),CONTAINER:$("CONTAINER")};var pageManager=new pageManagerClass,api=new APIClass("/api/");pageManager.setPage(null,"/view",DOM.CONTAINER,["history","profile","machines","users","groups","options","settings"]),navMenu(pageManager.page),pageManager.refresher=function(){navSubMenu(this.vars[0]),document.querySelector("#CONTAINER > .sub-menu-side").addEventListener("click",function(e){for(var a=e.target;a!=document.body&&!a.getData("sublink");)a=a.parentNode;a.getData("sublink")&&navSubMenu(a)},!1)},DOM.MENUSIDE.addEventListener("click",function(e){for(var a=e.target;a!=document.body&&!a.getData("link");)a=a.parentNode;a.getData("link")&&navMenu(a.getData("link"))},!1);
|
function navSubMenu(e){var a=document.querySelector('#CONTAINER > .sub-menu-side > span[data-sublink="'+pageManager.vars[0]+'"]'),n=null;if(n=e instanceof Element?e:null,n="string"==typeof e?document.querySelector('#CONTAINER > .sub-menu-side > span[data-sublink="'+e+'"]'):n,null==(n=null==n?document.querySelector("#CONTAINER > .sub-menu-side > span[data-sublink]"):n))return!1;null!=a&&a.remClass("active");for(var t=document.querySelectorAll("#CONTAINER > section[data-sublink].active"),r=0;r<t.length;r++)t[r].remClass("active");if(null!=n){n.addClass("active");var u=document.querySelector('#CONTAINER > section[data-sublink="'+n.getData("sublink")+'"]');null!=u&&u.addClass("active")}if(!n.getData("sublink"))return!1;var l=pageManager.vars[0]!=n.getData("sublink");pageManager.vars[0]=n.getData("sublink"),l&&pageManager.updateURL()}function navMenu(e,a){var n=document.querySelector('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.page+'"]'),t=null;if(t=e instanceof Element?e:null,t="string"==typeof e?document.querySelector('#WRAPPER > #MENU-SIDE > span[data-link="'+e+'"]'):t,null==(t=t||document.querySelector('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.pagelist[0]+'"]')))return!1;a=!0===a,n&&n.remClass("active"),t&&t.addClass("active");if(a||n==t||(pageManager.vars=[]),n!=t&&DOM.HEADER.addClass("loading"),t.getData("link")){var r=function(){navSubMenu(pageManager.vars.length>0&&null!=document.querySelector('#CONTAINER > .sub-menu-side > [data-sublink="'+pageManager.vars[0]+'"]')?pageManager.vars[0]:null),document.querySelector("#CONTAINER > .sub-menu-side").addEventListener("click",function(e){for(var a=e.target;a!=document.body&&!a.getData("sublink");)a=a.parentNode;a.getData("sublink")&&navSubMenu(a)},!1),DOM.HEADER.remClass("loading")};pageManager.page!=t.getData("link")&&pageManager.setPage(t.getData("link")),pageManager.activeXHR?pageManager.activeXHR.addEventListener("loadend",r,!1):r.call()}}DOM={WRAPPER:$("WRAPPER"),HEADER:$("HEADER"),MENUSIDE:$("MENU-SIDE"),CONTAINER:$("CONTAINER")};var pageManager=new pageManagerClass,api=new APIClass("/api/");pageManager.setPage(null,"/view",DOM.CONTAINER,["history","profile","machines","users","groups","options","settings"]),navMenu(pageManager.page),pageManager.refresher=function(){navSubMenu(this.vars[0]),document.querySelector("#CONTAINER > .sub-menu-side").addEventListener("click",function(e){for(var a=e.target;a!=document.body&&!a.getData("sublink");)a=a.parentNode;a.getData("sublink")&&navSubMenu(a)},!1)},DOM.MENUSIDE.addEventListener("click",function(e){for(var a=e.target;a!=document.body&&!a.getData("link");)a=a.parentNode;a.getData("link")&&navMenu(a.getData("link"))},!1);
|
Loading…
Reference in New Issue