PageSourceSearch

https://stpauleye.com/wp-content/plugins/custom-iframe/assets/js/widget.js?ver=2.0.3

js stpauleye.com collected 2026-10-07 00:27:15 UTC 3,166 bytes, 87 lines download raw bytes

1// // Initialize for Elementor
2(function (elementor) {
3    'use strict';
4    window.addEventListener('elementor/frontend/init', function () {
5        elementorFrontend.hooks.addAction('frontend/element_ready/custif_iframe_widget.default', widgetIframe);
6    });
7
8}(window.elementorFrontend));
9
10// Initialize for Gutenberg / Standard
11document.addEventListener('DOMContentLoaded', function () {
12    var wrappers = document.querySelectorAll('.custif-iframe-wrapper');
13    wrappers.forEach(function (wrapper) {
14        // Skip if inside Elementor widget (handled by hook)
15        if (!wrapper.closest('.elementor-widget-custif_iframe_widget')) {
16            // Pass wrapper itself as scope[0] to our flexible function
17            widgetIframe([wrapper]);
18        }
19    });
20
21    // Observer for dynamic content (Gutenberg Editor)
22    var observer = new MutationObserver(function (mutations) {
23        mutations.forEach(function (mutation) {
24            mutation.addedNodes.forEach(function (node) {
25                if (node.nodeType === 1) { // Element node
26                    // Check if node itself is the wrapper
27                    if (node.classList && node.classList.contains('custif-iframe-wrapper')) {
28                        if (!node.closest('.elementor-widget-custif_iframe_widget')) {
29                            widgetIframe([node]);
30                        }
31                    }
32                    // Check descendants
33                    var children = node.querySelectorAll('.custif-iframe-wrapper');
34                    children.forEach(function (child) {
35                        if (!child.closest('.elementor-widget-custif_iframe_widget')) {
36                            widgetIframe([child]);
37                        }
38                    });
39                }
40            });
41        });
42    });
43
44    observer.observe(document.body, { childList: true, subtree: true });
45});
46
47function widgetIframe(scope) {
48    if (!scope || !scope[0]) {
49        return;
50    }
51
52    var iframe = scope[0].querySelector('.custif-iframe-wrapper > iframe');
53
54    // If iframe not found with default selector, try finding it directly (useful if scope IS the wrapper)
55    if (!iframe && scope[0].classList.contains('custif-iframe-wrapper')) {
56        iframe = scope[0].querySelector('iframe');
57    }
58
59    if (!iframe) {
60        return;
61    }
62
63    var autoHeight = iframe.dataset.autoHeight,
64        refreshInterval = iframe.dataset.refreshInterval ? parseInt(iframe.dataset.refreshInterval) : 0;
65
66    // Auto height only works when cross origin properly set
67    if (autoHeight === 'yes') {
68        try {
69            var resizeIframe = function () {
70                var height = iframe.contentDocument.querySelector('html').scrollHeight;
71                iframe.style.height = height + 'px';
72            };
73
74            iframe.addEventListener('load', resizeIframe);
75            resizeIframe(); // Try immediately
76        } catch (e) {
77            console.log('Cross origin iframe detected');
78        }
79    }
80
81    // Refresh interval
82    if (refreshInterval > 0) {
83        setInterval(() => {
84            iframe.src = iframe.src;
85        }, refreshInterval * 1000);
86    }
87}

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.