MCPcopy
hub / github.com/88lin/video_vip / findTargetElement

Function findTargetElement

video_vip.user.js:63–81  ·  view source on GitHub ↗
(targetContainer)

Source from the content-addressed store, hash-verified

61 let mediaPlayBlocked = false;
62
63 function findTargetElement(targetContainer) {
64 const body = window.document;
65 let tabContainer;
66 let tryTime = 0;
67 const maxTryTime = 120;
68 return new Promise((resolve, reject) => {
69 let interval = setInterval(() => {
70 tabContainer = body.querySelector(targetContainer);
71 if (tabContainer) {
72 clearInterval(interval);
73 resolve(tabContainer);
74 }
75 if ((++tryTime) === maxTryTime) {
76 clearInterval(interval);
77 reject();
78 }
79 }, 500);
80 });
81 }
82
83 function urlChangeReload() {
84 const oldHref = window.location.href;

Callers 1

video_vip.user.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected