Skip to content

Commit 9010f3d

Browse files
committed
feat:init
0 parents  commit 9010f3d

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

Greasy_Fork_README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# 力扣(Leetcode-cn)清理大师
2+
3+
本脚本旨在消除力扣刷题界面的无用信息,并仿照OJ对力扣进行改动。
4+
5+
主要改动如下:
6+
7+
* 删除提交错误时的**错误用例显示**,删除执行代码时的**正确代码运行结果**(即只有程序的输出,没有正确结果进行对照)【一般OJ设置】
8+
* 关闭评论区
9+
* 关闭笔记功能
10+
* 删除顶栏的无用按钮(学习、讨论、求职、商店、Plus会员、我是面试官、APP、通知)
11+
* 删除无效的题目信息(相关企业、总提交次数、贡献者等)
12+
* 删除其他无用的按钮(点赞、分享、接受动态、反馈)
13+
* 删除PLUS会员功能(调试器、智能模式)
14+
* 重命名`题解``我要放弃`,使用激将法提高AC率
15+
16+
**脚本内有详尽注释,您可以根据需求自定义脚本**
17+
18+
* 仓库位置:[点击这里](https://github.com/NicerWang/leetcode-cleaner)
19+
20+
* 欢迎提出`Issue`
21+

Leetcode-cleaner.user.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// ==UserScript==
2+
// @name Leetcode-cn清洁器
3+
// @namespace https://github.com/NicerWang
4+
// @version 0.1
5+
// @description 去除与刷题无关的内容,关闭结果提示
6+
// @author NicerWang
7+
// @match https://leetcode-cn.com/problems/*
8+
// @icon https://www.google.com/s2/favicons?sz=64&domain=leetcode-cn.com
9+
// ==/UserScript==
10+
11+
(function() {
12+
'use strict';
13+
var style = document.createElement("style");
14+
style.type = "text/css";
15+
var blockCssText = "div[data-key='submissions-content']>div>div>div>div>div:nth-child(n+3)," // 删除提交错误时的错误用例显示[OJ默认设置]
16+
+ "div[data-key='runcode-result-content']>div>div>div:nth-child(4)," // 删除执行代码时的正确代码运行结果[OJ默认设置]
17+
+ "div[data-key='comments']," // 关闭评论区
18+
+ "div[data-key='description-content']>div>div:nth-child(n+3):nth-child(-n+8)," // 删除相关企业、总提交次数、贡献者等无用信息
19+
+ "nav>ul>li:nth-child(2),nav>ul>li:nth-child(4),nav>ul>li:nth-child(6),nav>ul>li:nth-child(7),nav>ul>li:nth-child(8)," // 删除顶栏的学习、讨论、求职、商店
20+
+ "nav>div>*:nth-child(-n+5)," // 删除顶栏的下载APP、会员、我是面试官、通知等按钮
21+
+ "div[data-key='debugger']," // 关闭调试器
22+
+ "div.bottom-right," // 删除笔记功能
23+
+ "div#question-detail-main-tabs>div:nth-child(2)>div>div:nth-child(1)>div>*:nth-child(3)," // 删除点赞按钮
24+
+ "div#question-detail-main-tabs>div:nth-child(2)>div>div:nth-child(1)>div>*:nth-child(5)," // 删除分享按钮
25+
+ "div#question-detail-main-tabs>div:nth-child(2)>div>div:nth-child(1)>div>*:nth-child(7)," // 删除接受动态按钮
26+
+ "div#question-detail-main-tabs>div:nth-child(2)>div>div:nth-child(1)>div>*:nth-child(8)," // 删除反馈按钮
27+
+ "div#lc-home>div>div:nth-child(2)>div:first-child>div:first-child>div:last-child>div:first-child>div:last-child>div:first-child>div," // 删除贡献按钮
28+
+ "#lang-select + button" // 删除智能模式按钮
29+
30+
// 重命名:题解 => 🧨我要放弃
31+
var giveUp = "div[data-key='solution']>a>div>span>div>div {display:none} div[data-key='solution']>a>div>span>div:after{content:'🧨我要放弃'}";
32+
var text = document.createTextNode(blockCssText + "{display:none;}" + giveUp);
33+
style.appendChild(text);
34+
var head = document.getElementsByTagName("head")[0];
35+
head.appendChild(style);
36+
})();

0 commit comments

Comments
 (0)