Build Mission Core Promo around 15 applied solutions

This commit is contained in:
DCCONSTRUCTIONS
2026-11-05 23:36:17 +03:00
parent 1265bd11e1
commit 1b4fe33957
41 changed files with 5157 additions and 453 deletions
+11
View File
@@ -437,6 +437,15 @@ function withLandingTarget(html, block) {
return `<span id="${escapeAttr(target)}" class="landing-target" aria-hidden="true"></span>${html}`;
}
function safeArticleHref(value) {
const href = typeof value === "string" ? value.trim() : "";
if (!href || /[\u0000-\u001f\u007f]/.test(href)) return "";
try {
const url = new URL(href, "https://nodedc.ru/");
return ["http:", "https:"].includes(url.protocol) && !url.username && !url.password ? href : "";
} catch { return ""; }
}
async function renderBlock(block, renderCounts) {
if (block.enabled === false) {
return "";
@@ -448,6 +457,8 @@ async function renderBlock(block, renderCounts) {
block = { ...block, content: { mediaKind: "", note: "", modules: [], openImagesInFullscreen: false, ...block.content } };
block.content.sliderItems = (block.content.sliderItems || []).map(item => ({
description: "", imageSrc: "", imageAlt: "", videoSrc: "", posterSrc: "", ...item,
detailsHref: safeArticleHref(item.detailsHref),
detailsLabel: typeof item.detailsLabel === "string" && item.detailsLabel.trim() ? item.detailsLabel.trim() : "Подробнее",
imageLinkEnabled: block.content.openImagesInFullscreen === true,
imageLinkDisabled: block.content.openImagesInFullscreen !== true,
}));