洛谷调背景插件

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);