lemonldap-ng/lemonldap-ng-portal/site/htdocs/static/common/js/portal.min.js

1 line
14 KiB
JavaScript
Raw Normal View History

2021-08-12 22:36:23 +02:00
(function(){var D,a,G,R,N,U,V,_,J,e,M,f,F,H,r,q=[].indexOf||function(e){for(var a=0,t=this.length;a<t;a++)if(a in this&&this[a]===e)return a;return-1};r={},H=function(n){return $.getJSON(window.staticPrefix+"languages/"+n+".json",function(e){var a,t,o,s;for(a in r=e,t=window.datas.trOver.all)s=t[a],r[a]=s;if(window.datas.trOver[n])for(a in o=window.datas.trOver[n])s=o[a],r[a]=s;return $("[trspan]").each(function(){var e,a,t,o;for(e=$(this).attr("trspan").split(","),o=F(e.shift()),a=0,t=e.length;a<t;a++)s=e[a],o=o.replace(/%[sd]/,s);return $(this).html(o)}),$("[trmsg]").each(function(){if($(this).html(F("PE"+$(this).attr("trmsg"))),F("PE"+$(this).attr("trmsg")).match(/_hide_/))return $(this).parent().hide()}),$("[trplaceholder]").each(function(){return $(this).attr("placeholder",F($(this).attr("trplaceholder")))}),$("[localtime]").each(function(){var e;return e=new Date(1e3*$(this).attr("localtime")),$(this).text(e.toLocaleString())})})},F=function(e){return r[e]?r[e]:e},window.translate=F,N=function(){var s;return s={},$("script[type='application/init']").each(function(){var a,e,t,o;try{for(e in o=JSON.parse($(this).text()),t=[],o)t.push(s[e]=o[e]);return t}catch(e){return a=e,console.log("Parsing error",a),console.log("JSON",$(this).text())}}),console.log(s),s},R=function(e){var a;return(a=RegExp("[?&]"+e+"=([^&]*)").exec(window.location.search))?decodeURIComponent(a[1].replace(/\+/g," ")):null},f="#appslist",M=function(){return e("_appsListOrder",$(f).sortable("toArray").join())},V=function(e){return a("_oidcConsents",e,function(){return $("[partner='"+e+"']").hide()},function(e,a,t){return alert(a+" "+t)})},e=function(t,o,s,n){return $.ajax({type:"GET",url:D.scriptname+"/mysession/?gettoken",dataType:"json",error:n,success:function(e){var a;return(a={token:e.token})[t]=o,$.ajax({type:"PUT",url:D.scriptname+"/mysession/persistent",dataType:"json",data:a,success:s,error:n})}})},a=function(a,t,o,s){return $.ajax({type:"GET",url:D.scriptname+"/mysession/?gettoken",dataType:"json",error:s,success:function(e){return $.ajax({type:"DELETE",url:D.scriptname+"/mysession/persistent/"+a+"?sub="+t+"&token="+e.token,dataType:"json",success:o,error:s})}})},_=function(){var e,a,t,o,s,n,r,i,l,c,d,p,u;if(null==(l=$(f))||!D.appslistorder)return null;for(e=D.appslistorder.split(","),d=[],n=0,r=(s=l.sortable("toArray")).length;n<r;n++)d[u=s[n]]=u;for(c=0,i=e.length;c<i;c++)d[o=e[c]]&&(t=d[o],a=$(f+".ui-sortable").children("#"+t),p=$(f+".ui-sortable").children("#"+o),a.remove(),$(f+".ui-sortable").filter(":first").append(p));return 1},U=function(){return $.ajax({type:"POST",url:D.scriptname,data:{ping:1},dataType:"json",success:function(e){return null!=e.result&&1===e.result?setTimeout(U,D.pingInterval):location.reload(!0)},error:function(e,a,t){return location.reload(!0)}})},window.ping=U,G=function(e){var a,t,o,s,n;for(e+"=",t=decodeURIComponent(document.cookie).split(";"),n=new RegExp("^ *"+e+"="),o=0,s=t.length;o<s;o++)if((a=t[o]).match(n))return a=a.replace(n,"");return""},J=function(e,a,t){var o;return(o=new Date).setTime(o.getTime()+864e5*t),document.cookie=e+"="+a+"; expires="+o.toUTCString()+"; path=/"},D={},$(window).on("load",function(){var e,a,t,o,s,n,r,i,u,l,c,d,p,f,g,w,m,h,y,v,b,k,x,C,S,T,O,P,L,j,E,z,A,I;if(D=N(),"datas"in window&&"choicetab"in window.datas&&(D.choicetab=window.datas.choicetab),window.datas=D,$("#appslist").sortable({axis:"y",cursor:"move",opacity:.5,revert:!0,items:"> div.category",update:function(){return M()}}),_(),$("div.message").fadeIn("slow"),$("input[name=timezone]").val(-(new Date).getTimezoneOffset()/60),k=$("#menu").tabs({active:0}),(b=$('#menu a[href="#'+D.displaytab+'"]').parent().index())<0&&(b=0),k.tabs("option","active",b),o=$("#authMenu").tabs({active:0}),(t=$('#authMenu a[href="#'+D.displaytab+'"]').parent().index())<0&&(t=0),o.tabs("option","active",t),D.choicetab&&o.tabs("option","active",$('#authMenu a[href="#'+D.choicetab+'"]').parent().index()),D.login?$("input[type=password]:first").focus():0===$("input[autofocus]").length&&$("input[type!=hidden]:first").focus(),D.newwindow&&$("#appsl