Remove Divs with z-index 1001 - Tampermonkey Script
(function() { 'use strict';
// 获取所有带有style属性的div元素 const divs = document.querySelectorAll('div[style]');
// 遍历每个div元素 divs.forEach(div => { // 检查style属性中是否包含z-index: 1001 const styles = div.getAttribute('style'); if (styles.includes('z-index: 1001;')) { // 移除该div元素 div.remove(); } }); })();
This script automatically removes all div elements with a style attribute containing 'z-index: 1001;' on the website https://example.com/. Here's how it works:
- It uses
document.querySelectorAll('div[style]')to get all div elements with a style attribute. - It loops through each div and uses
div.getAttribute('style')to get the style attribute value. - It checks if the style value includes 'z-index: 1001;'. If it does, it removes the element using
div.remove(). - The script is wrapped in an immediately invoked function and uses
@matchto specify the targeted page URL.
原文地址: https://www.cveoy.top/t/topic/otqW 著作权归作者所有。请勿转载和采集!