PageSourceSearch

https://serbiantimes.info/wp-content/plugins/newspack-plugin/dist/reader-auth.js?ver=5.3.0-epic-ras-acc.2

js serbiantimes.info collected 2026-10-02 10:12:59 UTC 15,501 bytes, 1 lines download raw bytes

1(()=>{"use strict";var e,t={9722:(e,t,n)=>{var a=n(9430);const o=["signin_modal","register_modal"];function i(){return document.querySelector(".newspack-reader-auth-modal .newspack-reader-auth")}function r(e={}){const t=window.newspackReaderActivation.getReader(),n=e.trigger;if(t?.authenticated)return void(e.callback&&e.callback());const r=i();if(!r)return void(e.callback&&e.callback());const c=r.closest(".newspack-reader-auth-modal");if(!c)return void(e.callback&&e.callback());const s=()=>{r.config={},c.setAttribute("data-state","closed"),document.body.classList.remove("newspack-signin"),document.body.style.overflow="auto",c.overlayId&&window.newspackReaderActivation?.overlays&&window.newspackReaderActivation.overlays.remove(c.overlayId);const e=r.querySelector(".opener-content");e&&e.remove(),n&&n.focus()},l=c.querySelectorAll("button[data-close], .newspack-ui__modal__close");if(l?.length&&l.forEach((e=>{e.addEventListener("click",(function(e){e.preventDefault(),s()}))})),document.addEventListener("keydown",(function(e){"Escape"===e.key&&s()})),e.labels={...newspack_reader_activation_labels,...e?.labels},r.config=e,r.authCallback=(t,n)=>{s(),e.callback&&e.callback(t,n)},r.formActionCallback=t=>{c.querySelector("h2").textContent="register"===t?e.labels.register.title:e.labels.signin.title,c.querySelectorAll("[data-action]").forEach((e=>{"none"!==e.style.display&&(e.prevDisplay=e.style.display),e.style.display="none"})),c.querySelectorAll('[data-action~="'+t+'"]').forEach((e=>{e.style.display=e.prevDisplay})),a.o(c)},e.content){const t=document.createElement("div");t.classList.add("opener-content"),t.innerHTML=e.content;const n=r.querySelector("form");n.insertBefore(t,n.firstChild)}const d=r.querySelector('input[name="npe"]');d&&(d.value=t?.email||"");let u="signin";window.newspackReaderActivation?.hasAuthLink()&&(u="otp");const p=window.location.hash.replace("#","");o.includes(p)&&(u="register_modal"===p?"register":"signin"),e.initialState&&(u=e.initialState),r.setFormAction(u,!0),"otp"===u&&window?.newspackReaderActivation?.getOTPTimeRemaining()<=0&&r.setFormAction("signin"),document.body.classList.add("newspack-signin"),document.body.style.overflow="hidden",c.setAttribute("data-state","open"),window.newspackReaderActivation?.overlays&&(c.overlayId=window.newspackReaderActivation.overlays.add(),a.o(c)),o.includes(window.location.hash.replace("#",""))&&history.pushState("",document.title,window.location.pathname+window.location.search)}function c(e){"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",e):e())}var s=n(2864);c((function(){[...document.querySelectorAll(".newspack-reader__logins")].forEach((e=>{e.classList.remove("newspack-reader__logins--disabled")})),document.querySelectorAll(".newspack-ui__button--google-oauth").forEach((e=>{const t=e.closest("form");e.addEventListener("click",(()=>{t?.startLoginFlow&&t.startLoginFlow();const e=t?function(e,t=[]){return Array.from(e.entries()).reduce(((e,[n,a])=>t.includes(n)?(n.indexOf("[]")>-1?(e[n=n.replace("[]","")]=e[n]||[],e[n].push(a)):e[n]=a,e):e),{})}(new FormData(t),["lists[]"]):{};e.current_page_url=window.location.href;const n=window.open("about:blank","newspack_google_login","width=500,height=600");let a=!1;window.addEventListener("google-oauth-success",(()=>{a=!0,(e=>{fetch(`/wp-json/newspack/v1/login/google/register?metadata=${JSON.stringify(e)}`).then((e=>{e.json().then((({message:n,data:a})=>{t?.endLoginFlow&&t.endLoginFlow(n,e.status,a)})).catch((n=>{t?.endLoginFlow&&t.endLoginFlow(n?.message,e.status)}))})).catch((e=>{t?.endLoginFlow&&t.endLoginFlow(e?.message)}))})(e)})),fetch("/wp-json/newspack/v1/login/google").then((e=>e.json().then((t=>Promise.resolve({data:t,status:e.status}))))).then((({data:e,status:o})=>{if(200!==o)n&&n.close(),t?.endLoginFlow&&t.endLoginFlow(e.message,o);else if(n){n.location=e;const o=setInterval((()=>{!a&&n.closed&&(t?.endLoginFlow&&t.endLoginFlow(newspack_reader_activation_labels.login_canceled,401),clearInterval(o))}),500)}else t?.endLoginFlow&&t.endLoginFlow(newspack_reader_activation_labels.blocked_popup)})).catch((e=>{t?.endLoginFlow&&t.endLoginFlow(e?.message,400),n&&n.close()}))}))}))})),c((function(){document.querySelectorAll('input[name="otp_code"]').forEach((e=>{const t=parseInt(e.getAttribute("maxlength"));if(!t)return;const n=e.parentNode;n.removeChild(e);const a=[],o=document.createElement("input");o.setAttribute("type","hidden"),o.setAttribute("name","otp_code"),n.appendChild(o);for(let e=0;e<t;e++){const i=document.createElement("input");i.setAttribute("type","text"),i.setAttribute("maxlength","1"),i.setAttribute("pattern","[0-9]"),i.setAttribute("autocomplete","off"),i.setAttribute("inputmode","numeric"),i.setAttribute("data-index",e),i.addEventListener("keydown",(t=>{const i=n.querySelector(`[data-index="${e-1}"]`),r=n.querySelector(`[data-index="${e+1}"]`);
1switch(t.key){case"Backspace":t.preventDefault(),t.target.value="",i&&i.focus(),a[e]="",o.value=a.join("");break;case"ArrowLeft":t.preventDefault(),i&&i.focus();break;case"ArrowRight":t.preventDefault(),r&&r.focus();break;default:t.key.match(/^[0-9]$/)&&(t.preventDefault(),t.target.value=t.key,t.target.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),r&&r.focus())}})),i.addEventListener("input",(t=>{t.target.value.match(/^[0-9]$/)?a[e]=t.target.value:t.target.value="",o.value=a.join("")})),i.addEventListener("paste",(e=>{e.preventDefault();const i=(e.clipboardData||window.clipboardData).getData("text");if(i.length===t){for(let e=0;e<t;e++)i[e].match(/^[0-9]$/)&&(n.querySelector(`[data-index="${e}"]`).value=i[e],a[e]=i[e]);o.value=a.join("")}})),n.appendChild(i)}}))}));const l=["register","signin","pwd","otp","success"];window.newspackRAS=window.newspackRAS||[],window.newspackRAS.push((function(e){c((function(){const t=[...document.querySelectorAll(".newspack-reader-auth")];t?.length&&t.forEach((t=>{const n=t.querySelector("form");if(!n)return;const a=n.querySelector('input[name="action"]'),o=n.querySelector('input[name="npe"]'),i=n.querySelector('input[name="otp_code"]'),r=n.querySelector('input[name="password"]'),c=n.querySelectorAll('[type="submit"]'),d=t.querySelectorAll("[data-back]"),u=t.querySelector("[data-send-code]"),p=t.querySelector("[data-resend-code]"),g=t.querySelector(".response"),w=e=>{e.addEventListener("click",(function(e){e.preventDefault(),t.setFormAction(e.target.getAttribute("data-set-action"),!0)}))};let f;t.setFormAction=(n,c=!1)=>{if(l.includes(n)||(n="signin"),"otp"===n){if(!e.getOTPHash())return;t.querySelectorAll(".email-address").forEach((t=>{t.textContent=e.getReader()?.email||""}));const n=t.querySelector('.otp-field input[type="text"]');n&&n.focus()}f=n,a.value=n,t.removeAttribute("data-form-status"),t.querySelectorAll("[data-action]").forEach((e=>{"none"!==e.style.display&&(e.prevDisplay=e.style.display),e.style.display="none"})),t.querySelectorAll('[data-action~="'+n+'"]').forEach((e=>{e.style.display=e.prevDisplay})),c&&("pwd"===n&&o.value?r.focus():"otp"===n?i.focus():o.focus()),t.formActionCallback&&t.formActionCallback(n)},t.setFormAction("signin");const h=()=>{const t=e.getReader();o&&(o.value=t?.email||""),setTimeout((function(){t?.authenticated&&"success"!==f&&n.endLoginFlow(null,200)}),1e3)};e.on("reader",h),h(),d.forEach((e=>{e.addEventListener("click",(function(e){e.preventDefault(),n.setMessageContent(),t.setFormAction("signin",!0)}))}));const m=()=>{if(!p)return;p.originalButtonText=p.textContent.replace(/\s\(\d{1,}:\d{2}\)/,"");const t=()=>{const t=e.getOTPTimeRemaining();t?p.textContent=`${p.originalButtonText} (${function(e){const t=e%60;return`${Math.floor(e/60)}:${t<10?"0":""}${t}`}(t)})`:(p.textContent=p.originalButtonText,clearInterval(p.otpTimerInterval)),p.disabled=!!t};e.getOTPTimeRemaining()&&(p.otpTimerInterval=setInterval(t,1e3),t())};(u||p)&&[u,p].forEach((a=>{a.addEventListener("click",(function(a){n.setMessageContent(),a.preventDefault(),n.startLoginFlow();const i=new FormData;i.set("reader-activation-auth-form",1),i.set("npe",o.value),i.set("action","link"),e.getCaptchaV3Token().then((e=>{e&&i.set("captcha_token",e)})).catch((e=>{console.log({e})})).finally((()=>{fetch(n.getAttribute("action")||window.location.pathname,{method:"POST",headers:{Accept:"application/json"},body:i}).then((()=>{n.setMessageContent("pwd"===f?newspack_reader_activation_labels.code_sent:newspack_reader_activation_labels.code_resent),t.setFormAction("otp"),e.getOTPTimeRemaining()||e.setOTPTimer()})).catch((e=>{console.log(e)})).finally((()=>{m(),n.style.opacity=1,c.forEach((e=>{e.disabled=!1}))}))}))}))})),t.querySelectorAll("[data-set-action]").forEach(w),n.startLoginFlow=()=>{t.removeAttribute("data-form-status"),c.forEach((e=>{e.disabled=!0})),n.setMessageContent(),n.style.opacity=.5},n.endLoginFlow=(a=null,o=500,i=null)=>{if(t.setAttribute("data-form-status",o),n.style.opacity=1,c.forEach((e=>{e.disabled=!1})),a&&(document.createElement("p").innerHTML=a,200!==o&&(n.setMessageContent(a,!0),g.querySelectorAll("[data-set-action]").forEach(w))),200===o){let n;if(i&&(e.setReaderEmail(i.email),e.setAuthenticated(!!i.authenticated)),n=t.authCallback&&i?.registered&&!e.getCheckoutStatus()?(e,n)=>(0,s.a)({callback:t.authCallback(e,n)}):t.authCallback,t.config?.skipSuccess)n&&n(a,i);else{let e=newspack_reader_activation_labels.signin;i?.registered&&(e=newspack_reader_activation_labels.register),t.setFormAction("success"),t.querySelector(".success-title").innerHTML=e.success_title||"",t.querySelector(".success-description").innerHTML=e.success_description||"";const o=t.querySelector(".auth-callback");o&&o.addEventListener("click",(e=>{e.preventDefault(),n&&n(a,i)}));const r=t.querySelector(".set-password");if(r){const e=r.style.display;
1if(i?.password_url)r.style.display=e,r.setAttribute("href",i.password_url);else{r.style.display="none",r.setAttribute("href","#");const e=t.querySelector(".auth-callback");e&&e.classList.add("newspack-ui__last-child")}}}}},n.setMessageContent=(e="",t=!1)=>{e?("string"==typeof e?g.innerHTML=e:g.appendChild(e),t?(g.classList.remove("newspack-ui__helper-text"),g.classList.add("newspack-ui__inline-error")):(g.classList.remove("newspack-ui__inline-error"),g.classList.add("newspack-ui__helper-text")),g.style.display="block",g.querySelectorAll('a[data-set-action="register"], a[data-set-action="signin"]').forEach((e=>{e.parentNode.setAttribute("data-action","signin"),e.addEventListener("click",(function(){g.innerHTML=""}),!1)}))):(g.style.display="none",g.innerHTML="",g.classList.remove("newspack-ui__inline-error","newspack-ui__helper-text"))},n.addEventListener("submit",(a=>{a.preventDefault(),n.startLoginFlow();const o=n.action?.value;return n.npe?.value?"pwd"!==o||n.password?.value?void e.getCaptchaV3Token().then((e=>{if(!e)return;let t=n.captcha_token;t||(t=document.createElement("input"),t.setAttribute("type","hidden"),t.setAttribute("name","captcha_token"),t.setAttribute("autocomplete","off"),n.appendChild(t)),t.value=e})).catch((e=>{n.endLoginFlow(e,400)})).finally((()=>{const i=new FormData(a.target);if(!i.has("npe")||!i.get("npe"))return n.endLoginFlow(newspack_reader_activation_labels.invalid_email,400);"otp"===o?e.authenticateOTP(i.get("otp_code")).then((e=>{n.endLoginFlow(e.message,200,e)})).catch((e=>{e.expired&&t.setFormAction("signin"),n.endLoginFlow(e.message,400)})):fetch(n.getAttribute("action")||window.location.pathname,{method:"POST",headers:{Accept:"application/json"},body:i}).then((a=>{t.setAttribute("data-form-status",a.status),a.json().then((({message:o,data:r})=>{const c=a.status,s=e.getReader?.()?.email;200===c&&e.setReaderEmail(i.get("npe")),r.action?(t.setFormAction(r.action,!0),"otp"===r.action&&(n.setMessageContent(newspack_reader_activation_labels.code_sent),r.email===s&&e.getOTPTimeRemaining()||e.setOTPTimer(),m())):n.endLoginFlow(o,c,r)})).catch((()=>{n.endLoginFlow()})).finally((()=>{n.style.opacity=1,c.forEach((e=>{e.disabled=!1}))}))})).catch((()=>{n.endLoginFlow()}))})):n.endLoginFlow(newspack_reader_activation_labels.invalid_password,400):n.endLoginFlow(newspack_reader_activation_labels.invalid_email,400)}))}))}))})),window.newspackRAS=window.newspackRAS||[],window.newspackRAS.push((e=>{c((function(){function t(e){const t=i();if(!t)return;const n=window.location.hash.replace("#","");o.includes(n)&&(e&&e.preventDefault(),t.setFormAction("register_modal"===n?"register":"signin"),r())}function n(e){e.preventDefault();const t=e.target;let n,a;if(a=e.target.getAttribute("data-redirect")?e.target.getAttribute("data-redirect"):e.target.getAttribute("href"),!a){const t=e.target.closest("a");t&&(a=t.getAttribute("data-redirect")?t.getAttribute("data-redirect"):t.getAttribute("href"))}a&&"#"!==a&&(n=()=>{window.location.href=a}),r({callback:n,trigger:t})}function a(){document.querySelectorAll(`[data-newspack-reader-account-link],[href="${newspack_ras_config.account_url}"]`).forEach((e=>{e.addEventListener("click",n)}))}function c(){const e=window.newspackReaderActivation.getReader(),t=document.querySelectorAll(".newspack-reader__account-link");t?.length&&t.forEach((t=>{const n=JSON.parse(t.getAttribute("data-labels")),a=t.querySelector(".newspack-reader__account-link__label");a&&(a.textContent=e?.authenticated?n.signedin:n.signedout,e?.authenticated&&t.setAttribute("href",newspack_ras_config.account_url))}))}e._openAuthModal=r,window.addEventListener("hashchange",t),t(),a(),setTimeout(a,1e3),window.newspackReaderActivation.on("reader",c),c()}))}))}},n={};function a(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={id:e,loaded:!1,exports:{}};return t[e].call(i.exports,i,i.exports,a),i.loaded=!0,i.exports}a.m=t,e=[],a.O=(t,n,o,i)=>{if(!n){var r=1/0;for(d=0;d<e.length;d++){for(var[n,o,i]=e[d],c=!0,s=0;s<n.length;s++)(!1&i||r>=i)&&Object.keys(a.O).every((e=>a.O[e](n[s])))?n.splice(s--,1):(c=!1,i<r&&(r=i));if(c){e.splice(d--,1);var l=o();void 0!==l&&(t=l)}}return t}i=i||0;for(var d=e.length;d>0&&e[d-1][2]>i;d--)e[d]=e[d-1];e[d]=[n,o,i]},a.n=e=>
vendor: 1,435 bytes, line 1
1{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),a.j=193,(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var o=n.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=n[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{var e={193:0};a.O.j=t=>0===e[t];var t=(t,n)=>{var o,i,[r,c,s]=n,l=0;if(r.some((t=>0!==e[t]))){for(o in c)a.o(c,o)&&(a.m[o]=c[o]);if(s)var d=s(a)}for(t&&t(n);l<r.length;l++)i=r[l],a.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return a.O(d)},n=globalThis.webpackChunknewspack=globalThis.webpackChunknewspack||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var o=a.O(void 0,[223],(()=>a(9722)));o=a.O(o)})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.