MCPcopy
hub / github.com/hoothin/UserScripts / checkFloatBar

Function checkFloatBar

Picviewer CE+/dist.user.js:26497–27084  ·  view source on GitHub ↗
(_target, type, canPreview, clientX, clientY, altKey, composedTarget)

Source from the content-addressed store, hash-verified

26495 }
26496
26497 function checkFloatBar(_target, type, canPreview, clientX, clientY, altKey, composedTarget) {
26498 let target = _target;
26499 if (!target || target.id == "pv-float-bar-container" ||
26500 (target.parentNode && (target.parentNode.id == "icons" || target.parentNode.className == "search-jumper-btn")) ||
26501 (target.className &&
26502 (/^pv\-/.test(target.className) ||
26503 target.className == "whx-a" ||
26504 target.className == "whx-a-node" ||
26505 target.className == "search-jumper-btn" ||
26506 target.classList.contains("pv-icon") ||
26507 target.classList.contains("ks-imagezoom-lens")))) {
26508 return;
26509 }
26510 if (target.nodeName.toUpperCase() == "PICTURE"){
26511 target = target.querySelector("img");
26512 }
26513 if (type == "mousemove") {
26514 if ((uniqueImgWin && !uniqueImgWin.removed && !uniqueImgWin.previewed)) {
26515 uniqueImgWin.followPos(clientX, clientY);
26516 if (!canPreview) {
26517 uniqueImgWin.remove();
26518 }
26519 return;
26520 } else if (target.nodeName.toUpperCase() != 'IMG' || !canPreview) {
26521 return;
26522 }
26523 }
26524
26525 if (target.nodeName.toUpperCase() == 'IMG' && !target.naturalHeight) {
26526 target = target.parentNode;
26527 }
26528 // 扩展模式,检查前面一个是否为 img
26529 if (target.nodeName.toUpperCase() != 'IMG' && matchedRule.rules.length > 0 && matchedRule.ext) {
26530 var _type = typeof matchedRule.ext;
26531 if (_type == 'string') {
26532 switch (matchedRule.ext) {
26533 case 'previous':
26534 target = target.previousElementSibling || target;
26535 break;
26536 case 'next':
26537 target = target.nextElementSibling || target;
26538 break;
26539 case 'previous-2':
26540 target = (target.previousElementSibling &&
26541 target.previousElementSibling.previousElementSibling) || target;
26542 break;
26543 }
26544 } else if (_type == 'function') {
26545 try {
26546 target = matchedRule.ext(target) || target;
26547 } catch(ex) {
26548 throwErrorInfo(ex);
26549 }
26550
26551 if (!target) return;
26552 }
26553 }
26554 let bgReg = /.*url\(\s*["']?([^ad\s'"#].+?)["']?\s*\)([^'"]|$)/i;

Callers 1

globalMouseoverHandlerFunction · 0.70

Calls 11

debugFunction · 0.85
containsMethod · 0.80
removeMethod · 0.80
throwErrorInfoFunction · 0.70
hasBgFunction · 0.70
checkUniqueImgWinFunction · 0.70
getElementMixFunction · 0.70
pretreatmentFunction · 0.70
findPicFunction · 0.70
clickToOpenFunction · 0.70
startMethod · 0.45

Tested by

no test coverage detected