ournet.links
Version:
49 lines (48 loc) • 1.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const WI_HOST = "//wi.ournetcdn.net";
const ASSETS_HOST = "//assets.ournetcdn.net";
const MEDIA_HOST = "//media.ournetcdn.net";
exports.wi = {
stories: function (size, id) {
return (WI_HOST +
"/stories/" +
id.substring(0, 4) +
"/" +
size +
"/" +
id +
".jpg");
},
news: function (size, id) {
return (WI_HOST + "/news/" + id.substring(0, 4) + "/" + size + "/" + id + ".jpg");
}
};
const COUNTRY_MAP = {
md: "click",
pl: "diez",
al: "moti2",
ru: "zborg",
lv: "meteo2",
kz: "meteo2",
vn: "thoi"
};
exports.assets = {
img: {
logo: function (nameOrCountry) {
if (nameOrCountry && nameOrCountry.length === 2) {
nameOrCountry = COUNTRY_MAP[nameOrCountry] || "ournet";
}
nameOrCountry = nameOrCountry || "ournet";
return ASSETS_HOST + "/ournet/img/logos/" + nameOrCountry + "-logo.png";
}
}
};
exports.media = {
image: function (id, { size, ext } = {}) {
size = size || "";
ext = ext || { j: "jpeg", w: "webp", p: "png" }[id[id.length - 1]];
return (MEDIA_HOST +
["/images", size, `${id}.${ext}`].filter((it) => !!it).join("/"));
}
};