Greasy Fork

Greasy Fork is available in English.

百度文心一言去水印

猜测百度有人时刻关注这里,已被封杀,不再更新,但仍然有办法对抗水印,不再公开。

当前为 2023-03-25 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         百度文心一言去水印
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  猜测百度有人时刻关注这里,已被封杀,不再更新,但仍然有办法对抗水印,不再公开。
// @author       夜雨
// @match        https://yiyan.baidu.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=baidu.com
// @grant        none
// @license      MIT
// ==/UserScript==


(function() {
	'use strict';
	
	var hideWater = function() {
	    //方案来源 http://greasyfork.icu/zh-CN/scripts/462166
			let divMask = document.querySelector('div[style^="pointer-events"]')
			if (divMask) {
				let hideMask = document.createElement("style");
				hideMask.setAttribute("id","hideStyle")
				hideMask.innerHTML = `div[style^="pointer-events"]{visibility: hidden !important;opacity: 0 !important;position:absolute !important;z-index:-999 !important;}`
				let divId = divMask.getAttribute("id")
				let v = document.querySelector("#hideStyle")
				if(v){
					v.remove()
					document.body.append(hideMask)
				}else{
					
					document.body.append(hideMask)
				}
				
			}
	}
	
	
	var vv = ()=>{
		
		
		
		
		var old = null;
		try {
			old = MutationObserver.prototype.observe;
			MutationObserver.prototype.observe = function(target, options) {
				console.log("Hook MutationObserver observe")
				hideWater();
				return old;
		
			}
		} catch (e) {}
		
		try {
			old = WebKitMutationObserver.prototype.observe;
			WebKitMutationObserver.prototype.observe = function(target, options) {
				console.log("Hook WebKitMutationObserver observe")
				hideWater();
				return old;
			}
			
		} catch (e) {}
		
		try {
			old = MozMutationObserver.prototype.observe;
			MozMutationObserver.prototype.observe = function(target, options) {
				console.log("Hook MozMutationObserver observe")
				hideWater();
				return old;
			}
		} catch (e) {}
	}
	

	setTimeout(hideWater,500)
	setTimeout(vv,1000)
	

	//去超时弹窗。去AI画图水印
	setInterval(() => {
		if (document.querySelector(".ant-modal-root")) {
			document.querySelectorAll(".ant-modal-root").forEach(item => {
				item.remove()
			})
		}

		if (document.querySelector("img")) {
			document.querySelectorAll("img").forEach(item => {
				try {
					let imgUrl = item.getAttribute("src")
					if (imgUrl.indexOf("wm_ai") > -1) {
						item.setAttribute("src", imgUrl.replace(/style\/wm_ai/, ""))
					}

				} catch (e) {
					//TODO handle the exception
				}
			})
		}

	}, 2000)
	


	// Your code here...
})();