PageSourceSearch

https://www.banyuls-sur-mer.com/app/dist/banyuls-sur-mer/addons/wo…/woody-addon-weather-update.bf83ae7d23.mjs

js banyuls-sur-mer.com collected 2026-10-02 06:35:12 UTC 3,995 bytes, 1 lines download raw bytes

1const s=new Map,d=new Map;function M(n){const e=n.getAttribute("data-weather-account");if(!e)return;if(s.has(e)){l(e,s.get(e));return}if(d.has(e)){d.get(e).then(()=>{s.has(e)&&l(e,s.get(e))});return}const t=new URLSearchParams({account:e}),i=n.getAttribute("data-weather-nb-days");i&&t.set("nb_days",i);const r=fetch(`/wp-json/woody/weather/data?${t.toString()}`).then(o=>o.json()).then(o=>{o?.code||!o?.days?.length||(s.set(e,o.days),l(e,o.days))}).catch(o=>{console.warn("Weather fetch error:",o)}).finally(()=>{d.delete(e)});d.set(e,r)}function w(n=document,e=null){const t=e?`.woody-component-weather[data-weather-account="${e}"]`:".woody-component-weather[data-weather-account]";return[...n.querySelectorAll(t)]}function l(n,e){w(document,n).forEach(t=>{_(t,e)})}function _(n,e){e.forEach((t,i)=>{const r=n.querySelectorAll(`[data-weather-day="${i}"]`);if(!r.length)return;const o=t.summary||{};r.forEach(a=>{f(a,"date",t.date),f(a,"sky",o.sky),p(a,"icon",o.icon),h(a,"average_temp",o.average_temp),m(a,o),b(a,o),$(a,o),q(a,o.bg_img),L(a,t.details||{})})})}function f(n,e,t){const i=n.querySelector(`[data-weather-field="${e}"]`);i&&(i.textContent=t||"")}function p(n,e,t){const i=n.querySelector(`[data-weather-field="${e}"]`);i&&(i.className=t||"")}function h(n,e,t){const i=n.querySelector(`[data-weather-field="${e}"]`);if(i){if(t==null||t===""){i.innerHTML="";return}i.innerHTML=`${t}<sup>\xB0</sup><span class="unit">C</span>`}}function m(n,e){const t=n.querySelector('[data-weather-field="minmax"]');if(!t)return;if(e.min_temp==null||e.max_temp==null||e.min_temp===""||e.max_temp===""){t.hidden=!0;return}t.hidden=!1;const i=t.querySelector('[data-weather-field="min_temp"]'),r=t.querySelector('[data-weather-field="max_temp"]');i&&(i.innerHTML=`min : ${e.min_temp}<sup>\xB0</sup><span class="unit">C</span> / `),r&&(r.innerHTML=`max : ${e.max_temp}<sup>\xB0</sup><span class="unit">C</span>`)}function b(n,e){const t=n.querySelector('[data-weather-field="topbottom"]');if(!t)return;if(e.top_temp==null||e.bottom_temp==null){t.hidden=!0;return}t.hidden=!1;const i=t.querySelector('[data-weather-field="bottom_temp"]'),r=t.querySelector('[data-weather-field="top_temp"]');i&&(i.innerHTML=`${i.dataset.weatherLabel||"Bas"} : ${e.bottom_temp}<sup>\xB0</sup><span class="unit">C</span> / `),r&&(r.innerHTML=`${r.dataset.weatherLabel||"Haut"} : ${e.top_temp}<sup>\xB0</sup><span class="unit">C</span>`)}function $(n,e){const t=e.type||"openweathermap";if(c(n,"wind"),c(n,"humidity"),c(n,"wind_mf"),c(n,"sea_temp"),c(n,"iso_zero"),c(n,"snow_rain"),t==="meteofrance"){e.wind!=null&&e.wind!==""&&u(n,"wind_mf",`${e.wind_dir?`${e.wind_dir} `:""}${e.wind}`,"km/h"),e.sea_temp!=null&&e.sea_temp!==""&&S(n,"sea_temp",e.sea_temp);return}if(t==="meteofrancemountain"){u(n,"iso_zero",e.iso_zero??"-","m",e.iso_zero==null),u(n,"snow_rain",e.snow_rain??"-","m",e.snow_rain==null);return}e.wind!=null&&e.wind!==""&&u(n,"wind",e.wind,"km/h"),e.humidity!=null&&e.humidity!==""&&u(n,"humidity",g(e.humidity),"%")}function g(n){if(n==null||n==="")return n;const e=Number(n);if(Number.isNaN(e))return n;const t=Math.round(e*10)/10;return Number.isInteger(t),t}function c(n,e){const t=n.querySelector(`[data-weather-field="${e}"]`);t&&(t.hidden=!0)}function u(n,e,t,i,r=!1){const o=n.querySelector(`[data-weather-field="${e}"]`);if(!o)return;if(!r&&(t==null||t==="")){o.hidden=!0;return}o.hidden=!1;const a=o.dataset.weatherLabel||"";o.innerHTML=`${a} : ${t}<span class="unit">${i}</span>`}function S(n,e,t){const i=n.querySelector(`[data-weather-field="${e}"]`);if(!i)return;i.hidden=!1;const r=i.dataset.weatherLabel||"";i.innerHTML=`${r} : ${t}<sup>\xB0</sup><span class="unit">C</span>`}function q(n,e){!n.hasAttribute("data-weather-bg-img")||!e||(n.style.background=`url('${e}') center bottom / cover`)}function L(n,e){Object.entries(e).forEach(([t,i])=>{const r=n.querySelector(`[data-weather-detail="${t}"]`);r&&(f(r,"name",i.name),p(r,"icon",i.icon),h(r,"temp",i.temp))})}export{M as hydrateBlock};

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.