fix: use consistent CSS loading pattern with PicoCSS detection and absolute URLs
This commit is contained in:
parent
bf9d7da770
commit
5157e37de8
2 changed files with 12 additions and 4 deletions
|
|
@ -6,12 +6,16 @@ import { translateCurrentPage, translateText, SUPPORTED_LANGUAGES } from "./tran
|
|||
|
||||
export function openTranslateModal() {
|
||||
// Load appropriate CSS based on whether we're using PicoCSS or built-in styles
|
||||
const cssFile = window.UNCLOSEAI_CUSTOM_STYLING !== false ? 'uncloseai-modal-pico.css' : 'uncloseai-modal-builtin.css';
|
||||
// Detect if PicoCSS is actually present on the page
|
||||
const hasPicoCSS = document.querySelector('link[href*="pico"]') !== null;
|
||||
|
||||
// Load appropriate CSS based on actual PicoCSS presence
|
||||
const cssFile = hasPicoCSS ? 'uncloseai-modal-pico.css' : 'uncloseai-modal-builtin.css';
|
||||
|
||||
if (!document.querySelector(`link[href*="${cssFile}"]`)) {
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = `./src/${cssFile}`;
|
||||
link.href = `https://uncloseai.com/src/${cssFile}`;
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,16 @@ import { handleFileUpload } from "./file-upload.js";
|
|||
// Create full chat interface
|
||||
export function createFullInterface(container) {
|
||||
// Load appropriate CSS based on whether we're using PicoCSS or built-in styles
|
||||
const cssFile = window.UNCLOSEAI_CUSTOM_STYLING !== false ? 'uncloseai-modal-pico.css' : 'uncloseai-modal-builtin.css';
|
||||
// Detect if PicoCSS is actually present on the page
|
||||
const hasPicoCSS = document.querySelector('link[href*="pico"]') !== null;
|
||||
|
||||
// Load appropriate CSS based on actual PicoCSS presence
|
||||
const cssFile = hasPicoCSS ? 'uncloseai-modal-pico.css' : 'uncloseai-modal-builtin.css';
|
||||
|
||||
if (!document.querySelector(`link[href*="${cssFile}"]`)) {
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = `./src/${cssFile}`;
|
||||
link.href = `https://uncloseai.com/src/${cssFile}`;
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue