PageSourceSearch

https://www.thepfs.org/scripts/cii-CookieBlockingVideoWrapper.js?V=2026.9.2.1

js thepfs.org collected 2026-10-04 00:24:20 UTC 2,004 bytes, 63 lines download raw bytes

1(function () {
2
3    function getCookie(name) {
4        return document.cookie
5            .split('; ')
6            .find(row => row.startsWith(name + '='))
7            ?.split('=')[1] || null;
8    }
9
10    const consentGranted = getCookie("consentCookie") === "true";
11
12
13    const selectors = [
14        'iframe[src*="youtube.com"]',
15        'iframe[src*="youtu.be"]',
16        'iframe[src*="player.vimeo.com"]'
17    ];
18
19    document.addEventListener("DOMContentLoaded", () => {
20        document.querySelectorAll(selectors.join(',')).forEach(iframe => {
21
22            if (consentGranted) return;
23
24            const videoSrc = iframe.getAttribute("src");
25
26            // Build placeholder wrapper
27            const wrapper = document.createElement("div");
28            wrapper.className = "video-placeholder";
29
30            let thumbnailUrl = "/images/video-placeholder.jpg"; // fallback image
31            const isYouTube = videoSrc.includes("youtube") || videoSrc.includes("youtu.be");
32
33            if (isYouTube) {
34                const videoId = getYouTubeID(videoSrc);
35                if (videoId) {
36                    thumbnailUrl = `https://img.youtube.com/vi/${videoId}/hqdefault.jpg`;
37                }
38            }
39
40            // Placeholder markup
41            wrapper.innerHTML = `
42        <div class="video-thumb" style="background-image: url('${thumbnailUrl}')">
43          <div class="video-play-button">▶</div>
44        </div>
45      `;
46
47            // Clicking opens external video (no cookies on your domain)
48            wrapper.addEventListener("click", () => {
49                window.open(videoSrc, "_blank");
50            });
51
52            // Replace original iframe
53            iframe.replaceWith(wrapper);
54        });
55    });
56
57    // Extract video ID from YT URL
58    function getYouTubeID(url) {
59        const match = url.match(/(?:youtube\.com.*[?&]v=|youtu\.be\/)([^&?/]+)/);
60        return match ? match[1] : "";
61    }
62
63})();

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.