fix: load CSS for floating button on blog sites to restore position and styling

This commit is contained in:
Russell Ballestrini 2025-07-10 06:56:56 -04:00
parent 3f9cb2c40f
commit a1a53fcf07

View file

@ -324,6 +324,18 @@ export function createFloatingAIButton() {
// Ensure ChunkFive font is loaded
initializeChunkFiveFont();
// Load CSS for floating button if not already loaded
const hasPicoCSS = document.querySelector('link[href*="pico"]') !== null;
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 = `https://uncloseai.com/src/${cssFile}`;
document.head.appendChild(link);
console.log(`uncloseai.js: Loaded ${cssFile} for floating button styles.`);
}
// Remove any existing floating button first
const existingButton = document.getElementById("floating-ai-button");
if (existingButton) {