Greasy Fork is available in English.
通过判断body挂载的背景图来判断
// ==UserScript==
// @name 移除CSDN、博客园动态背景图,减轻CPU负担
// @namespace http://tampermonkey.net/
// @description 通过判断body挂载的背景图来判断
// @author NyanKoSenSei
// @license MIT
// @match *://*.csdn.net/*
// @match *://*.cnblogs.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=greasyfork.org
// @grant none
// @connect www.csdn.net
// @connect www.cnblogs.com
// @version 0.0.1
// ==/UserScript==
window.onload = function() {
// 加载完毕后,检查body下面是否挂载了图片
let doc = document.getElementsByTagName("body")[0];
let body = window.getComputedStyle(doc, null);
if (body.backgroundImage == undefined || body.backgroundImage == '' || body.backgroundImage == 'none') {
return;
}
// 如果挂载了gif动图,直接给删掉
if (body.backgroundImage.includes(".gif\")")) {
doc.style.setProperty("background-image", "url()", 'important');
}
// document.querySelector("body").style.cssText="background-image:url() !important";
// document.querySelector("body").style.cssText="background-repeat:no-repeat !important";
}