From bcec4e5ebe4ab3426aa8146c7bd15cb0e0203ef2 Mon Sep 17 00:00:00 2001 From: MiraclePatrickLumowa Date: Sun, 31 Aug 2025 19:30:33 +0800 Subject: [PATCH] Revert "update urls && localStorage base url for extern files" --- Auto-Image.js | 28 +++------------------------- auto-image-styles.css | 6 ++++-- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/Auto-Image.js b/Auto-Image.js index 7714017..6f02bb9 100644 --- a/Auto-Image.js +++ b/Auto-Image.js @@ -1,17 +1,4 @@ ; (async () => { - // Base URL configuration - checks localStorage first, falls back to GitHub - const getBaseUrl = () => { - try { - const customBaseUrl = localStorage.getItem('wplace-bot-base-url'); - if (customBaseUrl) { - return customBaseUrl.endsWith('/') ? customBaseUrl.slice(0, -1) : customBaseUrl; - } - } catch (e) { - console.warn('Could not access localStorage for base URL:', e); - } - return 'https://raw.githubusercontent.com/Wplace-AutoBot/WPlace-AutoBOT/main'; - }; - // CONFIGURATION CONSTANTS const CONFIG = { COOLDOWN_DEFAULT: 31000, @@ -296,7 +283,8 @@ function applyTheme() { return loadedTranslations[language]; } - const url = `${getBaseUrl()}/lang/${language}.json`; + // Load translations from CDN + const url = `https://staninna.github.io/WPlace-AutoBOT/decoupled-translations/lang/${language}.json`; const maxRetries = 3; const baseDelay = 1000; // 1 second @@ -2742,20 +2730,10 @@ function applyTheme() { // Link external CSS files const cssLink = document.createElement('link'); cssLink.rel = 'stylesheet'; - cssLink.href = `${getBaseUrl()}/auto-image-styles.css`; + cssLink.href = 'https://staninna.github.io/WPlace-AutoBOT/decoupled-css/auto-image-styles.css'; // TODO: Before merge change to https://raw.githubusercontent.com/Wplace-AutoBot/WPlace-AutoBOT/refs/heads/main/auto-image-styles.css cssLink.setAttribute('data-wplace-theme', 'true'); document.head.appendChild(cssLink); - // Dynamically load theme CSS files using base URL - const themeFiles = ['classic.css', 'classic-light.css', 'neon.css']; - themeFiles.forEach(themeFile => { - const themeLink = document.createElement('link'); - themeLink.rel = 'stylesheet'; - themeLink.href = `${getBaseUrl()}/themes/${themeFile}`; - themeLink.setAttribute('data-wplace-theme-file', themeFile); - document.head.appendChild(themeLink); - }); - const container = document.createElement("div") container.id = "wplace-image-bot-container" container.innerHTML = ` diff --git a/auto-image-styles.css b/auto-image-styles.css index 4d70205..5406b16 100644 --- a/auto-image-styles.css +++ b/auto-image-styles.css @@ -7,8 +7,10 @@ /* Theme tokens (CSS vars) */ /* ========================= */ -/* Theme files are now loaded dynamically via JavaScript using the base URL from localStorage */ -/* See Auto-Image.js lines 2749-2757 for dynamic theme loading implementation */ +/* Import theme files - classic is default */ +@import url('https://staninna.github.io/WPlace-AutoBOT/decoupled-css/themes/classic.css'); +@import url('https://staninna.github.io/WPlace-AutoBOT/decoupled-css/themes/classic-light.css'); +@import url('https://staninna.github.io/WPlace-AutoBOT/decoupled-css/themes/neon.css'); /* Default :root CSS variables for 100% classic theme compliance */ /* These ensure the bot works perfectly even if theme files fail to load */