Compare commits
2 commits
777ebd8e4b
...
e7391dbbfe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7391dbbfe | ||
|
|
bd6d406584 |
BIN
beta/desk-dashboard-light.png
Normal file
|
After Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 106 KiB |
BIN
beta/desk-differences-light.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 62 KiB |
BIN
beta/desk-disks-light.png
Normal file
|
After Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 89 KiB |
BIN
beta/desk-recovery-light.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 65 KiB |
BIN
beta/desk-settings-light.png
Normal file
|
After Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 101 KiB |
BIN
beta/desk-smart-light.png
Normal file
|
After Width: | Height: | Size: 112 KiB |
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 108 KiB |
BIN
beta/desk-tasks-light.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 72 KiB |
BIN
beta/phone-dashboard-light.png
Normal file
|
After Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 228 KiB After Width: | Height: | Size: 111 KiB |
BIN
beta/phone-differences-light.png
Normal file
|
After Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 120 KiB |
BIN
beta/phone-disks-light.png
Normal file
|
After Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 262 KiB After Width: | Height: | Size: 131 KiB |
BIN
beta/phone-menu-light.png
Normal file
|
After Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 102 KiB |
BIN
beta/phone-recovery-light.png
Normal file
|
After Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 183 KiB After Width: | Height: | Size: 97 KiB |
BIN
beta/phone-settings-light.png
Normal file
|
After Width: | Height: | Size: 147 KiB |
|
Before Width: | Height: | Size: 238 KiB After Width: | Height: | Size: 149 KiB |
BIN
beta/phone-smart-light.png
Normal file
|
After Width: | Height: | Size: 123 KiB |
|
Before Width: | Height: | Size: 258 KiB After Width: | Height: | Size: 121 KiB |
BIN
beta/phone-tasks-light.png
Normal file
|
After Width: | Height: | Size: 89 KiB |
|
Before Width: | Height: | Size: 190 KiB After Width: | Height: | Size: 90 KiB |
|
|
@ -12,6 +12,44 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
// Theme Switcher Event Listeners
|
||||
const themeToggles = document.querySelectorAll('.theme-toggle');
|
||||
|
||||
function updateThemeImages(isLight) {
|
||||
const updateUrl = (url) => {
|
||||
if (!url) return url;
|
||||
const isTarget = url.includes('desk-') || url.includes('phone-');
|
||||
if (!isTarget) return url;
|
||||
|
||||
if (isLight) {
|
||||
if (!url.includes('-light.png')) {
|
||||
return url.replace('.png', '-light.png');
|
||||
}
|
||||
} else {
|
||||
if (url.includes('-light.png')) {
|
||||
return url.replace('-light.png', '.png');
|
||||
}
|
||||
}
|
||||
return url;
|
||||
};
|
||||
|
||||
document.querySelectorAll('img').forEach(img => {
|
||||
const src = img.getAttribute('src');
|
||||
if (src) {
|
||||
const newSrc = updateUrl(src);
|
||||
if (newSrc !== src) img.setAttribute('src', newSrc);
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelectorAll('.ui-shot').forEach(shot => {
|
||||
const largeSrc = shot.getAttribute('data-large');
|
||||
if (largeSrc) {
|
||||
const newSrc = updateUrl(largeSrc);
|
||||
if (newSrc !== largeSrc) shot.setAttribute('data-large', newSrc);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Initial call to set correct images based on current theme
|
||||
updateThemeImages(document.documentElement.classList.contains('light-theme'));
|
||||
|
||||
themeToggles.forEach(toggle => {
|
||||
toggle.addEventListener('click', () => {
|
||||
document.documentElement.classList.add('theme-transitioning');
|
||||
|
|
@ -26,6 +64,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
|
||||
const isLight = document.documentElement.classList.contains('light-theme');
|
||||
localStorage.setItem('theme', isLight ? 'light' : 'dark');
|
||||
updateThemeImages(isLight);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||