// Legacy widget tracking functionality (function () { // Tracking function const trackEvent = async (eventType) => {}; // Legacy branding element const brandingElement = document.createElement("div"); brandingElement.innerHTML = `

Your Feed Embed has expired.

If you’re the owner of this site, please create your new embed on Supascribe.

Create New Embed →
; `; // Function to add branding const addBranding = () => { try { const widgetContainer = document.querySelectorAll("#substack-feed-embed"); widgetContainer.forEach((container) => { if (container.querySelector(".csw-branding")) { container.removeChild(container.querySelector(".csw-branding")); } container.appendChild(brandingElement); }); } catch (error) { console.error("Error adding branding element:", error); } }; // Set up MutationObserver const observer = new MutationObserver((mutations) => { mutations.forEach((mutation) => { if (mutation.type === "childList" && mutation.addedNodes.length > 0) { // Check if the widget has loaded by looking for specific elements const widgetContainer = document.querySelectorAll( "#substack-feed-embed" ); if (widgetContainer && widgetContainer?.children?.length > 0) { addBranding(); observer.disconnect(); // Stop observing once branding is added } } }); }); // Start observing const widgetContainer = document.querySelectorAll("#substack-feed-embed"); if (widgetContainer.length > 0) { widgetContainer.forEach((container) => { observer.observe(container, { childList: true, subtree: true, }); }); } // Fallback: try to add branding after a short delay setTimeout(() => { widgetContainer.forEach((container) => { if (!container.querySelector(".csw-branding")) { addBranding(); observer.disconnect(); } }); }, 1000); // Track initial view trackEvent("view"); })();