// Hide upgrade elements and enable video controls in AppFlowy self-hosted (function() { function hideElements() { // Hide "Upgrade to Pro Plan" from menu document.querySelectorAll('div[role="menuitem"]').forEach(item => { if (item.textContent.includes('Upgrade to Pro Plan')) { item.style.display = 'none'; } }); // Hide "Get AI Max" from menu document.querySelectorAll('div[role="menuitem"]').forEach(item => { if (item.textContent.includes('Get AI Max')) { item.style.display = 'none'; } }); // Hide "Visit our official website" document.querySelectorAll('div').forEach(item => { if (item.textContent.trim() === 'Visit our official website') { item.style.display = 'none'; } }); } function enableVideoControls() { // Enable controls on all HTML5 video elements (your working code!) document.querySelectorAll('video').forEach(video => { video.setAttribute('controls', true); video.removeAttribute('controlsList'); }); } function runAll() { hideElements(); enableVideoControls(); } // Run multiple times to catch dynamic content setTimeout(runAll, 100); setTimeout(runAll, 500); setTimeout(runAll, 1000); setTimeout(runAll, 2000); setTimeout(runAll, 3000); // Watch for DOM changes (menu opening, videos loading, etc) const observer = new MutationObserver(runAll); // Start observing when body is ready function startObserver() { if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); runAll(); // Run immediately when observer starts } else { setTimeout(startObserver, 100); } } // Start everything if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', startObserver); } else { startObserver(); } })();