lemonldap-ng/lemonldap-ng-portal/site/htdocs/static/common/js/portal.min.js
2017-01-19 06:09:20 +00:00

1 line
3.0 KiB
JavaScript

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