| 186 | * @deprecated Use initRandomBackground from backgroundConfig.js instead |
| 187 | */ |
| 188 | export function initRandomBackground(selector = '.desktop') { |
| 189 | // Retained for backwards compatibility; prefer importing from backgroundConfig.js |
| 190 | import('./backgroundConfig.js').then(({ initRandomBackground: init }) => { |
| 191 | init(selector); |
| 192 | }).catch(() => { |
| 193 | // Fallback: inline implementation if the module import fails |
| 194 | try { |
| 195 | const desktop = document.querySelector(selector); |
| 196 | if (!desktop) return; |
| 197 | const apiPool = [ |
| 198 | 'https://t.alcy.cc/ycy', 'https://t.alcy.cc/moez', 'https://t.alcy.cc/ysz', |
| 199 | 'https://t.alcy.cc/pc', 'https://t.alcy.cc/moe', 'https://t.alcy.cc/fj', |
| 200 | 'https://t.alcy.cc/bd', 'https://t.alcy.cc/ys', 'https://t.alcy.cc/lai' |
| 201 | ]; |
| 202 | desktop.style.backgroundImage = `url("${apiPool[Math.floor(Math.random() * apiPool.length)]}")`; |
| 203 | } catch (_) {} |
| 204 | }); |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * Format a file size value |