|
1 | 1 | ; (async () => { |
2 | | - // Base URL configuration - checks localStorage first, falls back to GitHub |
3 | | - const getBaseUrl = () => { |
4 | | - try { |
5 | | - const customBaseUrl = localStorage.getItem('wplace-autobot-base-url'); |
6 | | - if (customBaseUrl) { |
7 | | - return customBaseUrl.endsWith('/') ? customBaseUrl.slice(0, -1) : customBaseUrl; |
8 | | - } |
9 | | - } catch (e) { |
10 | | - console.warn('Could not access localStorage for base URL:', e); |
11 | | - } |
12 | | - return 'https://raw.githubusercontent.com/Wplace-AutoBot/WPlace-AutoBOT/main'; |
13 | | - }; |
14 | | - |
15 | 2 | // CONFIGURATION CONSTANTS |
16 | 3 | const CONFIG = { |
17 | 4 | COOLDOWN_DEFAULT: 31000, |
@@ -296,8 +283,8 @@ function applyTheme() { |
296 | 283 | return loadedTranslations[language]; |
297 | 284 | } |
298 | 285 |
|
299 | | - // Load translations using base URL (checks localStorage, falls back to GitHub) |
300 | | - const url = `${getBaseUrl()}/decoupled-translations/lang/${language}.json`; |
| 286 | + // Load translations from CDN |
| 287 | + const url = `https://staninna.github.io/WPlace-AutoBOT/decoupled-translations/lang/${language}.json`; |
301 | 288 | const maxRetries = 3; |
302 | 289 | const baseDelay = 1000; // 1 second |
303 | 290 |
|
@@ -2742,20 +2729,10 @@ function applyTheme() { |
2742 | 2729 | // Link external CSS files |
2743 | 2730 | const cssLink = document.createElement('link'); |
2744 | 2731 | cssLink.rel = 'stylesheet'; |
2745 | | - cssLink.href = `${getBaseUrl()}/auto-image-styles.css`; |
| 2732 | + 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 |
2746 | 2733 | cssLink.setAttribute('data-wplace-theme', 'true'); |
2747 | 2734 | document.head.appendChild(cssLink); |
2748 | 2735 |
|
2749 | | - // Dynamically load theme CSS files using base URL |
2750 | | - const themeFiles = ['classic.css', 'classic-light.css', 'neon.css']; |
2751 | | - themeFiles.forEach(themeFile => { |
2752 | | - const themeLink = document.createElement('link'); |
2753 | | - themeLink.rel = 'stylesheet'; |
2754 | | - themeLink.href = `${getBaseUrl()}/themes/${themeFile}`; |
2755 | | - themeLink.setAttribute('data-wplace-theme-file', themeFile); |
2756 | | - document.head.appendChild(themeLink); |
2757 | | - }); |
2758 | | - |
2759 | 2736 | const container = document.createElement("div") |
2760 | 2737 | container.id = "wplace-image-bot-container" |
2761 | 2738 | container.innerHTML = ` |
|
0 commit comments