// hf-fix.js (ROOT) // Chặn lỗi "No response from server" bằng cách ép provinces dùng file local provinces.json (() => { const LOG = "[C2M-FIX]"; const nativeFetch = window.fetch.bind(window); const isProvincesUrl = (u) => { try { const url = new URL(u, location.href); const p = url.pathname || ""; return ( p.endsWith("/provinces") || p.endsWith("/api/provinces") || p.includes("/provinces?") ); } catch { const s = String(u || ""); return s.includes("provinces"); } }; window.fetch = function patchedFetch(input, init) { const url = typeof input === "string" ? input : (input && input.url) || ""; // Ép mọi call provinces về local file if (isProvincesUrl(url)) { console.info(`${LOG} redirect provinces -> ./provinces.json`); return nativeFetch("./provinces.json", { cache: "no-store" }); } return nativeFetch(input, init); }; console.info(`${LOG} installed (root, no folders).`); })();