PageSourceSearch

https://hechingerreport.org/wp-content/plugins/newspack-popups/dist/criteria.js?ver=1789759412

js hechingerreport.org collected 2026-09-24 08:34:53 UTC 5,593 bytes, 1 lines download raw bytes

1(()=>{"use strict";const t=t=>"string"==typeof t&&t.startsWith("||")&&t.endsWith("||")?t.split("||").map(t=>t.trim()).filter(t=>""!==t):t,e=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,r=/^[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?( ?(Z|[+-]\d{2}:?\d{2}))?$/,i=t=>{if("string"!=typeof t)return null;const i=t.trim(),n=i.slice(0,10);if(!e.test(n)||!(t=>{const[e,r,i]=t.split("-").map(Number),n=new Date(0,0,1);return n.setFullYear(e,r-1,i),0!==e&&n.getFullYear()===e&&n.getMonth()===r-1&&n.getDate()===i})(n))return null;const a=i.slice(10);return a&&!r.test(a)?null:n},n=t=>{if(!t||"object"!=typeof t)return null;if("absolute"===t.type)return i(t.date);if("relative"===t.type&&Number.isInteger(t.days)){const r=new Date;if(r.setDate(r.getDate()+t.days),Number.isNaN(r.getTime()))return null;const i=`${String(r.getFullYear()).padStart(4,"0")}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")}`;return e.test(i)?i:null}return null},a={default:(t,e)=>t.value===e.value,list__in:(e,r)=>{let i=r.value;if("string"==typeof i&&(i=r.value.split(",").map(t=>t.trim())),!Array.isArray(i))return!1;const n=t(e.value);return Array.isArray(n)?n.some(t=>i.some(e=>e==t)):!(!n||!i.some(t=>t==n))},list__not_in:(e,r)=>{let i=r.value;if("string"==typeof i&&(i=r.value.split(",").map(t=>t.trim())),!Array.isArray(i))return!0;const n=t(e.value);return Array.isArray(n)?!n.some(t=>i.some(e=>e==t)):!n||!i.some(t=>t==n)},range:(t,e)=>{if(isNaN(t.value))return!1;const{min:r,max:i}=e.value,n=t=>null!=t&&""!==t,a=n(i)&&Number(i)>0;return!(n(r)&&t.value<r||a&&t.value>i)},date_range:(t,e)=>{const r=i(t.value);if(!r)return!1;const a=e.value;if(!a||"object"!=typeof a||Array.isArray(a))return!1;if(void 0!==a.start){const t=n(a.start);if(!t||r<t)return!1}if(void 0!==a.end){const t=n(a.end);if(!t||r>t)return!1}return!0}};window.newspackPopupsCriteria=window.newspackPopupsCriteria||{criteria:{}},window.newspackPopupsCriteria.criteria=window.newspackPopupsCriteria.criteria||{};const s={};function o(t,e={}){if(!t)throw new Error("Criteria must have an ID.");const r={id:t,matchingFunction:"default",...e,...s[t]};return r.getValue=t=>{if("function"==typeof r.matchingAttribute)return r.matchingAttribute(t);if("string"==typeof r.matchingAttribute){if("function"==typeof t?.store?.get)return t.store.get(r.matchingAttribute);console.warn(`Reader data library not loaded. Unable to fetch value for '${r.id}'`)}return r.value},r._matched={},r.matches=t=>{const e=JSON.stringify(t);if(void 0!==r._matched[e])return r._matched[e];const i=window.newspackReaderActivation;return i||console.warn("Reader activation script not loaded."),(t=>{if(!r._configured){if(r._configured=!0,r.matchingAttribute||(r.matchingAttribute=r.id),"string"==typeof r.matchingFunction&&a[r.matchingFunction]&&(r.matchingFunction=a[r.matchingFunction].bind(null,r)),"function"!=typeof r.matchingFunction)return console.warn(`Unable to configure matching function for criteria ${r.id}.`),void(r.matchingFunction=()=>!1);"function"==typeof t?.on&&t.on("data",()=>{r._matched={}}),r.value=r.getValue(t)}})(i),r._matched[e]=r.matchingFunction(t,i,r),r._matched[e]},window.newspackPopupsCriteria.criteria||(window.newspackPopupsCriteria.criteria={}),window.newspackPopupsCriteria.criteria[t]=r,r}function u(t){return t?window.newspackPopupsCriteria.criteria[t]:window.newspackPopupsCriteria.criteria}function c(t,e){let r=u(t);r||(s[t]=s[t]||{},r=s[t]),r._matched={},r.matchingAttribute=e}function l(t,e){let r=u(t);r||(s[t]=s[t]||{},r=s[t]),r._matched={},r.matchingFunction=e}function p({param:t,sessionKey:e,isPositive:r}){const i=new URLSearchParams(window.location.search).get(t);if(null!==i&&r(i)){try{window.sessionStorage.setItem(e,"1")}catch(t){}return!0}try{return"1"===window.sessionStorage.getItem(e)}catch(t){return!1}}function d(){return p({param:"np_seg_donor",sessionKey:"newspack-popups-donor-from-email",isPositive:t=>!(t=>/^\*\|[^|]+\|\*$/.test(t)||/^\[\[[^\]]+\]\]$/.test(t)||/^%[^%]+%$/.test(t)||/^\[[^\][]+\]$/.test(t))(t)&&(t=>!["no","none","false","0",""].includes(String(t).toLowerCase()))(t)})}if(c("articles_read",t=>t.getUniqueActivitiesBy("article_view","post_id").filter(t=>t.timestamp>Date.now()-2592e6).length),c("articles_read_in_session",t=>{const e=t.getUniqueActivitiesBy("article_view","post_id");if(!e.length)return 0;if(e.sort((t,e)=>e.timestamp-t.timestamp),e[0].timestamp<Date.now()-18e5)return 0;let r=0;for(;r<e.length&&e[r+1]&&e[r].timestamp-e[r+1].timestamp<18e5;)r++;return 1+r}),l("devices",(t,e,{optionParams:r})=>{const i=Array.isArray(t.value)?t.value:[];
1if(0===i.length)return!1;const n=window.innerWidth;return i.some(t=>{const e=r[t];return!isNaN(e?.min_width)&&!isNaN(e?.max_width)&&n>=e.min_width&&n<e.max_width})}),l("donation",function(t,{store:e}){switch(t.value){case"donors":return e.get("is_donor")||d();case"non-donors":return!(e.get("is_donor")||d());case"formers-donors":return e.get("is_former_donor")}}),l("newsletter",function(t,{store:e}){const r=e.get("is_newsletter_subscriber")||p({param:"utm_medium",sessionKey:"newspack-popups-from-email",isPositive:t=>"email"===t.toLowerCase()});switch(t.value){case"subscribers":return r;case"non-subscribers":return!r}}),l("user_account",(t,{store:e})=>{switch(t.value){case"with-account":return newspackPopupsCriteria.is_non_preview_user||e.get("reader")?.email;case"without-account":return!newspackPopupsCriteria.is_non_preview_user&&!e.get("reader")?.email}}),newspackPopupsCriteria.criteria={},newspackPopupsCriteria?.config)for(const t in newspackPopupsCriteria.config)o(t,newspackPopupsCriteria.config[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.