// ==UserScript== // @name 北大树洞去水印 // @namespace http://tampermonkey.net/ // @version 1.0.0 // @description 北大树洞去水印 // @match *://treehole.pku.edu.cn/* // @run-at document-start // @grant GM_addStyle // @grant unsafeWindow // ==/UserScript== (function() { 'use strict'; const W = unsafeWindow, B = atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggV38AAAAAASUVORK5CYII="), A = new Uint8Array(B.length); for(let i=0;i u && (u.includes('mangshuiyin') || (u.includes('getImageBinary') && /[?&](texturedBgColor|id=[12](&|$))/.test(u))); const oF = W.fetch; W.fetch = (i, c) => isBad(i instanceof Request ? i.url : i) ? new Response(Z, {status: 200, headers: {'Content-Type': 'image/png'}}) : oF.apply(W, [i, c]); const X = W.XMLHttpRequest.prototype, oO = X.open, oS = X.send; X.open = function(m, u) { this._k = isBad(u); return oO.apply(this, arguments); }; X.send = function(b) { if (this._k) { ['status','statusText','response','responseText','responseType','readyState'].forEach((k,i)=> Object.defineProperty(this, k, {value: [200,'OK',Z,'','blob',4][i]})); return setTimeout(()=>['onreadystatechange','onload','onloadend'].forEach(e=>this[e]&&this[e]()), 1); } return oS.apply(this, arguments); }; GM_addStyle('canvas{display:none!important;opacity:0!important;width:0!important;height:0!important}.replyItem{background-color:var(--theme_bgc_color,#f5f5f5)!important}html.dark .replyItem{background-color:#2c2c2c!important}'); new MutationObserver(ms => ms.forEach(m => m.addedNodes.forEach(n => n.tagName === 'CANVAS' && (n.style.display = 'none')))) .observe(document, {childList: true, subtree: true}); })();