您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Hide the difficulty tag on a leetcode question page with a reveal option.
当前为
- // ==UserScript==
- // @name Leetcode Question Difficulty Hider
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description Hide the difficulty tag on a leetcode question page with a reveal option.
- // @author DoubleX
- // @match https://leetcode.com/problems/*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=leetcode.com
- // @grant none
- // @license MIT
- // ==/UserScript==
- (function() {
- 'use strict';
- function waitForElm(selector) {
- return new Promise(resolve => {
- if (document.querySelector(selector)) {
- return resolve(document.querySelector(selector));
- }
- const observer = new MutationObserver(mutations => {
- if (document.querySelector(selector)) {
- observer.disconnect();
- resolve(document.querySelector(selector));
- }
- });
- observer.observe(document.body, {
- childList: true,
- subtree: true
- });
- });
- }
- function revealDiff(selector, diffcolor, difftext) {
- waitForElm(selector).then((ele) => {
- ele.style.backgroundColor = "black";
- ele.style.color = "white";
- ele.innerText = "Reveal";
- ele.style.cursor = "pointer";
- ele.toggled = false;
- ele.onclick = (e) => {
- if (ele.toggled) {
- ele.style.backgroundColor = "black";
- ele.style.color = "white";
- ele.innerText = "Reveal";
- ele.toggled = false;
- }
- else {
- ele.style.backgroundColor = "var(--fill-secondary)";
- ele.style.color = diffcolor;
- ele.innerText = difftext;
- ele.toggled = true;
- }
- }
- });
- }
- function setup(){
- revealDiff(".text-difficulty-hard", "var(--difficulty-hard)", "Hard");
- revealDiff(".text-difficulty-medium", "var(--difficulty-medium)", "Medium");
- revealDiff(".text-difficulty-easy", "var(--difficulty-easy)", "Easy");
- };
- if (document.readyState !== 'loading') {
- setup();
- } else {
- document.addEventListener('DOMContentLoaded', function () {
- setup();
- });
- }
- })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址