INNER CODE UNIT · JavaScript
classify
LeyckerS/moondownloader · web/app.js:184
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]));
/* Middle ellipsis: these filenames differ only in the last few characters, so
clipping the tail would make every row look identical. */
function elide(name, head = 34, tail = 22) {
if (name.length <= head + tail + 1) return name;
return name.slice(0, head) + "…" + name.slice(-tail);
}
/* Animated counter. The number is the thing the operator stares at; snapping it
between two values hides how fast it is actually moving. */
function roll(el, to, fmt) {