1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
(function(){var G,a,D,R,N,U,V,_,J,e,M,g,F,q,r,H=[].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={},q=function(s){return $.getJSON(window.staticPrefix+"languages/"+s+".json",function(e){var a,t,n,o;for(a in r=e,t=window.datas.trOver.all)o=t[a],r[a]=o;if(window.datas.trOver[s])for(a in n=window.datas.trOver[s])o=n[a],r[a]=o;return $("[trspan]").each(function(){var e,a,t,n;for(e=$(this).attr("trspan").split(","),n=F(e.shift()),a=0,t=e.length;a<t;a++)o=e[a],n=n.replace(/%[sd]/,o);return $(this).html(n)}),$("[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 o;return o={},$("script[type='application/init']").each(function(){var a,e,t,n;try{for(e in n=JSON.parse($(this).text()),t=[],n)t.push(o[e]=n[e]);return t}catch(e){return a=e,console.log("Parsing error",a),console.log("JSON",$(this).text())}}),console.log(o),o},R=function(e){var a;return(a=RegExp("[?&]"+e+"=([^&]*)").exec(window.location.search))?decodeURIComponent(a[1].replace(/\+/g," ")):null},g="#appslist",M=function(){return e("_appsListOrder",$(g).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,n,o,s){return $.ajax({type:"GET",url:G.scriptname+"/mysession/?gettoken",dataType:"json",error:s,success:function(e){var a;return(a={token:e.token})[t]=n,$.ajax({type:"PUT",url:G.scriptname+"/mysession/persistent",dataType:"json",data:a,success:o,error:s})}})},a=function(a,t,n,o){return $.ajax({type:"GET",url:G.scriptname+"/mysession/?gettoken",dataType:"json",error:o,success:function(e){return $.ajax({type:"DELETE",url:G.scriptname+"/mysession/persistent/"+a+"?sub="+t+"&token="+e.token,dataType:"json",success:n,error:o})}})},_=function(){var e,a,t,n,o,s,r,i,l,c,d,p,u;if(null==(l=$(g))||!G.appslistorder)return null;for(e=G.appslistorder.split(","),d=[],s=0,r=(o=l.sortable("toArray")).length;s<r;s++)d[u=o[s]]=u;for(c=0,i=e.length;c<i;c++)d[n=e[c]]&&(t=d[n],a=$(g+".ui-sortable").children("#"+t),p=$(g+".ui-sortable").children("#"+n),a.remove(),$(g+".ui-sortable").filter(":first").append(p));return 1},U=function(){return $.ajax({type:"POST",url:G.scriptname,data:{ping:1},dataType:"json",success:function(e){return null!=e.result&&1===e.result?setTimeout(U,G.pingInterval):location.reload(!0)},error:function(e,a,t){return location.reload(!0)}})},window.ping=U,D=function(e){var a,t,n,o,s;for(e+"=",t=decodeURIComponent(document.cookie).split(";"),s=new RegExp("^ *"+e+"="),n=0,o=t.length;n<o;n++)if((a=t[n]).match(s))return a=a.replace(s,"");return""},J=function(e,a,t){var n;return(n=new Date).setTime(n.getTime()+864e5*t),document.cookie=e+"="+a+"; expires="+n.toUTCString()+"; path=/"},G={},$(window).on("load",function(){var e,a,t,n,o,s,r,i,u,l,c,d,p,g,f,h,w,m,y,v,b,k,x,C,T,O,L,S,j,E,P,z,A,I;if(G=N(),"datas"in window&&"choicetab"in window.datas&&(G.choicetab=window.datas.choicetab),window.datas=G,$("#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="#'+G.displaytab+'"]').parent().index())<0&&(b=0),k.tabs("option","active",b),n=$("#authMenu").tabs({active:0}),(t=$('#authMenu a[href="#'+G.displaytab+'"]').parent().index())<0&&(t=0),n.tabs("option","active",t),G.choicetab&&n.tabs("option","active",$('#authMenu a[href="#'+G.choicetab+'"]').parent().index()),G.login?$("input[type=password]:first").focus():0===$("input[autofocus]").length&&$("input[type!=hidden]:first").focus(),G.newwindow&&$("#appslist a").attr("target","_blank"),$("p.removeOther").length&&(e=$("#form").attr("action"),x=$("#form").attr("method"),console.log("method=",x),i="",$("#form input[type=hidden]")&&(console.log("Parse hidden values"),$("#form input[type=hidden]").each(function(e){return console.log(" ->",$(this).attr("name"),$(this).val()),i+="&"+$(this).attr("name")+"="+$(this).val()})),o="",e&&(console.log("action=",e),-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):o=e+"?",o+=i,i=""),y=$("p.removeOther a").attr("href")+"&method="+x+i,o&&(y+="&url="+btoa(o)),$("p.removeOther a").attr("href",y)),window.location.search&&((S=R("llnglanguage"))&&console.log("Get lang from parameter"),1===(A=R("setCookieLang"))&&console.log("Set lang cookie")),c||(c=D("llnglanguage"))&&!S&&console.log("Get lang from cookie"),c)H.call(window.availableLanguages,c)<0&&(c=window.availableLanguages[0],S||console.log("Lang not available -> Get default lang"));else if(navigator){for(p=[],g=[],O=[navigator.language],navigator.languages&&(O=navigator.languages),l=0,f=(E=window.availableLanguages).length;l<f;l++)a=E[l],d+='<img class="langicon" src="'+window.staticPrefix+"common/"+a+'.png" title="'+a+'" alt="['+a+']"> ';for(v=0,h=O.length;v<h;v++)for(T=O[v],console.log("Navigator lang",T),C=0,w=(P=window.availableLanguages).length;C<w;C++)a=P[C],console.log(" Available lang",a),j=new RegExp("^"+a+"-?"),T.match(j)?(console.log(" Matching lang =",a),p.push(a)):a.substring(0,1)===T.substring(0,1)&&g.push(a);(c=p[0]?p[0]:g[0]?g[0]:window.availableLanguages[0])&&!S&&console.log("Get lang from navigator")}else(c=window.availableLanguages[0])&&!S&&console.log("Get lang from window");for(S?(H.call(window.availableLanguages,S)<0&&(console.log("Lang not available -> Get default lang"),S=window.availableLanguages[0]),console.log("Selected lang ->",S),A&&(console.log("Set cookie lang ->",S),J("llnglanguage",S)),q(S)):(console.log("Selected lang ->",c),J("llnglanguage",c),q(c)),d="",L=0,m=(z=window.availableLanguages).length;L<m;L++)a=z[L],d+='<img class="langicon" src="'+window.staticPrefix+"common/"+a+'.png" title="'+a+'" alt="['+a+']"> ';return $("#languages").html(d),$(".langicon").on("click",function(){return c=$(this).attr("title"),J("llnglanguage",c),q(c)}),u=function(e){var a;return 47<(a=e.charCodeAt(0))&&a<58||64<a&&a<91||96<a&&a<123},s=function(e){var a,t,n,o,s,r,i,l,c,d,p;if(d=!0,0<window.datas.ppolicy.minsize&&(e.length>=window.datas.ppolicy.minsize?($("#ppolicy-minsize-feedback").addClass("fa-check text-success"),$("#ppolicy-minsize-feedback").removeClass("fa-times text-danger")):($("#ppolicy-minsize-feedback").removeClass("fa-check text-success"),$("#ppolicy-minsize-feedback").addClass("fa-times text-danger"),d=!1)),0<window.datas.ppolicy.minupper&&((p=e.match(/[A-Z]/g))&&p.length>=window.datas.ppolicy.minupper?($("#ppolicy-minupper-feedback").addClass("fa-check text-success"),$("#ppolicy-minupper-feedback").removeClass("fa-times text-danger")):($("#ppolicy-minupper-feedback").removeClass("fa-check text-success"),$("#ppolicy-minupper-feedback").addClass("fa-times text-danger"),d=!1)),0<window.datas.ppolicy.minlower&&((s=e.match(/[a-z]/g))&&s.length>=window.datas.ppolicy.minlower?($("#ppolicy-minlower-feedback").addClass("fa-check text-success"),$("#ppolicy-minlower-feedback").removeClass("fa-times text-danger")):($("#ppolicy-minlower-feedback").removeClass("fa-check text-success"),$("#ppolicy-minlower-feedback").addClass("fa-times text-danger"),d=!1)),0<window.datas.ppolicy.mindigit&&((a=e.match(/[0-9]/g))&&a.length>=window.datas.ppolicy.mindigit?($("#ppolicy-mindigit-feedback").addClass("fa-check text-success"),$("#ppolicy-mindigit-feedback").removeClass("fa-times text-danger")):($("#ppolicy-mindigit-feedback").removeClass("fa-check text-success"),$("#ppolicy-mindigit-feedback").addClass("fa-times text-danger"),d=!1)),window.datas.ppolicy.allowedspechar){for(r=window.datas.ppolicy.allowedspechar.replace(/\s/g,""),t=!1,n=0,o=e.length;n<o;)u(e.charAt(n))||r.indexOf(e.charAt(n))<0&&(t=!0),n++;!1===t?($("#ppolicy-allowedspechar-feedback").addClass("fa-check text-success"),$("#ppolicy-allowedspechar-feedback").removeClass("fa-times text-danger")):($("#ppolicy-allowedspechar-feedback").removeClass("fa-check text-success"),$("#ppolicy-allowedspechar-feedback").addClass("fa-times text-danger"),d=!1)}if(0<window.datas.ppolicy.minspechar&&window.datas.ppolicy.allowedspechar){for(i=0,r=window.datas.ppolicy.allowedspechar.replace(/\s/g,""),n=0;n<e.length;)0<=r.indexOf(e.charAt(n))&&i++,n++;i>=window.datas.ppolicy.minspechar?($("#ppolicy-minspechar-feedback").addClass("fa-check text-success"),$("#ppolicy-minspechar-feedback").removeClass("fa-times text-danger")):($("#ppolicy-minspechar-feedback").removeClass("fa-check text-success"),$("#ppolicy-minspechar-feedback").addClass("fa-times text-danger"),d=!1)}if(0<window.datas.ppolicy.minspechar&&!window.datas.ppolicy.allowedspechar){for(n=i=0;n<e.length;)u(e.charAt(n))||i++,n++;i>=window.datas.ppolicy.minspechar?($("#ppolicy-minspechar-feedback").addClass("fa-check text-success"),$("#ppolicy-minspechar-feedback").removeClass("fa-times text-danger")):($("#ppolicy-minspechar-feedback").removeClass("fa-check text-success"),$("#ppolicy-minspechar-feedback").addClass("fa-times text-danger"),d=!1)}d?($(".ppolicy").removeClass("border-danger").addClass("border-success"),null!=(l=$("#newpassword").get(0))&&l.setCustomValidity("")):($(".ppolicy").removeClass("border-success").addClass("border-danger"),null!=(c=$("#newpassword").get(0))&&c.setCustomValidity(F("PE28")))},null!=window.datas.ppolicy&&$("#newpassword").length&&(s(""),$("#newpassword").keyup(function(e){s(e.target.value)})),I=function(e){var a;return e.target.checked?($("#newpassword").off("keyup"),null!=(a=$("#newpassword").get(0))?a.setCustomValidity(""):void 0):($("#newpassword").keyup(function(e){s(e.target.value)}),s(""))},r=function(){var e,a,t,n;return(null!=(e=$("#confirmpassword").get(0))?e.value:void 0)===(null!=(a=$("#newpassword").get(0))?a.value:void 0)?(null!=(t=$("#confirmpassword").get(0))&&t.setCustomValidity(""),!0):(null!=(n=$("#confirmpassword").get(0))&&n.setCustomValidity(F("PE34")),!1)},$("#newpassword").change(r),$("#confirmpassword").change(r),null!=window.datas.ppolicy&&$("#newpassword").length&&$("#reset").change(I),G.pingInterval&&0<G.pingInterval&&window.setTimeout(U,G.pingInterval),$(".localeDate").each(function(){var e;return e=new Date(1e3*$(this).attr("val")),$(this).text(e.toLocaleString())}),$(".oidcConsent").on("click",function(){return V($(this).attr("partner"))}),$("#show-hide-button").on("click",function(){return"password"===$("#newpassword").attr("type")?(console.log("Show passwords"),$("#newpassword").attr("type","input"),$("#confirmpassword").attr("type","input"),$("#show-hide-icon-button").removeClass("fa-eye"),$("#show-hide-icon-button").addClass("fa-eye-slash")):(console.log("Hide passwords"),$("#newpassword").attr("type","password"),$("#confirmpassword").attr("type","password"),$("#show-hide-icon-button").removeClass("fa-eye-slash"),$("#show-hide-icon-button").addClass("fa-eye"))}),$("#resetfinduserform").on("click",function(){return console.log("Reset form"),$("#finduserForm").trigger("reset")}),$("#closefinduserform").on("click",function(){return console.log("Clear modal"),$("#finduserForm").trigger("reset")}),$("#finduserbutton").on("click",function(e){var a;return e.preventDefault(),document.body.style.cursor="progress",a=$("#finduserForm").serialize(),console.log("Send findUser request with parameters",a),$.ajax({type:"POST",url:portal+"finduser",dataType:"json",data:a,success:function(e){var a;if(document.body.style.cursor="default",a=e.user,console.log("Suggested spoofId=",a),$("#spoofIdfield").attr("value",a),e.captcha&&$("#captcha").attr("src",e.captcha),e.token)return $("#finduserToken").attr("value",e.token),$("#token").attr("value",e.token)},error:function(e,a,t){var n;if(document.body.style.cursor="default",t&&console.log("Error",t),e&&(n=JSON.parse(e.responseText)),n&&n.error)return console.log("Returned error",n)}})})})}).call(this); |