70 lines
2.1 KiB
JavaScript
70 lines
2.1 KiB
JavaScript
// ==UserScript==
|
||
// @name Outline背景颜色修改
|
||
// @namespace http://tampermonkey.net/
|
||
// @version 2025-10-28
|
||
// @description
|
||
// @author ClanEver
|
||
// @match https://outline.eimsound.com/*
|
||
// @icon https://minio.eimsound.com/outline/public/d4335404-a074-4741-a98c-05f7b4f013bd/4b90f268-826c-420f-80a9-34cad76922c5/Icon-1024.png
|
||
// @updateURL https://gitea.tryanks.com/ClanEver/public-snippets/raw/branch/main/Outline背景颜色修改.user.js
|
||
// @downloadURL https://gitea.tryanks.com/ClanEver/public-snippets/raw/branch/main/Outline背景颜色修改.user.js
|
||
// @grant GM_registerMenuCommand
|
||
// @grant GM_getValue
|
||
// @grant GM_setValue
|
||
// @run-at document-start
|
||
// ==/UserScript==
|
||
|
||
(function () {
|
||
'use strict';
|
||
|
||
const need_change_css_selector = [
|
||
'.heading-actions', // h1, h2, ...前的#
|
||
'body',
|
||
'.keGgMX', // header
|
||
|
||
// 内容页 body
|
||
'.kiKzFH',
|
||
'.jDTqnc',
|
||
'.kiKzFH',
|
||
|
||
'.fwyrwy', // 内容页 标题
|
||
'.cLXGaH', // 内容页 大纲
|
||
'.jxgRW', // 主页 body
|
||
'.jHHYkE', // 主页 tab
|
||
'.kbOwGd', // 主页 list
|
||
'.eZQAiy', // 子页面 list
|
||
'.gUQTOB', // 子页面 list
|
||
]
|
||
const need_change_css_str = need_change_css_selector.join(',')
|
||
const DEFAULT_COLOR = '#f7f8fa';
|
||
|
||
function getColor() {
|
||
return GM_getValue('bgColor', DEFAULT_COLOR);
|
||
}
|
||
|
||
function setColor(color) {
|
||
GM_setValue('bgColor', color);
|
||
}
|
||
|
||
// 注册菜单命令
|
||
GM_registerMenuCommand('设置背景颜色', () => {
|
||
const current = getColor();
|
||
const newColor = prompt('请输入新的背景颜色(如 #ffffff 或 red):', current);
|
||
if (newColor) {
|
||
setColor(newColor);
|
||
}
|
||
});
|
||
|
||
const style = document.createElement('style');
|
||
style.innerHTML = `
|
||
${need_change_css_str} {
|
||
background-color: ${getColor()} !important;
|
||
}
|
||
`;
|
||
document.documentElement.appendChild(style);
|
||
|
||
setInterval(function() {
|
||
document.body.style.setProperty("background", "#f7f8fa", "important");
|
||
}, 500);
|
||
})();
|