lemonldap-ng/lemonldap-ng-portal/site/htdocs/static/common/js/portal.min.js
2017-01-19 11:33:11 +00:00

1 line
3.0 KiB
JavaScript

(function(){var e,i,d,a,j,h,f,b,k,c,g=[].indexOf||function(o){for(var n=0,m=this.length;n<m;n++){if(n in this&&this[n]===o){return n}}return -1};c={};k=function(l){return $.getJSON(window.staticPrefix+"languages/"+l+".json",function(m){c=m;$("[trspan]").each(function(){return $(this).text(b($(this).attr("trspan")))});return $("[trmsg]").each(function(){return $(this).text(b("PE"+($(this).attr("trmsg"))))})})};b=function(l){if(c[l]){return c[l]}else{return l}};d=function(){var l;l={};$("script[type='application/init']").each(function(){var q,n,m,p,o;try{o=JSON.parse($(this).text);p=[];for(m in o){p.push(l[m]=o[m])}return p}catch(n){q=n;return console.log("Parsing error",q)}});return l};f="#appslist";i=function(){return $.ajax({type:"POST",url:e.scriptname,data:{storeAppsListOrder:$(f).sortable("toArray").join()},dataType:"json"})};h=function(){var n,m,q,y,l,u,p,r,o,t,w,s,x;t=$(f);if(!((t!=null)&&e.appslistorder)){return null}n=e.appslistorder.split(",");u=t.sortable("toArray");w=[];for(q=0,r=u.length;q<r;q++){x=u[q];w[x]=x}for(p=0,o=n.length;p<o;p++){l=n[p];if(g.call(w,l)>=0){y=w[l];m=$(f+".ui-sortable").children("#"+y);s=$(f+".ui-sortable").children("#"+l);m.remove();$(f+".ui-sortable").filter(":first").append(s)}}return 1};a=function(l){return $("#lmhidden_"+l).length};j=function(){return $.ajax({type:"POST",url:e.scriptname,data:{ping:1},dataType:"json",success:function(l){if(l.auth){return setTimeout(j,e.pingInterval)}else{return location.reload(true)}}})};window.ping=j;e={};$(document).ready(function(){var x,w,z,v,A,y,C,t,s,B,r,q,u,o,m,n,l,p;e=d();window.datas=e;if(e.antiframe&&top!==self){top.location.href=location.href}$("#appslist").sortable({axis:"y",cursor:"move",opacity:0.5,revert:true,items:"> div.category",update:function(){return i()}});h();$("div.message").fadeIn("slow");$("input[name=timezone]").val(-(new Date().getTimezoneOffset()/60));o=$("#menu").tabs({active:0});u=$('#menu a[href="#'+e.displaytab+'"]').parent().index();if(u<0){u=0}o.tabs("option","active",u);z=$("#authMenu").tabs({active:0});if(e.choicetab){z.tabs("option","active",$('#authMenu a[href="#'+e.choicetab+'"]').parent().index())}if(e.login){$("input[type=password]:first").focus()}else{$("input[type!=hidden]:first").focus()}if(e.newwindow){$("#appslist a").attr("target","_blank")}if($("p.removeOther").length){x=$("form.login").attr("action");m=$("form.login").attr("method");v="";if(x.indexOf("?")!==-1){x.substring(0,x.indexOf("?"))+"?"}else{v=x+"?"}$("form.login input[type=hidden]").each(function(D){return v+="&"+$(this).attr("name")+"="+$(this).val()});q=$("p.removeOther a").attr("href")+"&method="+m+"&url="+btoa(v);$("p.removeOther a").attr("href",q)}if(navigator){t=[];s=[];l=[navigator.language];if(navigator.languages){l=navigator.languages}for(A=0,B=l.length;A<B;A++){n=l[A];p=window.availableLanguages;for(y=0,r=p.length;y<r;y++){w=p[y];if(w===n){t.push(w)}else{if(w.substring(0,1)===n.substring(0,1)){s.push(w)}}}}C=t[0]?t[0]:s[0]?s[0]:"en"}else{C="en"}if(e.pingInterval&&e.pingInterval>0){window.setTimeout(j,e.pingInterval)}return k(C)})}).call(this);