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

Function waitUntilMove

Picviewer CE+/dist.user.js:26474–26495  ·  view source on GitHub ↗
(target, callback)

Source from the content-addressed store, hash-verified

26472
26473 var untilMoveTimer, moveHandler, uniqueImgWinInitX, uniqueImgWinInitY;
26474 function waitUntilMove(target, callback) {
26475 if (moveHandler) document.removeEventListener('mousemove', moveHandler, true);
26476 if (untilMoveTimer) clearTimeout(untilMoveTimer);
26477
26478 moveHandler = e => {
26479 uniqueImgWinInitX = e.clientX;
26480 uniqueImgWinInitY = e.clientY;
26481 if (target != e.target) {
26482 let preRect = target.getBoundingClientRect();
26483 let nextRect = e.target.getBoundingClientRect();
26484 if (preRect && nextRect && (preRect.left > nextRect.left || preRect.right < nextRect.right || preRect.top > nextRect.top || preRect.bottom < nextRect.bottom)) {
26485 document.removeEventListener('mousemove', moveHandler, true);
26486 clearTimeout(untilMoveTimer);
26487 }
26488 }
26489 }
26490 document.addEventListener('mousemove', moveHandler, true);
26491 untilMoveTimer = setTimeout(() => {
26492 document.removeEventListener('mousemove', moveHandler, true);
26493 callback();
26494 }, prefs.floatBar.showDelay || 0)
26495 }
26496
26497 function checkFloatBar(_target, type, canPreview, clientX, clientY, altKey, composedTarget) {
26498 let target = _target;

Callers 1

checkUniqueImgWinFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected