Skip to content

Commit

Permalink
fix: 有时候网页全屏模式无法正确显示sc的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
eeelester committed Oct 7, 2024
1 parent b818542 commit dd2a625
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ stats.html
stats-*.json
.wxt
web-ext.config.ts
.env.submit
.env.submit*

# Editor directories and files
.vscode/*
Expand Down
22 changes: 10 additions & 12 deletions entrypoints/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dd2a625

Please sign in to comment.