INNER CODE UNIT · JavaScript
s
LeyckerS/moondownloader · web/app.js:173
s = Math.max(0, Math.round(s));
if (!s) return "—";
if (s >= 3600) return `${Math.floor(s / 3600)}h ${String(Math.floor((s % 3600) / 60)).padStart(2, "0")}m`;
if (s >= 60) return `${Math.floor(s / 60)}m ${String(s % 60).padStart(2, "0")}s`;
return `${s}s`;
};
const fmtClock = (s) => `${Math.floor(s / 60)}m ${String(Math.floor(s % 60)).padStart(2, "0")}s`;
const hostOf = (url) => {
const m = /^[a-z]+:\/\/([^/?#]+)/i.exec(url.trim());
return m ? m[1].toLowerCase() : "";
};
const classify = (url) => {
const h = hostOf(url);
if (h.includes("datanodes.to")) return "dn";
if (h.includes("fuckingfast.co")) return "ff";
return "ot";
};
const escapeHtml = (s) => s.replace(/[&<>]/g, (c) => ({ "&": "&", "<": "<", ">": ">" }[c]));