PageSourceSearch

https://www.minnpost.com/wp-content/plugins/newspack-popups/dist/view.js?ver=1789759412

js minnpost.com collected 2026-09-24 07:49:06 UTC 11,370 bytes, 1 lines download raw bytes

1(()=>{"use strict";const t=()=>"undefined"!=typeof newspack_popups_view?newspack_popups_view:{},e=(t,e,n={})=>!(!newspackPopupsData||!newspackPopupsData[e])&&{...newspackPopupsData[e],...n,action:t},n=(t,e="np_prompt_interaction")=>{"function"==typeof gtag&&t&&gtag("event",e,t)},r=t=>{const e=t.split("_");return parseInt(e[e.length-1])},s=t=>{const e=t.currentTarget.closest(".newspack-lightbox");e&&e.contains(t.currentTarget)&&(e.style.display="none"),e.overlayId&&window.newspackReaderActivation?.overlays&&window.newspackReaderActivation.overlays.remove(e.overlayId),t.preventDefault()},o=(t,e)=>{newspack_popups_view.debug&&(window.newspack_popups_debug=window.newspack_popups_debug||{},window.newspack_popups_debug[t]=e)};function i(t){return t?window.newspackPopupsCriteria.criteria[t]:window.newspackPopupsCriteria.criteria}window.newspackPopupsCriteria=window.newspackPopupsCriteria||{criteria:{}},window.newspackPopupsCriteria.criteria=window.newspackPopupsCriteria.criteria||{};const a=864e5,c={day:a,week:7*a,month:30*a},p=(t=null)=>{t||(t=window.location.search);const e=new URLSearchParams(t);return e.get("pid")?parseInt(e.get("pid")):null},u=t=>{for(const e of t){const t=i(e.criteria_id);if(t&&!t.matches(e))return!1}return!0},d=(t,e=null)=>{const n=((t=null)=>{t||(t=window.location.search);const e=new URLSearchParams(t);return e.get("view_as")?e.get("view_as").split(";").reduce((t,e)=>{const n=e.split(":");return 1===n.length?t[n[0]]=!0:t[n[0]]=n[1],t},{}):null})(e);if(n?.segment)return n.segment;const r=[];for(const e in t)u(t[e].criteria)&&r.push({id:e,priority:t[e].priority});return r.length?(r.sort((t,e)=>t.priority-e.priority),r[0].id):null},l=t=>{const e=[];for(const n in t)u(t[n].criteria)&&e.push(n);return e.sort()},w=(t,e,n,s=null)=>{const i=t.getAttribute("id"),a=[],p={element:t},u=(()=>{if(!0===s||!1===s)return p.override=!0,s||a.push("Prompt suppressed by override."),s;if(!n)return a.push("Prompt not displayed because RAS is not available."),!1;const[o,u,d,l]=t.getAttribute("data-frequency").split(","),w=n.store.get("pageviews");if(w[l]){const t=w[l].count||0;if(t<=parseInt(o))return a.push(`Prompt displayed starting at pageview ${parseInt(o)+1}. Reader has only ${t} pageviews.`),!1;if(0<u&&0<Math.max(0,t-(parseInt(o)+1))%(parseInt(u)+1))return a.push(`Prompt displayed once every ${parseInt(u)+1} pageviews.`),!1;const e=r(i),s=(n.getActivities("prompt_seen")||[]).filter(t=>t.data?.prompt_id===e&&c[l]>Date.now()-t.timestamp);if(0<parseInt(d)&&s.length>=parseInt(d))return a.push(`Prompt already displayed the max of ${d} times.`),!1}const g=t.getAttribute("data-suppression");if(g){const t=n.store.get("utm_source")||[],e=new URLSearchParams(window.location.search).get("utm_source");let r=!1;if(-1<t.indexOf(g)&&(r=!0),r||g!==e||(r=!0,n.store.set("utm_source",[...t,e])),r)return a.push(`Prompt suppressed by utm_source=${g}.`),!1}const h=t.getAttribute("data-segments")?t.getAttribute("data-segments").split(","):null;return!(h&&0>h.indexOf(e)&&(a.push("Reader does not match prompt’s assigned segments."),1))})();return p.displayed=u,0<a.length&&(p.suppression=a),o(i,p),u},g=t=>{let e;const n=new IntersectionObserver(r=>{r.forEach(r=>{r.isIntersecting?e||(e=setTimeout(()=>{t(),n.unobserve(r.target)},250)):e&&(clearTimeout(e),e=!1)})},{threshold:.5});return n};function h(t){"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",t):t())}const f=t=>{const e=Date.now(),n={day:{count:0,start:e},week:{count:0,start:e},month:{count:0,start:e},...t.store.get("pageviews")||{}};let r;document.body.classList.forEach(t=>{0===t.indexOf("page-id-")&&(r=parseInt(t.replace("page-id-","")))}),r&&parseInt(newspack_popups_view?.donor_landing_page)===r&&t.store.set("is_donor",!0);for(const t in n)c[t]<e-n[t].start&&(n[t].count=0,n[t].start=e),n[t].count++;return t.store.set("pageviews",n),n},m=e=>{const n=(n=null)=>{if(document.body.classList.contains("newspack-content-locked"))return;const i=newspack_popups_view?.segments||{},a=d(i);let c;o("matchingSegment",a),n?.segments&&(n.segments.register(i),n.segments.setMatch(a)),((t,e)=>{if(!t?.store||!t.store.get("reader")?.authenticated)return;const n=l(e),r=(t.store.get("matched_segments")||[]).slice().sort();JSON.stringify(n)!==JSON.stringify(r)&&t.store.set("matched_segments",n)}
1)(n,i),e.forEach(e=>{const o=e.getAttribute("id"),u=e.classList.contains("newspack-lightbox"),l=((t,e=!1,n=!1,r=null)=>t===p(r)||(!e||!n)&&null)(r(o),u,c)??((e,n=null)=>{const r=e.getAttribute("data-ab-test-id");if(!r)return null;const s=t().ab_tests?.[r];return s?((e,n,r=null)=>{const s=n.variants||[],o=t().ab_view_as;if(o&&-1<s.indexOf(o))return o;const i=t().ab_buckets?.[e];if(i&&-1<s.indexOf(i))return i;const a=((e=null)=>{const n=t().cid_cookie||"newspack-cid",r=(null===e?document.cookie||"":e).match(new RegExp("(?:^|;\\s*)"+n+"=([^;]+)"));if(!r)return null;try{return decodeURIComponent(r[1])}catch(t){return null}})(r);return a?((t,e,n)=>{const r=(n.variants||[]).filter(t=>"a"!==t);if(!r.length)return"a";const s=(n.control_share||50)/100,o=(1-s)/r.length,i=[["a",s]];let a=s;for(const t of r)a+=o,i.push([t,a]);const c=(t=>{let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e^t.charCodeAt(n);return e>>>0})(t+"|"+e)/4294967295;for(const[t,e]of i)if(c<=e)return t;return i[i.length-1][0]})(a,e,n):"a"})(r,s,n)===e.getAttribute("data-ab-variant")&&null:null})(e);[...e.querySelectorAll(".newspack-lightbox__close, button.newspack-lightbox-overlay")].forEach(t=>{t.addEventListener("click",s)});const h=w(e,a,n,l);if(!c&&u&&h&&(c=!0),h){const t=()=>{const t=e.getAttribute("data-delay")||0;setTimeout(s,t)},s=()=>{const s=d(i);n?.segments&&n.segments.setMatch(s),w(e,s,n,l)&&(n?.overlays&&n.overlays.get().length?t():(e.classList.remove("hidden"),n&&((t,e)=>{g(()=>e.dispatchActivity("prompt_seen",{prompt_id:r(t.getAttribute("id"))})).observe(t,{attributes:!0})})(e,n),u&&n?.overlays&&(document.body.classList.contains("newspack-content-locked")||(e.overlayId=n.overlays.add(`prompt_${o}`)))))};if(u)if(e.getAttribute("data-scroll")){const t=document.getElementById(`page-position-marker_${o}`);t&&g(s).observe(t)}else t();else s()}})};newspack_popups_view.segments?(window.newspackRAS=window.newspackRAS||[],window.newspackRAS.push(n)):n()},_=t=>{t.forEach(t=>{new MutationObserver(s=>{s.forEach(s=>{"amp-access-hide"!==s.attributeName||"attributes"!==s.type||s.target.hasAttribute("amp-access-hide")||(()=>{const s=e("loaded",r(t.getAttribute("id")));n(s)})()})}).observe(t,{attributes:!0})})},k=()=>`newspack-popups-reported-segments-${window.newspack_popups_view?.site_id||0}`,y=(t,e,n)=>{try{window.localStorage.setItem(k(),JSON.stringify({sid:t,ts:Date.now(),ids:e,won:n}))}catch(t){}},b=()=>{const t=window.newspack_popups_view?.segments;if(!t||"function"!=typeof gtag)return;const e=Object.keys(t);if(!e.length||p()||new URLSearchParams(window.location.search).get("view_as"))return;const r={};if(e.forEach(e=>{var n;n=t[e],(n?.criteria||[]).every(t=>i(t.criteria_id))&&(r[e]=t[e])}),!Object.keys(r).length)return;const s=l(r),o=s.length?s:["none"];let a=null;for(const t of s)(null===a||r[t].priority<r[a].priority)&&(a=t);const{sid:c,ids:u,won:d}=(()=>{const t=(()=>{try{const t=document.cookie?document.cookie.split("; "):[];for(const e of t){const t=e.indexOf("=");if(0!==e.indexOf("_ga_")||-1===t)continue;const n=e.slice(t+1).split("."),r=n[2]?(n[2].match(/\d+/)||[])[0]:null;if(r)return r}}catch(t){}return null})();try{const e=JSON.parse(window.localStorage.getItem(k()))||{},n=Array.isArray(e.ids)?e.ids:[],r=Array.isArray(e.won)?e.won:[];if(t){const s=e.sid===t;return{sid:t,ids:s?n:[],won:s?r:[]}}const s=!e.ts||Date.now()-e.ts>18e5;return{sid:t,ids:s?[]:n,won:s?[]:r}}catch(e){return{sid:t,ids:[],won:[]}}})(),w=o.filter(t=>!u.includes(t)),g=a&&!d.includes(a)?a:null;if(!w.length&&!g)return void y(c,u,d);const h=[],f=[];try{w.forEach(t=>{n({segment_id:t},"np_segment_matched"),h.push(t)}),g&&(n({segment_id:g},"np_segment_won"),f.push(g))}catch(t){}y(c,u.concat(h),d.concat(f))},v=()=>{try{b()}catch(t){}},A="np_contextual_prompt_interaction",S=t=>(t||"").slice(0,100),R=t=>{const e=t.querySelector("p");return e?S(e.innerText.trim()):""},E=(t,e,n={})=>({action:e,action_type:t.getAttribute("data-newspack-cp-cta")||"",contextual_prompt_post_id:t.getAttribute("data-newspack-cp-post-id")||"",contextual_prompt_placement:t.getAttribute("data-newspack-cp-placement")||"",contextual_prompt_condition:t.getAttribute("data-newspack-cp-condition")||"",prompt_text:R(t),...n});
1window.newspackRAS=window.newspackRAS||[],window.newspackRAS.push(t=>{function e(e){const n=i(e.dataset.criteria);n&&(e.innerHTML=n.getValue(t),t.on("data",()=>{e.innerHTML=n.getValue(t)}))}h(()=>{const t=document.querySelectorAll(".merge-tag");if(t.length)for(const n of t)n.dataset.criteria&&e(n)})}),h(()=>{window.newspackRAS=window.newspackRAS||[],window.newspackRAS.push(f),window.newspackRAS.push(v);try{!function(){if(window.self===window.top)return;const t=window.newspack_popups_view?.preview_param_names;if(!t?.length)return;const e=new URLSearchParams(window.location.search),n=t.filter(t=>e.has(t)).map(t=>[t,e.get(t)]);n.length&&document.querySelectorAll("a[href]").forEach(t=>{const e=t.getAttribute("href");if(e.startsWith("#"))return;let r;try{r=new URL(e,document.baseURI)}catch(t){return}if("http:"!==r.protocol&&"https:"!==r.protocol)return;if(r.origin!==window.location.origin)return;n.forEach(([t,e])=>r.searchParams.set(t,e));const s=/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(e);t.setAttribute("href",s?r.toString():r.pathname+r.search+r.hash)})}()}catch(t){console.warn("Prompt preview: could not propagate preview params.",t)}if(!newspack_popups_view?.has_disabled_prompts){const t=[...document.querySelectorAll(".newspack-popup-container")];m(t),(t=>{"function"==typeof gtag&&(_(t),window.newspackRAS=window.newspackRAS||[],window.newspackRAS.push(t=>{t.on("activity",({detail:{action:t,data:r}})=>{if("prompt_seen"===t){const{prompt_id:t}=r,s=e("seen",t);n(s)}})}),(t=>{t.forEach(t=>{const s=t.querySelector(".newspack-lightbox__close"),o=[...t.querySelectorAll(".newspack-popup-container form")];if(s){const i=()=>{const s=e("dismissed",r(t.getAttribute("id")));n(s)};s.addEventListener("click",i),o.forEach(t=>{t.addEventListener("submit",()=>s.removeEventListener("click",i))})}})})(t),(t=>{t.forEach(t=>{const s=[...t.querySelectorAll(".newspack-popup-container a")],o=s=>{const o={};s.currentTarget?.href&&"#"!==s.currentTarget?.href&&(o.action_value=s.currentTarget.getAttribute("href"));const i=e("clicked",r(t.getAttribute("id")),o);n(i)};s.forEach(t=>t.addEventListener("click",o))})})(t))})(t)}document.querySelectorAll("[data-newspack-cp-post-id]").forEach(t=>{(t=>{if("undefined"==typeof IntersectionObserver)return;let e=null;const r=new IntersectionObserver(s=>{s.forEach(s=>{if(s.isIntersecting&&s.intersectionRatio>=.5){if(e)return;e=setTimeout(()=>{e=null,n(E(t,"seen"),A),r.disconnect()},250)}else e&&(clearTimeout(e),e=null)})},{threshold:.5});r.observe(t)})(t),(t=>{t.addEventListener("click",e=>{const r=e.target.closest(".wp-block-buttons .wp-block-button__link[href]");if(!r&&!e.target.closest('.wpbnbd [type="submit"]'))return;const s=r?{button_text:S((r.innerText||"").trim()),link_url:S(r.href||"")}:{};n(E(t,"clicked",s),A)})})(t)})})})();

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.