PageSourceSearch

https://longreads.com/wp-content/plugins/newspack-blocks/dist/tiersBased.js?ver=4.33.1

js longreads.com collected 2026-09-24 08:28:29 UTC 7,060 bytes, 1 lines download raw bytes

1(()=>{var t={7759(t,e,r){var n=r(907).Symbol;t.exports=n},1490(t,e,r){var n=r(7759),o=r(4817),i=r(7748),a=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?o(t):i(t)}},6(t,e,r){var n=r(5082),o=/^\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(o,""):t}},6710(t){var e="object"==typeof globalThis&&globalThis&&globalThis.Object===Object&&globalThis;t.exports=e},4817(t,e,r){var n=r(7759),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,u=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,u),r=t[u];try{t[u]=void 0;var n=!0}catch(t){}var o=a.call(t);return n&&(e?t[u]=r:delete t[u]),o}},7748(t){var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},907(t,e,r){var n=r(6710),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},5082(t){var e=/\s/;t.exports=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}},671(t,e,r){var n=r(9323),o=r(5062),i=r(9480),a=Math.max,u=Math.min;t.exports=function(t,e,r){var s,c,l,d,b,f,p=0,y=!1,v=!1,_=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){var r=s,n=c;return s=c=void 0,p=e,d=t.apply(n,r)}function h(t){var r=t-f;return void 0===f||r>=e||r<0||v&&t-p>=l}function w(){var t=o();if(h(t))return g(t);b=setTimeout(w,function(t){var r=e-(t-f);return v?u(r,l-(t-p)):r}(t))}function g(t){return b=void 0,_&&s?m(t):(s=c=void 0,d)}function x(){var t=o(),r=h(t);if(s=arguments,c=this,f=t,r){if(void 0===b)return function(t){return p=t,b=setTimeout(w,e),y?m(t):d}(f);if(v)return clearTimeout(b),b=setTimeout(w,e),m(f)}return void 0===b&&(b=setTimeout(w,e)),d}return e=i(e)||0,n(r)&&(y=!!r.leading,l=(v="maxWait"in r)?a(i(r.maxWait)||0,e):l,_="trailing"in r?!!r.trailing:_),x.cancel=function(){void 0!==b&&clearTimeout(b),p=0,s=f=c=b=void 0},x.flush=function(){return void 0===b?d:g(o())},x}},9323(t){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},2292(t){t.exports=function(t){return null!=t&&"object"==typeof t}},7964(t,e,r){var n=r(1490),o=r(2292);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},5062(t,e,r){var n=r(907);t.exports=function(){return n.Date.now()}},9480(t,e,r){var n=r(6),o=r(9323),i=r(7964),a=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,s=/^0o[0-7]+$/i,c=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var r=u.test(t);return r||s.test(t)?c(t.slice(2),r?2:8):a.test(t)?NaN:+t}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t=r(671),e=r.n(t);const n="wpbnbd__button--active",o=t=>`.wpbnbd__tiers__amount [data-frequency-slug="${t}"]`,i=t=>{const r=((t="")=>{try{const e=JSON.parse(t);return{params:{frequency:e[0],tierPrefix:e[1]},initialFrequency:e[2],tiersBasedOptions:e[3],amounts:e[4],renewsAt:{month:e[5],year:e[6]},buttonColor:e[7]}}catch(t){return!1}})(t.getAttribute("data-tiers-based-config")||"");if(!r)return;const i=t.querySelectorAll(".wpbnbd__tiers__selection button"),a=t.querySelectorAll(".wpbnbd__tiers__amount [data-frequency-slug]"),u=t.querySelector(`input[name="${r.params.frequency}"]`),s=t.querySelector("form[data-is-init-form]");if(!(i&&a&&u&&s))return;((t,r)=>{const n=t.querySelector(".wpbnbd__tiers__options"),o=t.querySelector(".wpbnbd__tiers__options__dots");if(!n||!o||!r)return;const i=()=>Array.from(n.children).map(t=>({el:t,width:t.clientWidth}));let a=i();const u=Math.round(a.length/2)-1,s=()=>a[u].width,c=()=>a.map((t,e)=>l*e);let l=s(),d=c();const b=u*l;window.addEventListener("resize",()=>{a=i(),l=s(),d=c(),n.scrollTo(b,0)});const f=Array.from(o.children),p=e()(()=>{const t=((t,e)=>{const r=t.reduce((t,r)=>Math.abs(r-e)<Math.abs(t)?r-e:t,1/0)+e;return t.indexOf(r)})(d,n.scrollLeft);f.forEach((e,n)=>{e.style.backgroundColor=n===t?r.buttonColor:""})},100);n.addEventListener("scroll",p),f.forEach((t,e)=>{t.addEventListener("click",()=>{n.scrollTo({left:e*l,behavior:"smooth"})})}),n.scrollTo(b,0)})(t,r);let c=r.initialFrequency;
1i.forEach(e=>{e.addEventListener("click",()=>{const s=e.getAttribute("data-frequency-slug");s&&(c=s,u.setAttribute("value",c),a.forEach(t=>t.style.display="none"),t.querySelectorAll(o(c)).forEach(t=>t.style.display="inline"),i.forEach(t=>{c===t.getAttribute("data-frequency-slug")?t.classList.add(n):t.classList.remove(n)}),t.querySelectorAll('button[type="submit"]').forEach(t=>{if(!c)return;t.setAttribute("name",`${r.params.tierPrefix}${c}`);const e=t.getAttribute("data-tier-index"),n=document.querySelector(`${o(c)}[data-tier-index="${e}"]`);if(!n)return;const i=n.getAttribute("data-amount");i&&t.setAttribute("value",i)}))})});const l=t.querySelector("button.wpbnbd__tiers__back-button"),d=t.querySelectorAll(".wpbnbd__tiers__tier button"),b=t.querySelectorAll(".wpbnbd__tiers__view");d.forEach(e=>{e.addEventListener("click",()=>{const n=parseInt(e.getAttribute("data-tier-index")||""),o=s.querySelector('input[name="donation_tier_index"]'),i=s.querySelector(`input[name="donation_value_${c}"]`);o&&o.remove(),i&&i.remove();const a=document.createElement("input"),u=document.createElement("input");a.setAttribute("type","hidden"),u.setAttribute("type","hidden"),a.setAttribute("name","donation_tier_index"),u.setAttribute("name",`donation_value_${c}`),a.setAttribute("value",n.toString()),u.setAttribute("value",r.amounts[c][n]),s.appendChild(a),s.appendChild(u);const l=t.querySelector(".wpbnbd__tiers__tier-tile h2"),d=t.querySelector(".wpbnbd__tiers__tier-tile span[data-amount]"),f=t.querySelector(".wpbnbd__tiers__tier-tile span[data-frequency]"),p=t.querySelector(".wpbnbd__tiers__tier-tile span[data-renews-date]");if(isNaN(n)||!l||!d||!f||!p)return;const y=r.tiersBasedOptions[n],v=t.querySelector(`[data-frequency-slug="${c}"]`)?.getAttribute("data-frequency-label");l.textContent=y.heading,f.textContent=v||"",d.textContent=r.amounts[c][n],p.textContent=r.renewsAt[c],b.forEach(t=>t.classList.toggle("wpbnbd__tiers__view--hidden"))})}),window.addEventListener(`newspackPaymentFlowComplete-${t.id}`,()=>{l&&(l.style.display="none")}),t.setAttribute("data-tiers-based-ready",""),t.dispatchEvent(new CustomEvent("newspack-tiers-based-ready",{bubbles:!0}))};var a;(Object.getOwnPropertyDescriptor(i,"name")||{}).writable||Object.defineProperty(i,"name",{value:"default",configurable:!0}),"undefined"!=typeof window&&(a=()=>((t=document)=>{t.querySelectorAll(".wpbnbd--tiers-based").forEach(i)})(),"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",a):a()))})()})();

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.