油猴脚本-检测力扣[数学][脑筋急转弯]题型

用途

LeetCode刷题但是又不想看题目标签

但是又想跳过
- 数学
- 脑筋急转弯
相关题型,可以通过该油猴脚本检查并且显示在页面上

数学和脑筋急转弯 讨厌死了😠😠😠

效果图

在这里插入图片描述
在这里插入图片描述

更多有趣的脚本可以查看我的Github😜

// ==UserScript==
// @name         Check leetcode tags
// @namespace    http://tampermonkey.net/
// @version      2024-10-31
// @author       You
// @match        https://leetcode.cn/problems/**
// @icon         https://www.google.com/s2/favicons?sz=64&domain=leetcode.cn
// @grant        none
// ==/UserScript==

(function () {

    function checkTags() {
        var textDifficulty = document.querySelectorAll('[class*="text-difficulty"]')[0]

        clearTimeout(timer)

        if (!textDifficulty) {
            timer = clearTimeout(checkTags(), 2000)
            return
        }

        var parent = document.querySelectorAll('[class*="text-difficulty"]')[0].parentElement

        console.log('parent = ', parent);

        if (document.body.innerText.indexOf("数学") >= 0) {
            let node = document.createElement('div')
            node.textContent = '数学'
            // node.style.cursor = 'pointer'
            node.style.color = 'rgb(255,45, 85,.7)'
            parent.appendChild(node)
        }

        if (document.body.innerText.indexOf("脑筋急转弯") >= 0) {
            let node = document.createElement('div')
            node.textContent = '脑筋急转弯'
            // node.style.cursor = 'pointer'
            node.style.color = 'rgb(255,45, 85,.7)'
            parent.appendChild(node)
        }
    }

    timer = setTimeout(
        checkTags,
        5000
    )

})();
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值