diff --git a/public/dist/scripts/app-all.js b/public/dist/scripts/app-all.js index 9aa076621..8a131d67c 100644 --- a/public/dist/scripts/app-all.js +++ b/public/dist/scripts/app-all.js @@ -2397,8 +2397,9 @@ children[prop]=template.cloneNode(true);element.appendChild(children[prop]);(ind container.set('$index',originalIndex,true,false);container.set('$prefix',originalPrefix,true,false);container.set('$as',originalAs,true,false);element.dispatchEvent(new Event('looped'));};let template=(element.children.length===1)?element.children[0]:window.document.createElement('li');echo();container.bind(element,expr+'.length',echo);let path=(expr+'.length').split('.');while(path.length){container.bind(element,path.join('.'),echo);path.pop();}}});window.ls.container.get('view').add({selector:'data-ls-template',template:false,repeat:true,controller:function(element,view,http,expression,document){let template=expression.parse(element.getAttribute('data-ls-template'));let type=element.getAttribute('data-type')||'url';element.innerHTML='';if('script'===type){let inlineTemplate=document.getElementById(template);if(inlineTemplate&&inlineTemplate.innerHTML){element.innerHTML=inlineTemplate.innerHTML;element.dispatchEvent(new CustomEvent('template-loaded',{bubbles:true,cancelable:false}));} else{element.innerHTML='Missing template "'+template+'"';} return;} -http.get(template).then(function(element){return function(data){element.innerHTML=data;view.render(element);element.dispatchEvent(new CustomEvent('template-loaded',{bubbles:true,cancelable:false}));}}(element),function(){throw new Error('Failed loading template');});}});window.ls.error=function(){return function(error){console.error("ERROR-APP",error);};};window.addEventListener("error",function(event){console.error("ERROR-EVENT:",event.error.message,event.error.stack);});document.addEventListener("logout",function(){window.location="/auth/signin";});document.addEventListener("http-get-401",function(){document.dispatchEvent(new CustomEvent("logout"));},true);(function(window){"use strict";window.ls.container.set('alerts',function(window){return{list:[],counter:0,add:function(message,time){var scope=this;message.id=this.counter++;scope.list.unshift(message);if(time>0){window.setTimeout(function(message){return function(){scope.remove(message.id)}}(message),time);} -return message.id;},remove:function(id){let scope=this;for(let index=0;indexscope.max){scope.list.pop();scope.counter--;} +if(time>0){window.setTimeout(function(message){return function(){scope.remove(message.id)}}(message),time);} +return message.id;},remove:function(id){let scope=this;for(let index=0;index';} return;} -http.get(template).then(function(element){return function(data){element.innerHTML=data;view.render(element);element.dispatchEvent(new CustomEvent('template-loaded',{bubbles:true,cancelable:false}));}}(element),function(){throw new Error('Failed loading template');});}});window.ls.error=function(){return function(error){console.error("ERROR-APP",error);};};window.addEventListener("error",function(event){console.error("ERROR-EVENT:",event.error.message,event.error.stack);});document.addEventListener("logout",function(){window.location="/auth/signin";});document.addEventListener("http-get-401",function(){document.dispatchEvent(new CustomEvent("logout"));},true);(function(window){"use strict";window.ls.container.set('alerts',function(window){return{list:[],counter:0,add:function(message,time){var scope=this;message.id=this.counter++;scope.list.unshift(message);if(time>0){window.setTimeout(function(message){return function(){scope.remove(message.id)}}(message),time);} -return message.id;},remove:function(id){let scope=this;for(let index=0;indexscope.max){scope.list.pop();scope.counter--;} +if(time>0){window.setTimeout(function(message){return function(){scope.remove(message.id)}}(message),time);} +return message.id;},remove:function(id){let scope=this;for(let index=0;index scope.max) { + scope.list.pop(); + scope.counter--; + } if (time > 0) { // When 0 alert is unlimited in time window.setTimeout(function (message) { @@ -20,6 +29,7 @@ }(message), time); } + return message.id; }, remove: function (id) { @@ -29,11 +39,14 @@ let obj = scope.list[index]; if (obj.id === parseInt(id)) { + scope.counter--; + if (typeof obj.callback === "function") { obj.callback(); } scope.list.splice(index, 1); + }; } }