Update NODEDC admin content and modules

This commit is contained in:
dcconstructions
2026-06-27 11:01:11 +03:00
parent 69e2b05fc2
commit bc0da49506
24 changed files with 1320 additions and 1049 deletions
File diff suppressed because one or more lines are too long
+63 -2
View File
@@ -10,6 +10,8 @@
const DEFAULT_SCROLL_SPEED = 0.55;
const ADAPTIVE_VIDEO_BOUND_FLAG = "__nodedcAdaptiveVideoBound";
const MEDIA_HANDLE_BOUND_FLAG = "__nodedcMediaHandleBound";
const DOCK_LINK_BOUND_FLAG = "__nodedcDockLinkBound";
const ORDERED_SLIDER_BOUND_FLAG = "__nodedcOrderedSliderBound";
const IMAGE_EXTENSIONS = new Set(["avif", "gif", "jpeg", "jpg", "png", "svg", "webp"]);
const VIDEO_EXTENSIONS = new Set(["m4v", "mov", "mp4", "webm"]);
@@ -226,11 +228,62 @@
}
function bindInteractiveScroll() {
bindGlobalSliderWheel();
document.querySelectorAll('[data-module="slider"]').forEach(bindSliderWheel);
document.querySelectorAll('[data-module="mail-list"]').forEach(bindMailListWheel);
}
function bindOrderedSlider(surface) {
if (!surface || surface[ORDERED_SLIDER_BOUND_FLAG]) return;
const slider = surface.__nodedcSlider;
if (!slider) return;
surface[ORDERED_SLIDER_BOUND_FLAG] = true;
const items = Array.from(surface.children);
const startOffset = items.length > 1 ? -1 : 0;
slider.config.infinite = true;
slider.target = startOffset;
slider.current = startOffset;
slider.speed = 0;
items.forEach((item) => {
item.classList.remove("current");
});
slider.resize?.();
slider.update?.();
}
function bindOrderedSliders() {
document.querySelectorAll('[data-module="slider"][data-admin-order="true"]').forEach(bindOrderedSlider);
}
function bindDockLink(link) {
if (!link || link[DOCK_LINK_BOUND_FLAG]) return;
link[DOCK_LINK_BOUND_FLAG] = true;
link.addEventListener(
"click",
(event) => {
const href = String(link.getAttribute("href") || "").trim();
const targetId = String(link.dataset.target || "").trim();
const hasAppTarget = Boolean(targetId && document.getElementById(targetId));
const isInertHref = !href || href === "#" || href === "#hero" || href.toLowerCase().startsWith("javascript:");
if (!hasAppTarget && !isInertHref) return;
event.preventDefault();
window.requestAnimationFrame(() => link.blur());
if (!hasAppTarget) event.stopPropagation();
},
{ capture: true },
);
}
function bindDockLinks() {
document.querySelectorAll('[data-module="dock"] a[data-app]').forEach(bindDockLink);
}
function mediaExtension(src) {
const cleanSrc = String(src || "").split(/[?#]/)[0];
const match = /\.([a-z0-9]+)$/i.exec(cleanSrc);
@@ -313,6 +366,8 @@
() => {
hydrateMediaHandles();
bindInteractiveScroll();
bindOrderedSliders();
bindDockLinks();
bindAdaptiveVideos();
},
{ once: true },
@@ -320,16 +375,22 @@
} else {
hydrateMediaHandles();
bindInteractiveScroll();
bindOrderedSliders();
bindDockLinks();
bindAdaptiveVideos();
}
window.addEventListener("load", () => {
hydrateMediaHandles();
bindInteractiveScroll();
bindOrderedSliders();
bindDockLinks();
bindAdaptiveVideos();
window.setTimeout(() => {
hydrateMediaHandles();
bindInteractiveScroll();
bindOrderedSliders();
bindDockLinks();
bindAdaptiveVideos();
}, 500);
});