* 隐藏固定定位和粘性定位的元素 * @returns {Array} 被隐藏元素的原始样式信息,用于恢复
()
| 425 | * @returns {Array} 被隐藏元素的原始样式信息,用于恢复 |
| 426 | */ |
| 427 | function hideFixedElements() { |
| 428 | const fixedElements = []; |
| 429 | |
| 430 | // 查找所有fixed和sticky定位的元素 |
| 431 | const elements = document.querySelectorAll('*'); |
| 432 | elements.forEach(el => { |
| 433 | const style = window.getComputedStyle(el); |
| 434 | if (style && (style.position === 'fixed' || style.position === 'sticky')) { |
| 435 | // 排除FeHelper自己的UI元素 |
| 436 | if (el.classList.contains('fehelper-ui-element') || |
| 437 | el.hasAttribute('data-fh-ui') || |
| 438 | el.id === 'fehelper-screenshot-progress' || |
| 439 | el.closest('#fehelper_screenshot_container')) { |
| 440 | return; |
| 441 | } |
| 442 | |
| 443 | // 保存原始样式 |
| 444 | fixedElements.push({ |
| 445 | element: el, |
| 446 | originalDisplay: el.style.display, |
| 447 | originalVisibility: el.style.visibility, |
| 448 | originalOpacity: el.style.opacity |
| 449 | }); |
| 450 | |
| 451 | // 隐藏元素 |
| 452 | el.style.visibility = 'hidden'; |
| 453 | el.style.opacity = '0'; |
| 454 | } |
| 455 | }); |
| 456 | |
| 457 | window._fh_fixed_elements = fixedElements; |
| 458 | return fixedElements; |
| 459 | } |
| 460 | |
| 461 | /** |
| 462 | * 恢复之前隐藏的固定定位和粘性定位元素 |
no outgoing calls
no test coverage detected