From 761c4ec2596618c869b2d50f7c6430b02f55db9b Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Wed, 9 Jul 2025 16:21:40 -0400 Subject: [PATCH] debug: add console logging to CSS inlining for translated pages - Add logging to see how many CSS links are found - Log each CSS file being inlined and success/failure - Help diagnose why translated pages may not have modal styling --- src/translation.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/translation.js b/src/translation.js index c5f8a12..d12b184 100644 --- a/src/translation.js +++ b/src/translation.js @@ -379,10 +379,12 @@ export async function translateCurrentPage(targetLanguage) { doc.body.innerHTML = translatedContent; // Inline any external CSS that might be needed for the new window - const cssLinks = doc.querySelectorAll('link[rel="stylesheet"][href*="uncloseai"]'); + const cssLinks = doc.querySelectorAll('link[rel="stylesheet"][href*="uncloseai-modal"]'); + console.log('Found CSS links to inline:', cssLinks.length); for (const link of cssLinks) { try { + console.log('Inlining CSS:', link.href); const response = await fetch(link.href); const cssContent = await response.text(); @@ -392,6 +394,7 @@ export async function translateCurrentPage(targetLanguage) { // Replace the link with the inline style link.parentNode.replaceChild(styleElement, link); + console.log('Successfully inlined CSS:', link.href); } catch (error) { console.warn('Failed to inline CSS:', link.href, error); // Keep the original link if fetching fails