Greasy Fork

Greasy Fork is available in English.

哪里不要点哪里

将鼠标放置在不想要的网页内容上然后点击即可去掉,适用于想要将网页保存为pdf时但有不需要内容时的场景

当前为 2020-11-25 提交的版本,查看 最新版本

// ==UserScript==
// @name         哪里不要点哪里
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  将鼠标放置在不想要的网页内容上然后点击即可去掉,适用于想要将网页保存为pdf时但有不需要内容时的场景
// @author       starrysky
// @match        https://*/*
// @match        http://*/*
// @grant        http://greasyfork.icu/zh-CN/scripts/416756-%E5%93%AA%E9%87%8C%E4%B8%8D%E8%A6%81%E7%82%B9%E5%93%AA%E9%87%8C
// @updateURL
// ==/UserScript==

(function() {
    'use strict';
    var allDom = document.querySelectorAll('*');
	NodeList.prototype.forEach = Array.prototype.forEach;
	allDom.forEach((item)=>{
		item.style.cursor = 'pointer'
        if(item.nodeName== 'SCRIPT'){
			item.remove()
		}
		if(item.nodeName== 'BODY' || item.nodeName == 'HTML' ){
			item.style.backgroundColor = "rgba(78,110,242,0)"
		}else{
			item.onfocus = function(evt){
				let event = evt || window.event;
				let target = event.target || event.srcElement;
				target.remove()
			}
			item.onmouseenter = function(){
				item.style.backgroundColor = "rgba(78,110,242,0.15)"
			}
			item.onmouseleave = function(){
				item.style.backgroundColor = "rgba(78,110,242,0)"
			}
		}
	})
})();