|
12 | 12 | // @updateURL https://github.com/Write/TangerineUI-Userscript/raw/main/TangerineUI.user.js |
13 | 13 | // @homepageURL https://github.com/Write/TangerineUI-Userscript |
14 | 14 | // @grant none |
15 | | -// @version 2.2.4.1 |
| 15 | +// @version 2.2.4.2 |
16 | 16 | // @author @Write on Github for the UserScript |
17 | 17 | // @author @nileane for TangerineUI's CSS |
18 | 18 | // @run-at document-start |
|
22 | 22 | /* ---------------- |
23 | 23 | * SETTINGS |
24 | 24 | * ---------------- */ |
| 25 | + /* Default themes for hosts not configured in perHostThemes */ |
| 26 | + /* These will be used as fallback for any Mastodon instance not explicitly configured below */ |
| 27 | + /* Available themes: 'tangerine', 'purple', 'cherry', 'lagoon' */ |
| 28 | + const defaultThemes = { |
| 29 | + legacy: 'tangerine', // For versions < 4.3.0 |
| 30 | + modern: 'cherry' // For versions >= 4.3.0 |
| 31 | + }; |
| 32 | + |
25 | 33 | /* Per-host theme configuration */ |
26 | 34 | /* Set specific themes for different Mastodon instances */ |
27 | 35 | /* Available themes: 'tangerine', 'purple', 'cherry', 'lagoon' */ |
|
53 | 61 | // Add more hosts as needed |
54 | 62 | }; |
55 | 63 |
|
56 | | - /* Default fallback themes (used if host is not configured above) */ |
57 | | - /* colorScheme used for older (< 4.3) instances */ |
58 | | - /* Either 'tangerine' or 'purple' */ |
59 | | - const legacyColorScheme = 'tangerine'; |
60 | | - /* colorScheme used for new (>= 4.3) instances */ |
61 | | - /* Either 'tangerine', 'purple', 'cherry' or 'lagoon' */ |
62 | | - const colorScheme = 'cherry'; |
| 64 | + /* Legacy fallback variables (kept for compatibility) */ |
| 65 | + /* These are now derived from defaultThemes above */ |
| 66 | + const legacyColorScheme = defaultThemes.legacy; |
| 67 | + const colorScheme = defaultThemes.modern; |
63 | 68 | /* Github tags to use for different mastodon version ranges |
64 | 69 | /* To find tags name, go here : https://github.com/nileane/TangerineUI-for-Mastodon/releases |
65 | 70 | /* and look at the tag name in the left sidebar of the release |
|
86 | 91 | log(`Using ${isLegacy ? 'legacy' : 'modern'} theme '${selectedTheme}' for host: ${currentHost}`); |
87 | 92 | return selectedTheme; |
88 | 93 | } else { |
89 | | - const fallbackTheme = isLegacy ? legacyColorScheme : colorScheme; |
90 | | - log(`Host '${currentHost}' not configured, using fallback ${isLegacy ? 'legacy' : 'modern'} theme: ${fallbackTheme}`); |
| 94 | + const fallbackTheme = isLegacy ? defaultThemes.legacy : defaultThemes.modern; |
| 95 | + log(`Host '${currentHost}' not configured, using default ${isLegacy ? 'legacy' : 'modern'} theme: ${fallbackTheme}`); |
91 | 96 | return fallbackTheme; |
92 | 97 | } |
93 | 98 | } |
|
0 commit comments