diff --git a/.gitignore b/.gitignore index fe967cf..32e255e 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ stats.html stats-*.json .wxt web-ext.config.ts -.env.submit +.env.submit* # Editor directories and files .vscode/* diff --git a/entrypoints/content.tsx b/entrypoints/content.tsx index a88b6c8..e3d6718 100644 --- a/entrypoints/content.tsx +++ b/entrypoints/content.tsx @@ -39,19 +39,17 @@ export default defineContentScript({ true, ); - // 判断video出现的时机,用setTimeout主要是方便,mutationobserver监听iframe里的节点麻烦 - (function loop() { - setTimeout(function () { - const video = getVideoDom() - if (video) { - listenVideoSizeChange(video) - } else { - loop(); - } - }, 500); - })() - + // 判断video出现的时机,没用mutationobserver是因为监听iframe里的节点麻烦 + function loop() { + const video = getVideoDom() + if (video) { + listenVideoSizeChange(video) + } else { + window.requestAnimationFrame(loop); + } + } + window.requestAnimationFrame(loop); function mount(log: string) { if (isMount) return