PageSourceSearch

https://thuonghieusanpham.vn/frontend/js/thoitiet.js?v=1791183904

js thuonghieusanpham.vn collected 2026-10-05 07:05:34 UTC 1,406 bytes, 39 lines download raw bytes

1(async function loadHanoiWeather() {
2    const lat = 21.0285;
3    const lon = 105.8542;
4
5    const url = `https://api.open-meteo.com/v1/forecast?
6        latitude=${lat}
7        &longitude=${lon}
8        &current_weather=true
9        &daily=temperature_2m_max,temperature_2m_min
10        &timezone=Asia%2FBangkok`.replace(/\s+/g, '');
11
12    const res = await fetch(url);
13    const data = await res.json();
14
15    const cur = Math.round(data.current_weather.temperature);
16    const min = Math.round(data.daily.temperature_2m_min[0]);
17    const max = Math.round(data.daily.temperature_2m_max[0]);
18    const code = data.current_weather.weathercode;
19    const isDay = data.current_weather.is_day;
20
21    document.querySelector('#w-temp').innerHTML =
22        `<em>${cur}°C</em> / ${min} - ${max}°C`;
23
24    document.querySelector('#w-icon').src = getWeatherIcon(code, isDay);
25})();
26
27function getWeatherIcon(code, isDay) {
28    // map icon giống 1cdn (đơn giản)
29    if (code === 0) return icon(isDay, 113);        // nắng
30    if ([1,2,3].includes(code)) return icon(isDay, 116); // mây
31    if ([45,48].includes(code)) return icon(isDay, 248); // sương
32    if ([61,63,65,80,81,82].includes(code)) return icon(isDay, 296); // mưa
33    return icon(isDay, 116);
34}
35
36function icon(isDay, code) {
37    const time = isDay ? 'day' : 'night';
38    return `https://asset.1cdn.vn/all/weather/64x64/${time}/${code}.png`;
39}

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.