(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:

  1. It uses document.querySelectorAll('div[style]') to get all div elements with a style attribute.
  2. It loops through each div and uses div.getAttribute('style') to get the style attribute value.
  3. It checks if the style value includes 'z-index: 1001;'. If it does, it removes the element using div.remove().
  4. The script is wrapped in an immediately invoked function and uses @match to specify the targeted page URL.
Remove Divs with z-index 1001 - Tampermonkey Script

原文地址: https://www.cveoy.top/t/topic/otqW 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录