PageSourceSearch

https://www.thionvilletouristamt.de/app/dist/pays-thionvillois/add…rch-engine-results-component.d11bc8b094.mjs

js thionvilletouristamt.de collected 2026-09-29 17:14:41 UTC 10,342 bytes, 1 lines download raw bytes

1import m from"woody_library_woody_component";class _ extends m{#m={template_selector:".search-results-model-template",results_container_selector:".search-results-container",no_result_selector:".search-no-result"};#d;#i;#r;#h;#p;#e;#l;#n=!1;#t;#a;#s;constructor(){super()}async init(t){super.init(t),this.config=Object.assign(this.#m,this.config);const e=this.querySelector(this.config.template_selector);if(!e)throw new Error("SearchEngineResultsComponent - init - card template is missed");const i=e.textContent||e.text;if(!i||i.trim()==="")throw new Error("SearchEngineResultsComponent - init - card template is empty");const a=document.createElement("div");a.innerHTML=i.trim();const r=a.firstElementChild;if(!r)throw new Error("SearchEngineResultsComponent - init - card template has no valid HTML element");if(this.#d=r.outerHTML,this.#i=this.querySelector(this.config.results_container_selector),!this.#i)throw new Error("SearchEngineResultsComponent - init - results container is missed");this.#r=this.querySelector(this.config.no_result_selector);const s=this.querySelector("[data-woody-scroll-top]");s&&s.addEventListener("click",o=>{o.preventDefault(),this.dispatchEvent(new Event("scrollTop"))}),this.#t=this.querySelector("[data-woody-search-pagination]"),this.#t&&(this.#s=this.#t.querySelector("[data-woody-search-pagination-max]"),this.#a=this.#t.querySelector("[data-woody-search-pagination-min]")),this.#e=this.querySelector("[data-woody-infinite-scroll-target]"),this.#e&&(this.#e.dataset.woodyInfiniteScrollRootSelector&&this.#e.dataset.woodyInfiniteScrollRootSelector!=""&&(this.#h=this.#e.closest(this.#e.dataset.woodyInfiniteScrollRootSelector)),this.#e.dataset.woodyInfiniteScrollRootMargin&&this.#e.dataset.woodyInfiniteScrollRootMargin!=""&&(this.#p=this.#e.dataset.woodyInfiniteScrollRootMargin),this.#l=new IntersectionObserver(o=>{o.forEach(n=>{n.isIntersecting&&this.loadMore()})},{root:this.#h||null,rootMargin:this.#p||"0px"}))}loadMore(){this.dispatchEvent(new Event("loadMore"))}updateResults(t,e,i,a=0,r){if(a==0&&(this.#n&&this.deactivateInfiniteScroll(),this.clearResults(),this.clearPagination()),t?.length>0){for(const s of t)this.appendsResult(s);t.length<i?this.#n&&this.deactivateInfiniteScroll():this.#n||this.activateInfiniteScroll(),this.#t&&this.setPagination(t?.length,e?.total?.count),this.hideNoResult()}else this.clearPagination(),this.showNoResult()}showNoResult(){this.#r&&this.#r.classList.add("active")}hideNoResult(){this.#r&&this.#r.classList.remove("active")}setPagination(t,e){if(this.#t&&this.#t&&this.#t.classList.add("active"),this.#a){const i=this.#a.innerHTML;i&&i!=""&&!isNaN(i)?this.#a.innerHTML=parseInt(i)+t:this.#a.innerHTML=t}this.#s&&(this.#s.innerHTML=e)}clearPagination(){this.#t&&this.#t.classList.remove("active"),this.#a&&(this.#a.innerHTML=""),this.#s&&(this.#s.innerHTML="")}#o(t,e){if(!e?.start?.day)return t.replace('class="card-date"','class="card-date is-hidden"');const i=e.oneday===!0;return t=t.replaceAll("{% start_date_day %}",e.start.day),t=t.replaceAll("{% start_date_month %}",e.start.shortMonth||""),e.display_year?(t=t.replaceAll("{% start_date_year %}",e.start.year||""),t=t.replaceAll("{% end_date_year %}",i?"":e.end?.year||"")):(t=t.replace(/<span class="card-startDate-year">{% start_date_year %}<\/span>/,""),t=t.replace(/<span class="card-endDate-year">{% end_date_year %}<\/span>/,""),t=t.replaceAll("{% start_date_year %}",""),t=t.replaceAll("{% end_date_year %}","")),i?(t=t.replace('class="card-dateDivider wicon wicon-025-suivant"','class="card-dateDivider wicon wicon-025-suivant hide"'),t=t.replace(/<span class="date-part card-endDate">[\s\S]*?<\/span>/,""),t=t.replaceAll("{% end_date_day %}",""),t=t.replaceAll("{% end_date_month %}","")):(t=t.replaceAll("{% end_date_day %}",e.end?.day||""),t=t.replaceAll("{% end_date_month %}",e.end?.shortMonth||"")),t}#c(){return typeof window<"u"?window.moment:void 0}#_(){!this.#c()||(globals?.current_locale_region||globals?.current_locale)}#f(t){return t.format("MMM").replace(/\./g,"").toUpperCase()}#u(t,e){const i=(globals?.current_locale_region||globals?.current_locale||"fr-FR").replace("_","-"),a=new Intl.DateTimeFormat(i,{timeZone:e,
1year:"numeric",month:"2-digit",day:"2-digit",numberingSystem:"latn"}).formatToParts(new Date(t)),r=a.find(n=>n.type==="year")?.value,s=a.find(n=>n.type==="month")?.value,o=a.find(n=>n.type==="day")?.value;return r&&s&&o?`${r}-${s}-${o}`:null}#g(t){if(!Array.isArray(t)||t.length<1)return null;const e=Date.now(),i=t.length>1?t.sort((a,r)=>a.start_date-r.start_date).filter(a=>a.end_date>=e):t;return i.length>0?i[0]:null}#y(t){const e=this.#c(),i=this.#g(t);if(!i)return null;this.#_();const a=globals?.woody_timezone||"Europe/Paris";return{startMoment:e(this.#u(i.start_date,a),"YYYY-MM-DD"),endMoment:e(this.#u(i.end_date,a),"YYYY-MM-DD")}}#M(t){const e=this.#c(),i=this.#y(t);if(!i)return null;const{startMoment:a,endMoment:r}=i,s=e().year(),o=a.year()!==r.year(),n=o||a.year()!==s?String(a.year()):"",h=o||r.year()!==s?String(r.year()):"",d=a.isSame(r,"day");return{start:{day:a.format("D"),shortMonth:this.#f(a),year:n},end:{day:r.format("D"),shortMonth:this.#f(r),year:h},oneday:d,display_year:!!(n||h)}}#v(t){const e=this.#c(),i=this.#y(t);if(!i)return null;const{startMoment:a,endMoment:r}=i,s=e().year(),o=l=>l.year()!==s?" "+l.format("YYYY"):"",n=typeof __search<"u"?__search:{},h=n.date_on||"Le",d=n.date_from||"Du",c=n.date_to||"au";return a.isSame(r,"day")?`${h} ${a.format("D")} ${a.format("MMMM")}${o(a)}`:a.isSame(r,"month")?`${d} ${a.format("D")} ${c} ${r.format("D")} ${r.format("MMMM")}${o(r)}`:a.isSame(r,"year")?`${d} ${a.format("D")} ${a.format("MMMM")} ${c} ${r.format("D")} ${r.format("MMMM")}${o(r)}`:`${d} ${a.format("D")} ${a.format("MMMM")} ${a.format("YYYY")} ${c} ${r.format("D")} ${r.format("MMMM")} ${r.format("YYYY")}`}#w(t,e){return e?t.replace(/<div class="card-date">[\s\S]*?<\/div>/,`<div class="card-date card-date--text"><div class="date-part"><span class="card-date-text-one-line">${e}</span></div></div>`):t.replace('class="card-date"','class="card-date is-hidden"')}appendsResult(t){let e=this.#d,i=t.$short_description&&typeof t.$short_description<"u"?t.$short_description:"",a=t.type=="sheet"?t.subtype.label:"",r=t.type!="page"&&t.city?t.city:"",s="",o="",n="";const h=Array.isArray(t.data?.sheet_ratings)?t.data.sheet_ratings.map(c=>{try{return JSON.parse(c)}catch{return null}}).filter(Boolean):[];if(h.length>0)for(const c of h){const l=Math.min(5,Math.max(0,parseInt(c.count,10)||0));if(l<1)continue;const f=(c.label||"Note : "+l+" sur 5").replaceAll('"',"&quot;"),p=c.icon?(`<span class="card-rating-icon" style="--icon-url:url('`+c.icon.replaceAll("'","%27").replaceAll('"',"&quot;")+`')" aria-hidden="true"></span>`).repeat(l):"\u2605".repeat(l);n+='<span class="card-rating-stars card-rating-'+(c.type||"etoile")+'" aria-label="'+f+'">'+p+"</span>"}else{const c=t.data?.sheet_rating;if(c!=null&&!Number.isNaN(parseInt(c,10))){const l=Math.min(5,Math.max(0,parseInt(c,10)));l>=1&&(n='<span class="card-rating-stars" aria-label="Note : '+l+' sur 5">'+"\u2605".repeat(l)+"</span>")}}e=e.replaceAll("{% sheet_rating %}",n),e=e.replaceAll("{% title %}",t.data.title),e=e.replaceAll("{% link_url %}",t.url),e=e.replaceAll("{% link_title %}",t.data.title),e=e.replaceAll("{% subtitle %}",a),e=e.replaceAll("{% town %}",r);const d=encodeURI(t.img);if(e=e.replace(/(?:src="(.*?)"[^])/i,`src="${d}"`),e=e.replace(/(?:data-src="(.*?)"[^])/i,`srcset="${d}"`),e=e.replace(/(?:srcset="(.*?)"[^])/i,`srcset="${d}"`),e=e.replace(/(?:data-srcset="(.*?)"[^])/i,`srcset="${d}"`),r.length<1&&(e=e.replace("card-town","card-town is-hidden")),a.length<1&&(e=e.replace("card-subtitle","card-subtitle is-hidden")),i.length<1&&(e=e.replace("card-description","card-description is-hidden")),n.length<1&&(e=e.replace("card-ratings","card-ratings is-hidden")),t.type!="sheet"&&(e=e.replace("card-tripInfos-wrapper","card-tripInfos-wrapper is-hidden"),e=e.replace("card-iti","card-iti is-hidden")),t.data.price&&t.data.price.floatValue!=0?(s=t.data.price.floatValue,o=t.data.price.currency?t.data.price.currency:""):(s="",o="",e=e.replace("card-tripInfos-wrapper","card-tripInfos-wrapper is-hidden")),t.type=="page")e=e.replaceAll("basicCard","overlayedCard"),e=e.replaceAll("tpl_01","tpl_05"),e=e.replaceAll("card-section","card-section fcbCol bottomleftbox"),e=e.replaceAll("{% description %}",i),e=this.#o(e,null);else if(t.type=="sheet"){e=e.replace("card-description","card-description is-hidden");const c=t.subtype?.slug,f=(globals?.sheet_bordereaux_with_dates||[]).includes(c),p=globals?.short_date_bordereaux||[],y=p.includes("all")||p.includes(c);if(!f)e=this.#o(e,null);else if(y){const u=this.#M(t.data?.["%dates"]);e=this.#o(e,u)}else{const u=this.#v(t.data?.["%dates"]);e=this.#w(e,u)}t.data.length||t.data["%locomotions"]?(t.data.length?e=e.replaceAll("{% iti_length %}",t.data.length.floatValue+" "+t.data.length.unit):e=e.replace("card-iti-length","card-iti-length is-hidden"),t.data["%locomotions"]?(t.data["%locomotions"][0].locomotion_duration?e=e.replaceAll("{% iti_duration %}",t.data["%locomotions"][0].locomotion_duration):e=e.replace("iti-infos-time","iti-infos-time is-hidden"),t.data["%locomotions"][0].difficulty?e=e.replaceAll("{% iti_difficulty %}",t.data["%locomotions"][0].difficulty):e=e.replace("iti-infos-level","iti-infos-level is-hidden")):e=e.replace("card-iti-infos","card-iti-infos is-hidden")):e=e.replace("card-iti","card-iti is-hidden"),e=e.replaceAll("{% price %}",s),e=e.replaceAll("{% currency %}",o)}else t.type=="product"?(e=s>0?e.replaceAll("{% description %}",s+" "+o):"",e=e.replaceAll("{% price %}",""),e=e.replaceAll("{% currency %}",""),e=this.#o(e,null)):e=this.#o(e,null);e=e.replaceAll("{% description %}",""),e=e.replaceAll("{% start_date_day %}",""),e=e.replaceAll("{% start_date_month %}",""),e=e.replaceAll("{% start_date_year %}",""),e=e.replaceAll("{% end_date_day %}",""),e=e.replaceAll("{% end_date_month %}",""),e=e.replaceAll("{% end_date_year %}",""),e=e.replaceAll("is-loading",""),this.#i.innerHTML+=e,this.#i.dispatchEvent(new Event("cardContentLoaded"))}clearResults(){this.#i.innerHTML=""}activateInfiniteScroll(){this.#e&&this.#l.observe(this.#e),this.#n=!0}deactivateInfiniteScroll(){this.#e&&this.#l.unobserve(this.#e),this.#n=!1}}export{_ 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.