4cf08013a3a1ec42e4332ba8750a8f2aa7e580bbb5abdb0f4ad1f879433d5195

Source Code:

var signinbox={logCount:0,doingLogin:!1,inputFocused:!1,containerWidth:889,signInUtilModal:{},show:function(e){var o=document.getElementById("signinModal"),t=-1<window.location.href.indexOf("awards/nominees")?document.querySelectorAll(".voteList"):document.getElementById("headerLoginLink");if(navigator.userAgent&&navigator.userAgent.match(/PLAYSTATION/))return document.location.assign("http://"+location.hostname+"/login"),!1;"block"!=o.style.display&&null!=t&&(openModal(e),appendedTasteProfile("js-tasteProfileLoginModal"),document.getElementById("usernameModal").focus())},hide:function(){document.querySelectorAll(".signinError").style.display="none",document.querySelectorAll(".js-signinUsernameModal").value="",document.getElementById("js-signinPasswordModal").value="",document.getElementById("js-redirect").value=""}};function openModal(l){var s,e=document.getElementById("signinModal"),o=document.querySelectorAll(".js_closeModal");e&&(s=l,signinbox.signInUtilModal=new MG_Modal({content:e}),null!==typeof signinbox.signInUtilModal&&signinbox.signInUtilModal.openModal(function(e,o){var t,n=o.querySelectorAll(".js-signinUsernameModal");if((l=o.querySelectorAll("[class*=loginAccessTitle]"))[0].innerHTML=s||textPHTranslation.loginTitle,0<=l[0].innerHTML.toLowerCase().indexOf("subscribe")){var a=document.getElementsByClassName("js-loginFormModal"),r=document.createElement("input");for(r.type="hidden",r.name="subscribe",r.value=1,i=0;i<a.length;i++)a[i].appendChild(r)}n[0].focus(),passEvents(o),showCaptcha&&((t=o.querySelector(".g-recaptcha"))&&initializeCaptcha(t),toggleButtonDisable(!0))}),MG_Utils.addEventHandler(o,"click",function(){void 0!==signinbox.signInUtilModal&&(signinbox.signInUtilModal.closeModal(),recaptchaComplete=!1)}))}var expired_modal={premiumPromoModal:document.getElementById("premium-promo-modal"),expiredCovidModalContent:document.getElementById("premium-covid-expired-modal"),isExpiredPromoUser:!1,startPremiumUrl:"",noThanksBtnUrl:"",segment:"",promoUser:"",init:function(){this.premiumPromoModal&&(this.promoModal=new MG_Modal({content:this.premiumPromoModal,className:"premiumPromoModalContainer",closeDocument:!1})),this.expiredCovidModalContent&&(this.expiredCovidModal=new MG_Modal({content:this.expiredCovidModalContent,className:"expiredCovidModalContainer",closeDocument:!1}))},showExpiredPromoModal:function(){var e=this,o="gay"===this.segment?"promoModalWrapperGay":"promoModalWrapperStraight",t=this.isExpiredPromoUser?"promoModalWrapperExpired":"";signinbox.signInUtilModal.closeModal(),setTimeout(function(){e.promoModal.openModal(),$j(".premiumPromoModalContainer .promoModalWrapper").addClass(o),$j(".premiumPromoModalContainer .promoModalWrapper").addClass(t),e.attachHandlers()},0)},showExpiredCovidModal:function(){var e;void 0!==this.expiredCovidModal&&(e=this,signinbox.signInUtilModal.closeModal(),setTimeout(function(){e.expiredCovidModal.openModal(),$j(".expiredCovidModalContainer .freeWeek").on("click",function(){document.location.assign(e.startPremiumUrl)}),$j(".expiredCovidModalContainer .closeMTubes, .expiredCovidModalContainer #promoCancelFreeWeek").on("click",function(){document.location.assign(e.noThanksBtnUrl)})},0))},attachHandlers:function(){var e=this;$j(".premiumPromoModalContainer .freePromoWeek").on("click",function(){document.location.assign(e.startPremiumUrl)}),$j(".premiumPromoModalContainer #promoCancelFreeWeek, .premiumPromoModalContainer .closeMTubes").on("click",function(){document.location.assign(e.noThanksBtnUrl)})}};function initializeCaptcha(e){try{grecaptcha.render(e,{sitekey:gRecaptchaPublicKey,theme:"dark",callback:function(e){toggleButtonDisable(!(recaptchaComplete=!0))},"expired-callback":function(){toggleButtonDisable(!0)}})}catch(e){}}function toggleButtonDisable(e){var o=currentModalScope.querySelector(".js-signinUsernameModal"),t=currentModalScope.querySelector(".js-signinPasswordModal"),n=currentModalScope.querySelector(".js-loginSubmitModal");e?(MG_Utils.removeEventHandler(n,"click",loginClickFunction),MG_Utils.removeEventHandler(o,"keydown",keyDownFunction),MG_Utils.removeEventHandler(t,"keydown",keyDownFunction),MG_Utils.addClass(n,"disabled")):(MG_Utils.addEventHandler(n,"click",loginClickFunction),MG_Utils.addEventHandler(o,"keydown",keyDownFunction),MG_Utils.addEventHandler(t,"keydown",keyDownFunction),MG_Utils.removeClass(n,"disabled"))}function loginAjaxModal(e,o,t){var p,n=recaptchaComplete?updateDataWithCaptcha(t):t;toggleButtonDisable(!0),XMLHttpRequest&&((p=new XMLHttpRequest).open(o,e,!0),p.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),p.onreadystatechange=function(){var e,o,t,n,i,a,r,l,s,d,c,u,m;4===p.readyState&&(200<=p.status&&p.status<400?(e=JSON.parse(p.responseText)).twoStepVerification?(o=document.querySelectorAll(".js-loginFormModal")[1],t=document.querySelectorAll(".js-userVerificationModal")[1],o&&MG_Utils.addClass(o,"hidden"),t&&(MG_Utils.removeClass(t,"hidden"),n=t.querySelector("#userPhoneNumber"),i=t.querySelector("#enterVerificationCode"),a=t.querySelector("#btnVerifyCode"),r=t.querySelector("#verificationEnabledUsername"),l=t.querySelector("#verificationEnabledToken"),s=t.querySelector("#resendVerificationCode"),d=t.querySelector("#authyIdHashed"),c=t.querySelector("#authyId"),n&&(n.innerHTML=e.phoneNumber),r&&l&&(r.value=e.username,l.value=e.autoLoginParameter),c&&d&&(c.value=e.authyId,d.value=e.authyIdHashed),i&&a&&(MG_Utils.addEventHandler(i,"keyup",function(e){""!==i.value?MG_Utils.hasClass(a,"disabled")&&MG_Utils.removeClass(a,"disabled"):MG_Utils.hasClass(a,"disabled")||MG_Utils.addClass(a,"disabled")}),MG_Utils.addEventHandler(document.querySelector("#modalWrapMTubes #btnVerifyCode"),"click",function(e){e.preventDefault(),MG_Utils.hasClass(document.querySelector("#modalWrapMTubes #btnVerifyCode"),"disabled")||loginTwoStepVerificationEnabled()}),MG_Utils.addEventHandler(i,"keydown",function(e){var o=e.which||e.keyCode;13===o&&(e.preventDefault(),MG_Utils.hasClass(a,"disabled")||loginTwoStepVerificationEnabled()),69===o&&e.preventDefault()})),s&&MG_Utils.addEventHandler(s,"click",function(e){e.preventDefault();var o,t=c.value,n=d.value,i=document.querySelector("#modalWrapMTubes #xsrfToken"),a=document.querySelector("#modalWrapMTubes .resendCodeResponse");i&&(o=i.value,$j.ajax({type:"POST",url:TOP_BODY.urlResendCode,dataType:"json",data:{authyId:t,authyIdHashed:n,token:o},success:function(e){a&&(MG_Utils.removeClass(a,"hidden"),"success"!=e.status?(MG_Utils.addClass(a,"verificationError"),$j(a).find(".resendCodeStatus").text(e.status+":"),$j(a).find(".resendCodeMessage").text(e.message+" "+PAGE_LAYER.tryAgainMessage)):(MG_Utils.hasClass(a,"verificationError")&&MG_Utils.removeClass(a,"verificationError"),MG_Utils.addClass(a,"verificationSuccess"),$j(a).find(".resendCodeStatus").text(e.status+":"),$j(a).find(".resendCodeMessage").text(e.message),setTimeout(function(){MG_Utils.addClass(a,"hidden")},3e3)))},error:function(){alert(TOP_BODY.ajaxError),document.location.reload()}}))}))):e.requireCaptcha&&"undefined"!=typeof gRecaptchaPublicKey?(showCaptcha=!0,u=currentModalScope.querySelector(".g-recaptcha"),(m=currentModalScope.querySelector(".signinError")).style.display="block",m.innerHTML=e.message,u&&(recaptchaComplete?grecaptcha.reset():initializeCaptcha(u))):callbackSuccess(e):(toggleButtonDisable(!1),callbackFailed()))},p.send(n))}function loginTwoStepVerificationEnabled(){$j.ajax({type:"POST",url:TOP_BODY.twoStepVerificationLogin,data:$j("#modalWrapMTubes .js-userVerificationModal").serialize(),success:function(e){var o=document.querySelector("#modalWrapMTubes .twoStepVerificationMessage");o&&MG_Utils.removeClass(o,"hidden"),"0"!=e.success?(o&&MG_Utils.hasClass(o,"verificationError")&&MG_Utils.removeClass(o,"verificationError"),MG_Utils.addClass(o,"verificationSuccess"),o.innerHTML=TOP_BODY.verificationSuccessfulMessage+"...",callbackSuccess(e)):""!=e.message&&o?(MG_Utils.addClass(o,"verificationError"),o.innerHTML=e.message):""==e.message&&(alert(TOP_BODY.ajaxError),document.location.reload())},error:function(){alert(TOP_BODY.ajaxError),document.location.reload()}})}function callbackSuccess(o){var t=currentModalScope.querySelector("#signinLoggingin"),n=currentModalScope.querySelector(".signinError");if("0"==o.premium_redirect_cookie){if(o.showExpiredFreeTrial||o.showExpiredModal||o.showExpiredCovidModal)return expired_modal.startPremiumUrl=o.takeFreePremiumUrl,expired_modal.noThanksBtnUrl=o.redirectToPH,expired_modal.segment=o.segment,expired_modal.isExpiredPromoUser=o.showExpiredModal,o.showExpiredCovidModal?expired_modal.showExpiredCovidModal():expired_modal.showExpiredPromoModal(),void toggleButtonDisable(!1);o.redirect?(t.style.display="block",n.style.display="none",void 0!==o.subscribe&&1==o.subscribe?(document.querySelector(".subscribeButton button.login").setAttribute("data-login","0"),subscribeAjax(e,document.querySelector(".subscribeButton button.login"),"",!0,o.redirect)):document.location.assign(o.redirect)):(n.style.display="block",n.innerHTML=o.message,toggleButtonDisable(!1))}else{var i=new Date,a=premiumRedirectCookieURL+(0<premiumRedirectCookieURL.indexOf("?")?"&":"?")+"timestamp="+i.getTime(),r=new XMLHttpRequest;r.withCredentials=!0,r.open("GET",a,!0),r.onreadystatechange=function(){4===this.readyState&&200<=this.status&&this.status<400&&(o.redirect?(t.style.display="",n.style.display="none",document.location.assign(o.redirect)):(n.style.display="",n.innerHTML=o.message,toggleButtonDisable(!1)))},r.send(),r=null}}function callbackFailed(){location.reload}function collectLoginData(e){for(var o={},t=0;t<e.length;t++){var n=e.item(t);o[n.name]=encodeURIComponent(n.value)}return"redirect="+o.redirect+"&token="+o.token+"&remember_me="+o.remember_me+"&from="+o.from+"&username="+o.username+"&password="+o.password+"&subscribe="+o.subscribe+"&setSendTip="+(!!localStorage.getItem("tipsClicked")&&localStorage.getItem("tipsClicked"))}function updateDataWithCaptcha(e){var o=currentModalScope.querySelector(".g-recaptcha-response");return o&&o.value?e+"&g-recaptcha-response="+o.value:e}var keyPressed=!1,currentModalScope=null,showCaptcha=!1,loginClickFunction=function(e){var o=currentModalScope.querySelector(".js-loginFormModal").elements;e.preventDefault?e.preventDefault():e.returnValue=!1,loginAjaxModal("/front/authenticate","POST",collectLoginData(o))},keyDownFunction=function(e){var o=e.which||e.keyCode,t=currentModalScope.querySelector(".js-loginFormModal").elements;keyPressed?keyPressed&&13!=o&&(keyPressed=!1):13==o&&(loginAjaxModal("/front/authenticate","POST",collectLoginData(t)),keyPressed=!0)};function passEvents(e){var o=e.querySelectorAll(".signup_field"),t=e.querySelector('[type="checkbox"]'),n=e.querySelector('[name="remember_me"]'),a=e.querySelector(".js-signinUsernameModal"),r=e.querySelector(".js-signinPasswordModal"),l=e.querySelector(".js-loginSubmitModal");for(currentModalScope=e,i=0;i<o.length;i++)MG_Utils.addEventHandler(o[i],"focus",function(){signinbox.inputFocused=!0}),MG_Utils.addEventHandler(o[i],"blur",function(){signinbox.inputFocused=!1});MG_Utils.addEventHandler(t,"click",function(){n.value=t.checked?1:0}),MG_Utils.addEventHandler(l,"click",loginClickFunction),MG_Utils.addEventHandler(a,"keydown",keyDownFunction),MG_Utils.addEventHandler(r,"keydown",keyDownFunction)}MG_Utils.domReady(function(){document.location.search.match(/showSigninBox=true/i)&&null!=document.getElementById("headerLoginLink")&&signinbox.show(),expired_modal.init()});