PageSourceSearch

https://www.haberall.com/build/assets/weather-CFGokui7.js

js haberall.com collected 2026-09-29 16:15:37 UTC 2,634 bytes, 1 lines download raw bytes

1const o=["acik","kapali","yagmurlu","hafif-yagmur","orta-siddetli-yagmur","kar-yagisli","hafif-kar-yagisli","az-bulutlu","parcali-bulutlu","parcali-az-bulutlu"];class y{constructor(e={}){this.selectors={dayMonth:e.dayMonth||".w-day-month",time:e.time||".exchange-weather-time"}}_update(){const e=new Date,a=e.toLocaleDateString(void 0,{day:"numeric",month:"long"}),s=e.toLocaleString(void 0,{hour:"2-digit",minute:"2-digit"}),c=Habersoft?.pageData?.dayName||"";document.querySelectorAll(this.selectors.dayMonth).forEach(l=>{l.innerHTML=`${c}, <br> ${a}`}),document.querySelectorAll(this.selectors.time).forEach(l=>{l.textContent=s})}init(){return this._update(),setInterval(()=>this._update(),1e4),this}}class p{constructor(e={}){this.selectors={tempCity:e.tempCity||".temp-city-el",tempStatus:e.tempStatus||".temp-status-el",tempStatusImg:e.tempStatusImg||".temp-status-img-el",tempValue:e.tempValue||".temp-el",widgetBg:e.widgetBg||".weather-widget-bg",container:e.container||".temp-cont",changeEl:".weatherChangeElement",districtEl:".listDistrictSelect"}}async _fetchAndRender(e,a){const s=e.closest(this.selectors.container);let c,l;a==="change"?(c=s?.querySelector(this.selectors.changeEl)?.value,l=s?.querySelector(this.selectors.districtEl)?.value||""):(c=e.dataset.cityValue,l="");const i=Habersoft?.routes?.ajax?.weather;if(!i||!c)return;const d=i.replace("--city_placeholder",encodeURIComponent(c)).replace("--district_placeholder",encodeURIComponent(l||c));try{const t=(await(await fetch(d)).json()).data,n=o.includes(t.status)?t.status:"default",h=t.sehir===t.ilce?t.sehir:`${t.ilce}, ${t.sehir}`,m=t.durum==="PARÇALI AZ BULUTLU"?"P. AZ BULUTLU":t.durum==="Rain and snow"?"Karla Karışık Yağmur":t.durum,g=(Habersoft?.meta?.assets_base||"").replace(/\/$/,"");s?.querySelectorAll(this.selectors.tempCity).forEach(r=>{r.textContent=h}),s?.querySelectorAll(this.selectors.tempStatus).forEach(r=>{r.textContent=m}),s?.querySelectorAll(this.selectors.tempValue).forEach(r=>{r.textContent=t.derece}),s?.querySelector(this.selectors.tempStatusImg)?.setAttribute("src",`${g}/frontend/diamond/assets/img/weather_widget_backgrounds/${n}-icon.webp`),s?.querySelectorAll(this.selectors.widgetBg).forEach(r=>{r.classList.remove(...o),r.classList.add(n)})}catch(t){console.error("WeatherWidget fetch error:",t)}}init(){return document.addEventListener("change",e=>{const a=e.target.closest(".weatherChangeElement");a&&this._fetchAndRender(a,"change")}),document.addEventListener("click",e=>{const a=e.target.closest(".weatherClickElement");a&&this._fetchAndRender(a,"click")}),this}}export{y as WeatherDateTime,p as WeatherWidget};

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.