MCPcopy Index your code
hub / github.com/hoothin/UserScripts / touchCheck

Function touchCheck

X-Downloader/X-Downloader.user.js:145–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143 }
144 let checkTimer;
145 const touchCheck = e => {
146 clearTimeout(checkTimer);
147 if (e.target == downloadBtn) return;
148 checkTimer = setTimeout(() => {
149 if (isElementVisible(downloadBtn)) return;
150 let target = findFirstVisibleElement("[data-testid='card.layoutLarge.media']");
151 if (target) {
152 return show(target.parentNode);
153 }
154 target = findFirstVisibleElement("[data-testid='tweetPhoto']");
155 if (target) {
156 return show(target.parentNode);
157 }
158 target = findFirstVisibleElement("[data-testid^='video-player']");
159 if (target) {
160 return show(target.parentNode);
161 }
162 }, 100);
163 };
164 document.addEventListener("mouseenter", addBtn, true);
165 document.addEventListener("touchstart", e => {touch = true; addBtn(e);}, true);
166 document.addEventListener("touchend", touchCheck, true);

Callers

nothing calls this directly

Calls 3

isElementVisibleFunction · 0.85
findFirstVisibleElementFunction · 0.85
showFunction · 0.85

Tested by

no test coverage detected