洛谷调背景插件

作者用来替代stylish的自适应洛谷替换背景插件

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         洛谷调背景插件
// @namespace    洛谷调背景插件
// @version      1.0
// @description  作者用来替代stylish的自适应洛谷替换背景插件
// @author       LiuTianyou
// @match        https://www.luogu.com.cn/*
// @grant        none
// @license      GPL-v3.0
// ==/UserScript==

window.back = "https://cdn.luogu.com.cn/upload/image_hosting/b9ifd7ye.png";
setInterval(function(){ //修复:背景图片缺失问题
    //修复:div不存在而错误终止脚本的情况
    document.querySelector('body').style=`background: url(${window.back}) fixed center;background-size: cover;`;
    if(document.querySelector('main[style="background-color: rgb(239, 239, 239);"]') != null)
        document.querySelector('main[style="background-color: rgb(239, 239, 239);"]').style="opacity: 0.9;";
    if(document.querySelector('div[style="background: linear-gradient(90deg, rgb(35, 37, 38), rgb(65, 67, 69)); filter: blur(0px) brightness(100%);"]') != null)
        document.querySelector('div[style="background: linear-gradient(90deg, rgb(35, 37, 38), rgb(65, 67, 69)); filter: blur(0px) brightness(100%);"]').style="opacity: 0.9;";
    if(document.querySelector('div[style="background: rgb(51, 51, 51); filter: blur(0px) brightness(100%);"]') != null)
        document.querySelector('div[style="background: rgb(51, 51, 51); filter: blur(0px) brightness(100%);"]').style="opacity: 0.9;";
    if(document.querySelector('div[class="mdui-panel mdui-panel-gapless"]') != null)
        document.querySelector('div[class="mdui-panel mdui-panel-gapless"]').style="opacity: 0.9;";
    if(document.querySelector("div[data-v-0a593618]") != null){
        document.querySelector("div[data-v-0a593618]").remove();
    }
},100);