PageSourceSearch

https://radiolab.org/_nuxt/index.c5ace312.js

js radiolab.org collected 2026-10-01 08:47:12 UTC 7,422 bytes, 1 lines download raw bytes

1import{a as H,T as O,M as W,H as j}from"./components.7f83dc9d.js";import{r as _,q as B,b as r,c as h,d as c,f as C,G as M,g as d,n as z,H as K,o as V,i as G,B as D,j as J,z as X,t as Y,v as $,l as L,w as b,e as q,F as U,p as Q,E as Z,I as ee,J as te,m as ae,u as F,K as se}from"./entry.3f839f5a.js";import{_ as ne}from"./PlaySelector.5abcca38.js";import{b as oe,f as le,a as re,_ as ie}from"./helpers.c0fdf7cf.js";import{a as ce,_ as ue}from"./Episodes.f18b711b.js";import{_ as de}from"./VCard.f7dd2618.js";import{_ as pe}from"./VFlexibleLink.b87e0a75.js";import"./composables.02fccbef.js";import"./axios.317d83f8.js";import"./VImageWithCaption.39a84efa.js";const he={class:"fields"},_e={class:"search-field p-input-icon-left"},me={__name:"SearchField",props:{placeholder:{type:String,default:"Search"},isSearching:{type:Boolean,default:!1}},emits:["search","update","year"],setup(t,{emit:s}){const e=t,m=_(),a=_(""),o=()=>{a.value&&s("search",a.value)},p=g=>{g.key!=="Enter"&&s("update",a.value)};return(g,l)=>{const f=B("Dropdown"),v=B("InputText");return r(),h("div",he,[c(f,{title:"Choose a year",options:C(M),modelValue:m.value,"onUpdate:modelValue":l[0]||(l[0]=n=>m.value=n),"option-label":"year",placeholder:"Year","aria-label":"Filter by year","aria-labelledby":"Filter by year",onChange:l[1]||(l[1]=n=>s("year",m.value.year))},null,8,["options","modelValue"]),d("div",_e,[d("i",{class:z(["pi",t.isSearching?"pi-spin pi-spinner":"pi-search"])},null,2),c(v,{type:"search",modelValue:a.value,"onUpdate:modelValue":l[2]||(l[2]=n=>a.value=n),placeholder:e.placeholder,onKeyup:[K(o,["enter"]),p]},null,8,["modelValue","placeholder","onKeyup"])])])}}};const ge={class:"title-with-search"},fe=d("h1",{class:"h2 font-normal"},"Podcast",-1),ve={__name:"TitleWithSearch",props:{title:{type:String,default:"",required:!0},placeholder:{type:String,default:"Search"},isSearching:{type:Boolean,default:!1}},emits:["search","update","year"],setup(t,{emit:s}){const e=t;return V(()=>{}),(m,a)=>(r(),h("div",ge,[fe,c(me,{placeholder:e.placeholder,isSearching:t.isSearching,onSearch:a[0]||(a[0]=o=>s("search",o)),onUpdate:a[1]||(a[1]=o=>s("update",o)),onYear:a[2]||(a[2]=o=>s("year",o))},null,8,["placeholder","isSearching"])]))}};const ye={class:"content xl:px-8"},be={class:"grid"},we={class:"col"},xe={key:0,class:"recent-episodes"},Se={key:0,class:"col flex justify-content-between align-items-center mb-3"},Pe={key:0},Ae={key:1,class:"grid justify-content-center"},$e={class:"col-12 sm:col-6 lg:col-4 mb-6"},Ce=d("div",{class:"divider"},null,-1),ke={key:0,class:"htlad-radiolab_in-content_1 col-fixed mb-6",style:{width:"100%"}},Ie={key:2},Re={__name:"EpisodesAlgolia",props:{header:{type:String,default:null},buttonText:{type:String,default:null},buttonLink:{type:String,default:null},rowCount:{type:Number,default:1},rowsPerAd:{type:Number,default:1},startCount:{type:Number,default:0},startPage:{type:Number,default:1},paginate:{type:Boolean,default:!1},showLastAd:{type:Boolean,default:!1},episodesSearchResults:{type:Object,default:null}},emits:["searchPageEvent"],setup(t,{emit:s}){const e=t,m=G(),a=_(!1);_([]),_(null);const o=_(e.startPage),p=_(3),g=[];V(()=>{let n=p.value;window.innerWidth<=oe.lg&&(n=2);const w=f.value/e.rowsPerAd/n+(e.showLastAd?1:0);for(let y=1;y<w;y++){const S=y*e.rowsPerAd*n;g.push(S)}a.value=!0});const l=n=>g.includes(n),f=D(()=>e.startCount?e.startCount+e.rowCount*p.value:e.rowCount*p.value);J(()=>{m.query.page&&(o.value=m.query.page)}),X(o,n=>{te({query:{page:n}})});async function v(n){s("searchPageEvent",n)}return(n,w)=>{var A,k,I,R,T,N;const y=B("Button"),S=ne,i=ie,x=ce,P=B("paginator");return r(),h("section",null,[d("div",ye,[d("div",be,[d("div",we,[a.value?(r(),h("div",xe,[e.header||e.buttonText?(r(),h("div",Se,[e.header?(r(),h("h3",Pe,Y(e.header),1)):$("",!0),e.buttonText?(r(),L(pe,{key:1,raw:"",to:t.buttonLink},{default:b(()=>[c(y,{class:"p-button-rounded p-button-sm"},{default:b(()=>[q(Y(e.buttonText),1)]),_:1})]),_:1},8,["to"])):$("",!0)])):$("",!0),((k=(A=t.episodesSearchResults)==null?void 0:A.hits)==null?void 0:k.length)>0?(r(),h("div",Ae,[(r(!0),h(U,null,Q((I=t.episodesSearchResults)==null?void 0:I.hits,(u,E)=>(r(),h(U,{key:`searchCard${E}`},[d("div",$e,[c(i,null,{default:b(()=>
1[c(de,{image:u["image-main"].template?C(le)(u["image-main"].template):u["image-main"].url,width:320,height:240,alt:u["image-main"]["alt-text"],title:u.title,titleLink:`/podcast/${u.slug}`,eyebrow:C(re)(u["publish-at"]),blurb:u.tease,"max-width":u["image-main"].w,"max-height":u["image-main"].h,responsive:"",ratio:[3,2],sizes:[2],"flat-quality":"",bp:"max",class:"radiolab-card"},{default:b(()=>[Ce,c(S,{episode:u},null,8,["episode"])]),_:2},1032,["image","alt","title","titleLink","eyebrow","blurb","max-width","max-height"])]),_:2},1024)]),e.rowCount>1&&l(E+1)?(r(),h("div",ke)):$("",!0)],64))),128))])):(R=t.episodesSearchResults)!=null&&R.hits?(r(),h("div",Ie," no results, search again ")):$("",!0)])):(r(),L(x,{key:1,"card-count":C(f)-t.startCount,header:e.header,"button-text":e.buttonText,paginate:e.paginate},null,8,["card-count","header","button-text","paginate"])),Z(c(P,{"total-records":(T=t.episodesSearchResults)==null?void 0:T.nbHits,pageLinkSize:3,rows:C(f),onPage:w[0]||(w[0]=u=>v(u))},null,8,["total-records","rows"]),[[ee,e.paginate&&((N=t.episodesSearchResults)==null?void 0:N.nbPages)>1]])])])])])}}},Te=()=>ae().$algolia;function Ne(t){const s=Te();return s==null?void 0:s.initIndex(t)}function Be(t){const s=F(),e=t||s.algolia.globalIndex;if(!e)throw new Error("`[@nuxtjs/algolia]` Cannot search in Algolia without `globalIndex` or `indexName` passed as a parameter");const m=Ne(e),a=se(`${e}-search-result`,()=>null),o=async({query:p,requestOptions:g})=>{const l=await m.search(p,g);return a.value=l,l};return{result:D(()=>a.value),search:o}}const Le={class:"content xl:px-8 pb-0"},Ee={class:"grid"},Ye={class:"col"},Ue=d("div",{class:"htlad-radiolab_in-content_2 mb-8"},null,-1),Ke={__name:"index",setup(t){const s=F(),e=`${s.API_URL}/api/v3/channel/shows/radiolab/recent_stories/`,{result:m,search:a}=Be(s.ALGOLIA_RADIOLAB_INDEX),o=_(""),p=_(""),g=_(0),l=_(null),f=_(!1),v=async()=>{f.value=!0;const i=new Date(`January 1, ${p.value} 00:00:00`).getTime()/1e3,x=31556926,P=p.value?`date-line-ts:${i} TO ${i+x}`:"";await a({query:o.value,requestOptions:{page:g.value,filters:P}}).then(()=>{l.value=m.value,setTimeout(()=>{f.value=!1},500)})},n=async i=>{o.value=i,v()},w=i=>{o.value=i,i===""&&p.value===""&&(l.value=null)},y=i=>{g.value=i.page,v()},S=i=>{const x=isNaN(i)?"":i;p.value=x,g.value=0,v()};return(i,x)=>{const P=O,A=W,k=j,I=H,R=ve,T=Re,N=ue;return r(),h("div",null,[c(I,{lang:"en"},{default:b(()=>[c(k,null,{default:b(()=>[c(P,null,{default:b(()=>[q("Podcast | Radiolab | WNYC Studios")]),_:1}),c(A,{name:"og:title",content:"Podcast | Radiolab | WNYC Studios"}),c(A,{name:"twitter:title",content:"Podcast | Radiolab | WNYC Studios"})]),_:1})]),_:1}),d("section",null,[d("div",Le,[d("div",Ee,[d("div",Ye,[c(R,{title:"Podcast",placeholder:"Search by topic, guest, host",isSearching:f.value,onSearch:n,onUpdate:w,onYear:S},null,8,["isSearching"])])])])]),l.value?(r(),L(T,{key:0,class:"mb-4","row-count":4,rowsPerAd:2,"episodes-search-results":l.value,paginate:!0,onSearchPageEvent:y},null,8,["episodes-search-results"])):(r(),L(N,{key:1,class:"mb-4","row-count":4,rowsPerAd:2,api:e,path:"data.included",paginate:!0})),Ue])}}};export{Ke as default};

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.