|
|
@@ -14,6 +14,26 @@ function A1home() {
|
|
|
document.head.appendChild(script)
|
|
|
script.onload = () => {
|
|
|
setLodingJs(lodingJs + 1)
|
|
|
+ if (lodingJs === scriptArr.length - 1) {
|
|
|
+ const checkAndToggleVolume = () => {
|
|
|
+ const dom = document.querySelector('#volume a') as HTMLAnchorElement | null
|
|
|
+ if (dom) {
|
|
|
+ const img = dom.querySelector('img') as HTMLImageElement | null
|
|
|
+ if (img && img.src.includes('btn_on')) {
|
|
|
+ console.log('检测到静音状态,自动点击开启')
|
|
|
+ dom.click()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 没找到就继续等
|
|
|
+ setTimeout(checkAndToggleVolume, 1000)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 初始检查 + 每秒检查一次(最多等 30 秒)
|
|
|
+ checkAndToggleVolume()
|
|
|
+ const timer = setInterval(checkAndToggleVolume, 1000)
|
|
|
+ setTimeout(() => clearInterval(timer), 30000)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}, [lodingJs])
|