PluginProbe
Passster – Password Protect Pages and Content / 4.3.17
Passster – Password Protect Pages and Content v4.3.17
4.3.17 4.3.16 4.3.15 4.3.14 4.3.12 4.3.13 4.3.11 4.3.10 4.3.9 4.3.8 4.3.7 4.3.6 4.3.5 trunk 3.5.4 3.5.5.2 3.5.5.8 3.5.5.9 4.0 4.1.4 4.2.10 4.2.11 4.2.12 4.2.13 4.2.14 All 49 releases
content-protector / assets / public / passster-public.min.js

passster-public.min.js in Passster – Password Protect Pages and Content 4.3.17, at assets/public/passster-public.min.js

1 lines 5.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery(document).ready(function(t){const a=ps_ajax.rest_url+"passster/v1";function e(){switch(ps_ajax.cookie_duration_unit){case"days":default:return parseInt(ps_ajax.cookie_duration);case"hours":return new Date((new Date).getTime()+60*ps_ajax.cookie_duration*60*1e3);case"minutes":return new Date((new Date).getTime()+60*ps_ajax.cookie_duration*1e3)}}function s(){const t="pts="+Math.floor(Date.now()/1e3);return location.origin+location.pathname+(location.search?location.search+"&"+t:"?"+t)+(location.hash||"")}function r(){const t=Cookies.get("passster");return t?t.split("|").filter(t=>t.length>0):[]}function n(a,e,r){if(a.redirect)window.location.replace(a.redirect);else if(ps_ajax.unlock_mode){if(e.find(".passster-error").hide(),a.requires_reload)return void(window.location.href=s());if(a.content){let s=a.content;ps_ajax.shortcodes&&t.each(ps_ajax.shortcodes,function(t,a){s=s.replace(t,a)}),e.replaceWith(s)}r&&window.location.replace(r)}else window.location.href=s()}function i(t,a){const e=t.find(".passster-error");e.text(a||"An error occurred."),e.show().fadeOut(3500)}async function o(t,e,s,r,o,c,p){try{const r=await fetch(a+"/captcha",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,type:e,post_id:ps_ajax.post_id,area_id:o,redirect:c,protection:p||""})}),d=await r.json();d.success?n(d,s,c):i(s,d.error)}catch(t){i(s,"Captcha validation failed.")}}ps_ajax.link_pass&&(ps_ajax.disable_cookie||(ps_ajax.link_pass.length<25?async function(t,s){const n=await async function(t,e){try{const s=await fetch(a+"/hash",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:t,post_id:e})});return(await s.json()).hash||""}catch(t){return""}}(t,s);if(n){const t=r();t.includes(n)||t.push(n),Cookies.set("passster",t.join("|"),{expires:e(),sameSite:"strict"})}}(atob(ps_ajax.link_pass),ps_ajax.post_id).then(()=>{window.location.replace(ps_ajax.permalink+"?pts="+Math.floor(Date.now()/1e3))}):(!function(t){const a=r();a.includes(t)||a.push(t),Cookies.set("passster",a.join("|"),{expires:e(),sameSite:"strict"})}(ps_ajax.link_pass),window.location.replace(ps_ajax.permalink+"?pts="+Math.floor(Date.now()/1e3))))),t(".passster-submit").on("click",async function(e){e.preventDefault();const s=t(this),r=s.attr("data-psid"),o=t("#"+r),c=o.find(".passster-password"),p=parseInt(s.attr("data-post-id"))||ps_ajax.post_id,d=o.find("form")[0];if(d&&!d.checkValidity())return void d.reportValidity();const l=c.val(),h=(c.attr("data-protection-type")||"password").replace(/-/g,"_"),u=parseInt(c.attr("data-area"))||0,f=parseInt(c.attr("data-list"))||0,_=c.attr("data-lists")||"",w=c.attr("data-protection")||"",y=s.attr("data-acf")||"",m=s.attr("data-redirect")||"",j=parseInt(s.attr("data-term-id"))||0,k=s.attr("data-post-type")||"",g=o.closest(".passster-protected-content"),x=g.length?g.attr("data-block-id"):"";o.find(".ps-loader").css("display","block");try{const t=await fetch(a+"/unlock",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:l,type:h,post_id:p,area_id:u,block_id:x,list_id:f,lists:_,protection:w,acf:y,redirect:m,term_id:j,post_type:k})}),e=await t.json();o.find(".ps-loader").css("display","none"),e.success?n(e,o,m):(i(o,e.error),c.val(""))}catch(t){o.find(".ps-loader").css("display","none"),i(o,"An error occurred. Please try again.")}}),t(".recaptcha-form-v2").length>0&&window.grecaptcha&&grecaptcha.ready(function(){grecaptcha.render("ps-recaptcha-v2",{sitekey:ps_ajax.recaptcha_key,callback(a){const e=t(".recaptcha-v2-submit").attr("data-psid"),s=t("#"+e),r=s.find(".recaptcha-v2-submit");o(a,"recaptcha_v2",s,0,parseInt(r.attr("data-area"))||0,r.attr("data-redirect")||"",r.attr("data-protection")||"")}})}),t(".recaptcha-form").on("submit",function(a){a.preventDefault();const e=t(this).find(".passster-submit-recaptcha"),s=e.attr("data-psid"),r=t("#"+s),n=parseInt(e.attr("data-area"))||0,i=e.attr("data-redirect")||"",c=e.attr("data-protection")||"";window.grecaptcha&&grecaptcha.ready(function(){grecaptcha.execute(ps_ajax.recaptcha_key,{action:"validate_input"}).then(function(t){o(t,"recaptcha_v3",r,0,n,i,c)})})}),t(".hcaptcha-form").on("submit",function(a){a.preventDefault();const e=t(this).find(".passster-submit-recaptcha"),s=e.attr("data-psid"),r=t("#"+s),n=parseInt(e.attr("data-area"))||0,c=e.attr("data-redirect")||"",p=e.attr("data-protection")||"";window.hcaptcha&&hcaptcha.execute({async:!0}).then(({response:t})=>{o(t,"hcaptcha",r,0,n,c,p)}).catch(t=>{i(r,t.message||"hCaptcha error")})});let c="";t(".turnstile-form").length>0&&window.turnstile&&(window.turnstile.ready(function(){window.turnstile.render(".passster-turnstile",{sitekey:ps_ajax.turnstile_key,callback(t){c=t}})}),t(".turnstile-form").on("submit",function(a){a.preventDefault();const e=t(this).find(".passster-submit-turnstile"),s=e.attr("data-psid"),r=t("#"+s),n=parseInt(e.attr("data-area"))||0,p=e.attr("data-redirect")||"",d=e.attr("data-protection")||"";c?o(c,"turnstile",r,0,n,p,d):i(r,"Please complete the verification.")})),t(document).on("click","#ps-logout",async function(){try{const t=await fetch(a+"/logout",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"}});(await t.json()).success&&(Cookies.set("passster","",{expires:0,sameSite:"strict"}),window.location.href=s())}catch(t){window.location.href=s()}})});