跳到正文

科技·工程

Better Luogu! | 史上最唐洛谷脚本

volatile约 14 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年1月13日
篇幅
约 14 分钟

版本

  1. v4当前
  2. v3
  3. v2
  4. v1

起源

原来已经快两年了。感觉这两年啥也没干。感觉这两年就干了一件事。

两年过去码量膨胀了 2020 倍,然后越来越没意思了。

笑点是第一版的所有功能都没了。

只记得寒假吃饱了撑着的写了几行,本来啥也不会的,要么抄要么度娘。

所以和我一起来锐评一下 v1.0.0

见星号。

JavaScript
 // ==UserScript==
// @name         new luogu
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  洛谷扩展
// @author       volatile
// @match        https://*.luogu.com.cn/*
// @match        https://*.luogu.org/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=luogu.com.cn
// @grant        GM_addStyle
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_deleteValue
// @grant        GM_listValues
// @grant        GM_setClipboard
// @grant        GM_xmlhttpRequest
// @grant        GM_getResourceText *全没用到
// @grant        unsafeWindow
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    //进入插件 *幽默注释
    console.log("This is new luogu");*幽默

    //日历 *幽默注释
    const today=new Date();
    const year=today.getFullYear();
    const month=String(today.getMonth()+1);
    const day=String(today.getDate());
    console.log(year);*幽默
    console.log(month);*幽默
    console.log(day);*幽默
    var date_html=`<h2>今天是 `+year+`-`+month+`-`+day+`</h2>`;
    if(month==1&&day==1){
        date_html+=`<h2>今天是元旦,新的一年,新的开始</h2>`;
    }
    else if(month==2&&day==29){
        date_html+=`<h2>今年是闰年</h2>`;
    }
    else if(month==4&&day==1){
        date_html+=`<h2>今天是愚人节</h2>`;
    }
    else if(month==5&&day==1){
        date_html+=`<h2>今天是劳动节</h2>`;
    }
    else if(month==6&&day==1){
        date_html+=`<h2>今天是儿童节</h2>`;
    }
    else if(month==9&&day==10){
        date_html+=`<h2>今天是教师节</h2>`;
    }
    else if(month==10&&day==1){
        date_html+=`<h2>今天是国庆节,七天小长假,启动!</h2>`
    }
    else if(month==12&&day==31){
        date_html+=`<h2>明年见</h2>`;
    }
    else if(month==4&&day==28){
        var years=year-YEAR;*涉及年龄遂替换
        date_html+=`<h2>今天是作者生日的后 `+years+` 年</h2>`;
    }
    else{
        date_html+=`<h2>欢迎!</h2>`;
    }
    var date=document.createElement('div');
    date.className='lg-article';
    date.innerHTML=date_html;
    document.querySelector('div.lg-right > div:nth-child(1)').insertAdjacentElement('beforebegin', date);

    //更改用户名颜色 *幽默注释
    var color=document.getElementsByClassName("lg-fg-green")[0];*手动这一块
    console.log(color);*幽默
    color.className="lg-fg-purple";*手动这一块

    //介绍 *幽默注释
    var x=[{link:'https://github.com/USER/new-luogu',text:'NEWLG'},];*涉及姓名遂替换
    function add()
    {
        if(document.querySelectorAll('.link-container')[0]==undefined){
            setTimeout(function(){add()},50);
        }
        else{
            setTimeout(function(){for(var i in x){
                var a=document.createElement("a");document.querySelectorAll('.link-container')[0].append(a);
                a.outerHTML=
                '<a href=\"'+x[i].link+'\" target=\"_blank\" colorscheme=\"none\" class=\"header-link color-none\" style="vertical-align: middle;margin-right: 2em;color: #262626;text-decoration: none;">'+x[i].text+'</a>'
            ;}},100);
        }
    }
    add();*省流:抄的
    // Your code here... *幽默注释
})();

功能

  • 智能推荐显示热搜(废物利用这一块)
  • 快捷搜索引擎
  • 私信快捷操作
    • 清空私信
    • 拉黑
  • 【数据删除】的千万别点
  • 比赛题目返回题目列表
  • 隐藏广告
  • 题目 IDE 缺省源
  • Markdown 工具栏补充
  • 专栏评论管理
  • 公告板
  • 查看他人主页

讲一些我在用,根据数据(见评价)来说也有人用的功能。

工具栏

和这篇说的一样,总之七月更新了渲染,但是我记不住格式。

同时这也是用的人最多的功能。

能插入 callouts、epigraph、居中、居右,多行输入时也可使用。

题目 IDE 缺省源

洛谷 IDE 怎么能没有缺省源。

日常使用洛谷 IDE 刷题时,常会用到方便的宏定义、typedef 等便捷代码预设。每次开启新题目,都需要手动从云剪贴板或文档中复制这些内容,对于我这种经常用洛谷 ide 的人来说非常不方便,所以我建议在偏好设置(也可以是其他地方)里可以设置 ide 的默认代码,就像主流的本地编辑器一样。——工单 AQQV067247

这是使用人数第二多的功能。

显然,缺省源在赛时没啥用,除非比较短记得住。

你比赛时也有吗?

——hh0592821\color{purple}\texttt{hh0592821}

私信清空

其实这个大多给我用的。

但是对于私信比较多的情况可能会 403,这个也有在改进。

专栏私信管理

最近做的功能,没过审。

评论管理可以不用翻到专栏一个一个删掉。

你可以有选择地快速删除评论,即使有频繁操作也会重试,能避免 403。

但是有个问题是加载还是得手动……自动 403 了,这个也有在改进。

预览

已上线

评论管理\color{gray}\small评论管理


工具栏\color{gray}\small工具栏


动图,没加载出来就是寄了

缺省源\color{gray}\small缺省源

未上线

公告板\color{gray}\small公告板


看主页\color{gray}\small看主页

已下线

不必多说\color{gray}\small不必多说

千万别点

说回标题。

如果你已经下载了本插件,你应该会看见“千万别点”这个东西。

只要 Better Luogu! 一更新,我就会多很多私信。

——@volatile

彳亍口巴。

投票:是否移除“千万别点”(点击选项进行投票): 赶紧移除 我就爱用

顺便一提,

他说对了。\color{gray}\small他说对了。

“千万别点”这个司马东西的出现应该和这个有关。

@SqrtSecond

已加载全部消息\color{gray}\small已加载全部消息

2023−07−19 16:50\small2023-07-19\ 16:50

当然想试试的已经试不了了,因为原云剪贴板删了。

评价

截止到 2025.11.26,Better Luogu! 用户高频使用功能如下。

功能比例
题目ide缺省源38.64%
私信清空34.09%
比赛列表返回29.55%
快捷工具栏45.45%
炸作者私信38.64%
其他4.55%

用户给出高度评价。

不要瞎恶搞!!!搞得我以为得罪了一个红名大佬。

——@cwxcplh

能不能炸我私信

——@LINYUHENG2

学术点,里面的娱乐功能太恶心人? (其实没建议,看着不快直接搬了)


多一点私信轰炸

——@Red_river

建议1:太花了 建议2:作者真(tai)棒(™)呀(qie’le) 建议作者看好木琴和抚琴

——@kkksc03

他 uid 就是这么填的。↑


建议 better luogu 广泛征求建议

——@volatile

他 uid 就是这么填的。↑

下载

原文