NxTIC/js/action-script-min.js

8 lines
2.8 KiB
JavaScript

var DOM={WRAPPER:$("WRAPPER"),HEADER:$("HEADER"),MENUSIDE:$("MENU-SIDE"),CONTAINER:$("CONTAINER")},pageManager;api=new APIClass("/api/");
function navSubMenu(a){var c=document.querySelector("#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?document.querySelector("#MENU-SIDE > span[data-link="+pageManager.page+'] + div.sub > span[data-sublink="'+a+'"]'):b,b=null==b?document.querySelector("#MENU-SIDE > span[data-link="+pageManager.page+"] + div.sub > span[data-sublink]"):b;if(null==b)return!1;null!=c&&c.remClass("active");
a=document.querySelectorAll("#CONTAINER > section[data-sublink].active");for(c=0;c<a.length;c++)a[c].remClass("active");null!=b&&(b.addClass("active"),a=document.querySelector('#CONTAINER > section[data-sublink="'+b.getData("sublink")+'"]'),null!=a&&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()}
function navMenu(a){var c=document.querySelector('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.page+'"]'),b=null,b=a instanceof Element?a:null,b="string"==typeof a?document.querySelector('#WRAPPER > #MENU-SIDE > span[data-link="'+a+'"]'):b,b=null==b?document.querySelector('#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"),pageManager.setPage(b.getData("link")),
pageManager.activeXHR.addEventListener("loadend",function(){1<=pageManager.vars.length&&null!=document.querySelector('#CONTAINER > section[data-sublink="'+pageManager.vars[0]+'"]')?navSubMenu(pageManager.vars[0]):navSubMenu(null);var a=document.querySelector("#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.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);pageManagerClass.prototype.ajax("/f/json/menu/conf",function(a){var c=[];a=JSON.parse(a);for(var b=0;b<a.length;b++)c.push(a[b].attributes["data-link"]);pageManager=new pageManagerClass;pageManager.setPage(null,"/view",DOM.CONTAINER,c);navMenu(pageManager.page)},"GET");