( node: HTMLElement, isCache: boolean = false )
| 110 | |
| 111 | // 插入加载动画 |
| 112 | export function insertLoadingSpinner( |
| 113 | node: HTMLElement, |
| 114 | isCache: boolean = false |
| 115 | ): HTMLElement { |
| 116 | const spinner = document.createElement("span"); |
| 117 | spinner.className = "fluent-read-loading"; |
| 118 | if (isCache) spinner.style.borderTop = "3px solid green"; // 存在缓存时改为绿色 |
| 119 | |
| 120 | // 异步检查动画配置 |
| 121 | import('@/entrypoints/utils/config').then(({ config }) => { |
| 122 | if (!config.animations && !spinner.classList.contains('static')) { |
| 123 | spinner.classList.add('static'); |
| 124 | } |
| 125 | }).catch(() => { |
| 126 | // 忽略错误,使用默认动画 |
| 127 | }); |
| 128 | |
| 129 | node.appendChild(spinner); |
| 130 | return spinner; |
| 131 | } |
no outgoing calls
no test coverage detected