From eb79b1d8bba19a53ecb757c89fec40bfa73c6d61 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Fri, 3 Nov 2017 10:22:34 +0100 Subject: [PATCH] fixed infinite loader when loading current page --- public_html/js/action-script.js | 5 ++--- public_html/js/min/action-script.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/public_html/js/action-script.js b/public_html/js/action-script.js index 1c42b6f..5437289 100755 --- a/public_html/js/action-script.js +++ b/public_html/js/action-script.js @@ -127,17 +127,16 @@ function navMenu(section, persistence){ if( !persistence && current != target ) pageManager.vars = []; + if( current != target ) + DOM.HEADER.addClass('loading'); // Animation de chargement // On charge la page si data-link trouve if( target.getData('link') ){ - DOM.HEADER.addClass('loading'); // Animation de chargement - //pageManager.activeXHR.addEventListener('loadend', var handlerX = function(){ - // 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; if( subSectionExists ) // Si le lien du menu associe existe diff --git a/public_html/js/min/action-script.js b/public_html/js/min/action-script.js index 3082e08..542019d 100755 --- a/public_html/js/min/action-script.js +++ b/public_html/js/min/action-script.js @@ -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 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); \ No newline at end of file +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 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); \ No newline at end of file