PageSourceSearch

https://verstka.media/wp-content/mu-plugins/verstka-youtube/assets/modal.js?ver=1.0.0

js verstka.media collected 2026-09-24 08:23:55 UTC 1,698 bytes, 61 lines download raw bytes

1(function () {
2	"use strict";
3
4	var modal = document.getElementById("vm-yt-modal");
5	if (!modal) return;
6
7	var backdrop = modal.querySelector(".vm-yt-modal__backdrop");
8	var closeBtn = modal.querySelector(".vm-yt-modal__close");
9	var iframe = modal.querySelector(".vm-yt-modal__iframe");
10
11	function open(videoId) {
12		if (!videoId) return;
13		var src = "https://www.youtube.com/embed/" + videoId + "?autoplay=1";
14		iframe.src = src;
15		modal.removeAttribute("hidden");
16		document.body.style.overflow = "hidden";
17		closeBtn.focus();
18	}
19
20	function close() {
21		iframe.src = "";
22		modal.setAttribute("hidden", "");
23		document.body.style.overflow = "";
24	}
25
26	function handleClose() {
27		close();
28	}
29
30	closeBtn.addEventListener("click", handleClose);
31	backdrop.addEventListener("click", handleClose);
32
33	modal.addEventListener("keydown", function (e) {
34		if (e.key === "Escape" && !modal.hasAttribute("hidden")) {
35			close();
36		}
37	});
38
39	document.addEventListener(
40		"click",
41		function (e) {
42			var trigger = e.target.closest("[data-video-id]");
43			if (!trigger) return;
44			// Только левый клик без Ctrl/Cmd — открываем попап; иначе ссылка сработает (новая вкладка и т.д.)
45			if (e.button !== 0 || e.ctrlKey || e.metaKey) return;
46			e.preventDefault();
47			var id = trigger.getAttribute("data-video-id").trim();
48			if (id) open(id);
49		},
50		true,
51	);
52
53	document.addEventListener("keydown", function (e) {
54		var trigger = e.target.closest("[data-video-id]");
55		if (!trigger || (e.key !== "Enter" && e.key !== " ")) return;
56		var id = trigger.getAttribute("data-video-id").trim();
57		if (!id) return;
58		e.preventDefault();
59		open(id);
60	});
61})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.