From 3b83905603d44b1a08f8b2b36a605808ce686ad6 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 02 Jun 2026 00:46:48 +0000
Subject: [PATCH] =double checking schema outputs for legacytattooremoval
---
src/video/view.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/src/video/view.js b/src/video/view.js
new file mode 100644
index 0000000..76bcd1a
--- /dev/null
+++ b/src/video/view.js
@@ -0,0 +1,47 @@
+/** view.js **/
+document.addEventListener("DOMContentLoaded", function () {
+ const lazyVideos = [].slice.call(
+ document.querySelectorAll(".video-container video")
+ );
+
+ // Build a helper to actually set sources + load
+ function loadVideo(video) {
+ const sources = video.querySelectorAll("source[data-src]");
+ sources.forEach(source => {
+ source.src = source.dataset.src;
+ });
+ video.load();
+ }
+
+ // --- 1. IntersectionObserver (best case) ---
+ if ("IntersectionObserver" in window) {
+ const lazyVideoObserver = new IntersectionObserver(
+ function (entries, observer) {
+ entries.forEach(entry => {
+ if (entry.isIntersecting) {
+ loadVideo(entry.target);
+ observer.unobserve(entry.target);
+ }
+ });
+ },
+ {
+ rootMargin: "200px 0px",
+ threshold: 0.1,
+ }
+ );
+
+ lazyVideos.forEach(video => lazyVideoObserver.observe(video));
+ return;
+ }
+
+ // --- 2. Fallback: requestIdleCallback ---
+ if ("requestIdleCallback" in window) {
+ requestIdleCallback(() => {
+ lazyVideos.forEach(video => loadVideo(video));
+ });
+ return;
+ }
+
+ // --- 3. Final fallback: load immediately ---
+ lazyVideos.forEach(video => loadVideo(video));
+});
--
Gitblit v1.10.0