From 4493bf341b2287f94689cfc5c50ba4fbc2d57cc8 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 9 Jan 2017 14:51:42 +0100 Subject: [PATCH] Cleaned machines.js on the model of users.js (last commit) --- public_html/view/js/machines.js | 9 ++--- public_html/view/js/min/machines.js | 56 +++++++++++++++++------------ public_html/view/js/min/users.js | 6 ++-- public_html/view/js/users.js | 3 -- 4 files changed, 40 insertions(+), 34 deletions(-) diff --git a/public_html/view/js/machines.js b/public_html/view/js/machines.js index bb127d4..075cf60 100755 --- a/public_html/view/js/machines.js +++ b/public_html/view/js/machines.js @@ -690,8 +690,7 @@ if( section.groups.element != null ){ for( i = 0 ; i < section.groups.link.edit.length ; i++ ){ section.groups.link.edit[i].addEventListener('click', function(e){ - pageManager.vars[0] = 'edit'; - pageManager.vars[1] = 'm'+e.target.getData('cluster'); + pageManager.vars = [ 'edit', 'm'+e.target.getData('cluster') ]; navMenu('groups', true); }, false); @@ -701,8 +700,7 @@ if( section.groups.element != null ){ for( i = 0 ; i < section.groups.link.remove.length ; i++ ){ section.groups.link.remove[i].addEventListener('click', function(e){ - pageManager.vars[0] = 'remove'; - pageManager.vars[1] = 'm'+e.target.getData('cluster'); + pageManager.vars = [ 'remove', 'm'+e.target.getData('cluster') ]; navMenu('groups', true); }, false); @@ -740,8 +738,7 @@ if( section.groups.element != null ){ for( i = 0 ; i < section.groups.group.add.length ; i++ ){ section.groups.group.add[i].addEventListener('click', function(e){ - pageManager.vars[0] = 'members'; - pageManager.vars[1] = 'm'+e.target.getData('cluster'); + pageManager.vars = [ 'members', 'm'+e.target.getData('cluster') ]; navMenu('groups', true); }, false); diff --git a/public_html/view/js/min/machines.js b/public_html/view/js/min/machines.js index 837ce8f..fae76e1 100755 --- a/public_html/view/js/min/machines.js +++ b/public_html/view/js/min/machines.js @@ -1,22 +1,34 @@ -var section={view:{text:'#CONTAINER > section[data-sublink="view"] ',element:document.querySelector('#CONTAINER > section[data-sublink="view"]'),searchbar:document.querySelector('#CONTAINER > section[data-sublink="view"] > .searchbar')},create:{text:'#CONTAINER > section[data-sublink="create"] ',element:document.querySelector('#CONTAINER > section[data-sublink="create"]')},remove:{text:'#CONTAINER > section[data-sublink="remove"] ',element:document.querySelector('#CONTAINER > section[data-sublink="remove"]')}, -edit:{text:'#CONTAINER > section[data-sublink="edit"] ',element:document.querySelector('#CONTAINER > section[data-sublink="edit"]')},groups:{text:'#CONTAINER > section[data-sublink="groups"] ',element:document.querySelector('#CONTAINER > section[data-sublink="groups"]'),searchbar:document.querySelector('#CONTAINER > section[data-sublink="groups"] > .searchbar')}}; -if(null!=section.view.element){1 article.inline-box[id]");for(c=0;c article.inline-box[id]");for(c=0;c section[data-sublink="view"] ',element:document.querySelector('#CONTAINER > section[data-sublink="view"]'),searchbar:document.querySelector('#CONTAINER > section[data-sublink="view"] > .searchbar')},create:{text:'#CONTAINER > section[data-sublink="create"] ',element:document.querySelector('#CONTAINER > section[data-sublink="create"]')},remove:{text:'#CONTAINER > section[data-sublink="remove"] ',element:document.querySelector('#CONTAINER > section[data-sublink="remove"]')},edit:{text:'#CONTAINER > section[data-sublink="edit"] ',element:document.querySelector('#CONTAINER > section[data-sublink="edit"]')},groups:{text:'#CONTAINER > section[data-sublink="groups"] ',element:document.querySelector('#CONTAINER > section[data-sublink="groups"]'),searchbar:document.querySelector('#CONTAINER > section[data-sublink="groups"] > .searchbar')}} +if(null!=section.view.element){pageManager.vars.length>1&&!isNaN(pageManager.vars[1])&&(document.location="#"+pageManager.vars[1],null!=document.getElementById(pageManager.vars[1])&&document.getElementById(pageManager.vars[1]).addClass("selected")),section.view.link={edit:document.querySelectorAll(section.view.text+".link_edit[data-machine]"),remove:document.querySelectorAll(section.view.text+".link_remove[data-machine]")},section.view.group={rem:document.querySelectorAll(section.view.text+".rem-group[data-machine][data-group]"),add:document.querySelectorAll(section.view.text+".add-group[data-machine]")},section.view.searchbar.addEventListener("keyup",function(e){var t={path:"machineDefault/search",keywords:section.view.searchbar.value} +api.send(t,function(e){if(0==e.ModuleError){for(var t=[],i=0;i article.inline-box[id]"),i=0;i-1?n[i].remClass("hidden"):n[i].addClass("hidden")}})},!1) +for(var i=0;i=2&&!isNaN(pageManager.vars[1])&&api.send({path:"machineDefault/getById",id_machine:pageManager.vars[1]},function(e){0==e.ModuleError&&(found_edit=[e.machine],searchindex_edit=0,autofill_edit(),found_remove=[e.machine],searchindex_remove=0,autofill_remove())}),null!=section.groups.element){section.groups.link={remove:document.querySelectorAll(section.groups.text+".link_remove[data-cluster]"),edit:document.querySelectorAll(section.groups.text+".link_edit[data-cluster]")},section.groups.group={rem:document.querySelectorAll(section.groups.text+".rem-member[data-cluster][data-member]"),add:document.querySelectorAll(section.groups.text+".add-member[data-cluster]")},section.groups.searchbar.addEventListener("keyup",function(e){var t={path:"clusterDefault/search",keywords:section.groups.searchbar.value,class:1} +api.send(t,function(e){if(0==e.ModuleError){for(var t=[],i=0;i article.inline-box[id]"),i=0;i-1?n[i].remClass("hidden"):n[i].addClass("hidden")}})},!1) +var i +for(i=0;i article.inline-box[id]"),r=0;r-1?i[r].remClass("hidden"):i[r].addClass("hidden")}})},!1) var i -for(i=0;i