1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
(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,o){var s;return(s=new Date).setTime(s.getTime()+864e5*o),document.cookie=e+"="+a+"; expires="+s.toUTCString()+"; path=/; SameSite="+t},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&&$("#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()})),s="",e&&(console.log("action=",e),-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):s=e+"?",s+=i,i=""),y=$("p.removeOther a").attr("href")+"&method="+x+i,s&&(y+="&url="+btoa(s)),$("p.removeOther a").attr("href",y)),window.location.search&&((P=R("llnglanguage"))&&console.log("Get lang from parameter"),1===(A=R("setCookieLang"))&&console.log("Set lang cookie")),c||(c=G("llnglanguage"))&&!P&&console.log("Get lang from cookie"),c)q.call(window.availableLanguages,c)<0&&(c=window.availableLanguages[0],P||console.log("Lang not available -> Get default lang"));else if(navigator){for(p=[],f=[],T=[navigator.language],navigator.languages&&(T=navigator.languages),l=0,g=(j=window.availableLanguages).length;l<g;l++)a=j[l],d+='<img class="langicon" src="'+window.staticPrefix+"common/"+a+'.png" title="'+a+'" alt="['+a+']"> ';for(v=0,w=T.length;v<w;v++)for(S=T[v],console.log("Navigator lang",S),C=0,m=(E=window.availableLanguages).length;C<m;C++)a=E[C],console.log(" Available lang",a),L=new RegExp("^"+a+"-?"),S.match(L)?(console.log(" Matching lang =",a),p.push(a)):a.substring(0,1)===S.substring(0,1)&&f.push(a);(c=p[0]?p[0]:f[0]?f[0]:window.availableLanguages[0])&&!P&&console.log("Get lang from navigator")}else(c=window.availableLanguages[0])&&!P&&console.log("Get lang from window");for(P?(q.call(window.availableLanguages,P)<0&&(console.log("Lang not available -> Get default lang"),P=window.availableLanguages[0]),console.log("Selected lang ->",P),A&&(console.log("Set cookie lang ->",P),J("llnglanguage",P,D.sameSite)),H(P)):(console.log("Selected lang ->",c),J("llnglanguage",c,D.sameSite),H(c)),d="",O=0,h=(z=window.availableLanguages).length;O<h;O++)a=z[O],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,D.sameSite),H(c)}),u=function(e){var a;return 47<(a=e.charCodeAt(0))&&a<58||64<a&&a<91||96<a&&a<123},n=function(e){var a,t,o,s,n,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&&((n=e.match(/[a-z]/g))&&n.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,o=0,s=e.length;o<s;)u(e.charAt(o))||r.indexOf(e.charAt(o))<0&&(t=!0),o++;!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,""),o=0;o<e.length;)0<=r.indexOf(e.charAt(o))&&i++,o++;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(o=i=0;o<e.length;)u(e.charAt(o))||i++,o++;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&&(n(""),$("#newpassword").keyup(function(e){n(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){n(e.target.value)}),n(""))},r=function(){var e,a,t,o;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!=(o=$("#confirmpassword").get(0))&&o.setCustomValidity(F("PE34")),!1)},$("#newpassword").change(r),$("#confirmpassword").change(r),null!=window.datas.ppolicy&&$("#newpassword").length&&$("#reset").change(I),D.enablePasswordDisplay&&(D.dontStorePassword?($(".toggle-password").mousedown(function(){return $(this).toggleClass("fa-eye fa-eye-slash"),$("input[name=password]").attr("class","form-control")}),$(".toggle-password").mouseup(function(){if($(this).toggleClass("fa-eye fa-eye-slash"),$("input[name=password]").get(0).value)return $("input[name=password]").attr("class","form-control key")})):($(".toggle-password").mousedown(function(){return $(this).toggleClass("fa-eye fa-eye-slash"),$("input[name=password]").attr("type","text")}),$(".toggle-password").mouseup(function(){return $(this).toggleClass("fa-eye fa-eye-slash"),$("input[name=password]").attr("type","password")}))),D.pingInterval&&0<D.pingInterval&&window.setTimeout(U,D.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 D.dontStorePassword?"form-control key"===$("#newpassword").attr("class")||"form-control key"===$("#confirmpassword").attr("class")?(console.log("Show passwords"),$("#newpassword").attr("class","form-control"),$("#confirmpassword").attr("class","form-control"),$("#show-hide-icon-button").attr("class","fa fa-eye-slash")):(console.log("Hide passwords"),$("#newpassword").get(0).value&&$("#newpassword").attr("class","form-control key"),$("#confirmpassword").get(0).value&&$("#confirmpassword").attr("class","form-control key"),$("#newpassword").get(0).value||$("#confirmpassword").get(0).value?$("#show-hide-icon-button").attr("class","fa fa-eye"):void 0):"password"===$("#newpassword").attr("type")?(console.log("Show passwords"),$("#newpassword").attr("type","text"),$("#confirmpassword").attr("type","text"),$("#show-hide-icon-button").attr("class","fa fa-eye-slash")):(console.log("Hide passwords"),$("#newpassword").attr("type","password"),$("#confirmpassword").attr("type","password"),$("#show-hide-icon-button").attr("class","fa fa-eye"))}),$("#passwordfield").on("input",function(){return $("#passwordfield").get(0).value&&D.dontStorePassword?$("#passwordfield").attr("class","form-control key"):$("#passwordfield").attr("class","form-control")}),$("#oldpassword").on("input",function(){return $("#oldpassword").get(0).value&&D.dontStorePassword?$("#oldpassword").attr("class","form-control key"):$("#oldpassword").attr("class","form-control")}),$("#newpassword").on("input",function(){return $("#newpassword").get(0).value&&D.dontStorePassword?"fa fa-eye"===$("#show-hide-icon-button").attr("class")?$("#newpassword").attr("class","form-control key"):void 0:$("#newpassword").attr("class","form-control")}),$("#confirmpassword").on("input",function(){return $("#confirmpassword").get(0).value&&D.dontStorePassword?"fa fa-eye"===$("#show-hide-icon-button").attr("class")?$("#confirmpassword").attr("class","form-control key"):void 0:$("#confirmpassword").attr("class","form-control")}),$(".clear-finduser-field").on("click",function(){return $(this).parent().find(":input").each(function(){return console.log("Clear search field ->",$(this).attr("name")),$(this).val("")})}),$("#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),$("input[name=spoofId]").each(function(){return $(this).val(a)}),e.captcha&&$("#captcha").attr("src",e.captcha),e.token)return $("#finduserToken").val(e.token),$("#token").val(e.token)},error:function(e,a,t){var o;if(document.body.style.cursor="default",t&&console.log("Error",t),e&&(o=JSON.parse(e.responseText)),o&&o.error)return console.log("Returned error",o)}})})})}).call(this); |