PHP 8.2.30
Preview: ProcessContent.js Size: 1.04 KB
//proc/thread-self/root/home/byroehnu/easetack.com/resources/js/utils/ProcessContent.js

export default function ProcessContent(html) {
    const div = document.createElement('div');
    div.innerHTML = html; // Directly set the raw HTML

    // Find all <oembed> tags and replace them with <iframe>
    const embeds = div.querySelectorAll('oembed');
    embeds.forEach((embed) => {
        const url = embed.getAttribute('url') || embed.getAttribute('src'); // Extract URL
        if (url) {
            const iframe = document.createElement('iframe');
            iframe.setAttribute('src', url);
            iframe.setAttribute('width', '100%');
            iframe.setAttribute('height', '400');
            iframe.setAttribute('frameBorder', '0');
            iframe.setAttribute(
                'allow',
                'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture'
            );
            iframe.setAttribute('allowFullScreen', true);
            embed.parentNode.replaceChild(iframe, embed); // Replace <oembed> with <iframe>
        }
    });

    return div.innerHTML; // Return the processed HTML
}

Directory Contents

Dirs: 0 × Files: 7

Name Size Perms Modified Actions
1.10 KB lrw-rw-rw- 2025-05-01 06:16:19
Edit Download
378 B lrw-rw-rw- 2025-04-09 10:29:01
Edit Download
206 B lrw-rw-rw- 2025-04-08 04:12:57
Edit Download
664 B lrw-rw-rw- 2025-04-08 04:12:57
Edit Download
1.04 KB lrw-rw-rw- 2025-04-08 04:12:57
Edit Download
156 B lrw-rw-rw- 2025-04-08 04:12:57
Edit Download
253 B lrw-rw-rw- 2025-04-08 04:12:57
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).