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
This commit is contained in:
parent
c65bde327c
commit
761c4ec259
1 changed files with 4 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue