better-luogu-blog脚本开发

· · 科技·工程

绷不住了,luogu博客改了,格式都变了,已经不兼容了QAQ

以后再改吧,咕咕咕~~~

以下为原文:

better-luogu-blog

\color{gray}{\colorbox{gray}{吐槽:luogu博客的博客样式开发者真是……,}}
\color{gray}{\colorbox{gray}{为什么不同的样式用同一个名字来表示不同的位置}}
updata: 2023.7.18 发现对于不同的博客样式存在兼容性问题,已修改
updata:2023.7.25 发现上次改bug时又改出了一个bug,已修复

这是一个我自己开发的脚本,就是对于洛谷博客进行了一点优化。

其实这方面的优化 Smart-luogu 也有,但是它的优化只是对于 luogu3 By kkksc03 ,可是我用的主题是 Bread By Himself65 ,无法优化,原本的样子又十分不好看,所以我就十分的不爽 :(

所以,我就自己搞了一点小开发 awa 。

还有,背景是可以自己换的,我用的是随机图,然后对于随机图来说,blog主题背景如果也是随机图的话,这两个随机图食会是同一张,所以食用效果更佳 awa 。

贴个随机图网址: (Chancylaser/bx/bx/bx)

https://moe.jitsu.top/img/?sort=pc

一定不要吧最后的“pc”改成“r18”

以下是脚本源代码(CSS的):

因为我不想弄文件传输,又不会把它甩到网上,所以直接给个源代码吧qwq

用油猴自行新建脚本就可以了awa

// ==UserScript==
// @name         better-luogu-blog
// @namespace    http://tampermonkey.net/
// @description  try to take over the world!
// @author       YT
// @match        http://*/*
// @match        https://*/*
// @version      1.0
// ==/UserScript==
(function() {var css = "";
if (false || (document.location.href.indexOf("https://www.luogu.com.cn/blog/") == 0) || (document.domain == "blog.luogu.org" || document.domain.substring(document.domain.indexOf(".blog.luogu.org") + 1) == "blog.luogu.org"))
    css += [
        "@keyframes slowshow {",
        "    0% {",
        "        opacity: 0;",
        "    }",
        "",
        "    100% {",
        "        opacity: 1;",
        "    }",
        "}",
        "",
        "/*图片背景*/",
        "html > body {",
        "    background-image: url(https://moe.jitsu.top/img/?sort=pc) !important;",
        "    background-repeat: no-repeat;",
        "    background-size: cover;",
        "    background-position: center;",
        "    background-attachment: fixed;",
        "}",
        ".bread-navbar { ",
        "    animation: slowshow .5s 1;",
        "    transition: all 0.5s ease;",
        "    backdrop-filter: blur(3px) !important;",
        "    background: rgba(255, 255, 255, 0);",
        "}",
        ".bread-navbar:hover{ ",
        "    background: rgba(255, 255, 255, .4);",
        "    text-shadow: 1px 1px 3px black;",
        "}",
        "",
        ".post-list { ",
        "    animation: slowshow .5s 1;",
        "    transition: all 0.5s ease;",
        "    backdrop-filter: blur(2px) !important;",
        "    background: rgba(255, 255, 255, .45);",
        "    border: 4mm ridge rgba(224,255,255,.1);",
        "    border-radius: 20px 20px 20px / 20px 20px !important;",
        "}",
        ".post-list:hover{ ",
        "    background: rgba(255, 255, 255, .95);",
        "    border: 4mm ridge rgba(224,255,255,.95);",
        "    transform: translateY(-1px);",
        "    border-radius: 20px 20px 20px / 20px 20px !important;",
        "    box-shadow: 0px 0px 40px #1f1f1f;",
        "}",
        "",
        "",//col-lg-8 col-lg-offset-2    col-md-10 col-md-offset-1    post-container
        ".post-container { ",
        "    animation: slowshow .5s 1;",
        "    transition: all 0.5s ease;",
        "    backdrop-filter: blur(2px) !important;",
        "    background: rgba(255, 255, 255, .45);",
        "    border-radius: 30px !important;",
        "}",
        ".post-container:hover { ",
        "    background: rgba(255, 255, 255, .95);",
        "    transform: translateY(-1px);",
        "    border-radius: 30px !important;",
        "    box-shadow: 0px 0px 40px #1f1f1f;",
        "}",
        "",
        ".mdui-col-md-8{ ",
        "    animation: slowshow .5s 1;",
        "    transition: all 0.5s ease;",
        "    backdrop-filter: blur(2px) !important;",
        "    background: rgba(255, 255, 255, .45);",
        "    border-radius: 30px !important;",
        "}",
        ".mdui-col-md-8:hover { ",
        "    background: rgba(255, 255, 255, .95);",
        "    transform: translateY(-1px);",
        "    border-radius: 30px !important;",
        "    box-shadow: 0px 0px 40px #1f1f1f;",
        "}",
        "",
    ].join("\n");
if (typeof GM_addStyle != "undefined") {
    GM_addStyle(css);
} else if (typeof PRO_addStyle != "undefined") {
    PRO_addStyle(css);
} else if (typeof addStyle != "undefined") {
    addStyle(css);
} else {
    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 whereever
        document.documentElement.appendChild(node);
    }
}
})();