Flyinsky's Codes
121 字
1 分钟
浏览器选中文本背景颜色脚本

浏览器选中文本背景颜色脚本#

油猴脚本代码:

// ==UserScript==
// @name 细滚动条(light)
// @description 滚动条美化,此为浅色版,power by 52pj YaeSakura
// @author YaeSakura
// @match http://*/*
// @match https://*/*
// @match *://*.bilibili.com/*
// @match *://www.zhihu.com/*
// @match *://zhuanlan.zhihu.com/*
// @match *://www.baidu.com/*
// @run-at document-start
// @version 1.0
// ==/UserScript==
(function() {
    var css = [
        "html ::selection {",
        "    background-color: #cce2ff !important;",
        "    text-shadow: none;",
        "}"
    ].join("\n");

    var node = document.createElement("style");
    node.type = "text/css";
    node.appendChild(document.createTextNode(css));
    var heads = document.getElementsByTagName("head");
    if (heads.length > 0) {
        heads[0].appendChild(node);
    } else {
        // no head yet, stick it wherever
        document.documentElement.appendChild(node);
    }
})();