用途
在LeetCode
刷题但是又不想看题目标签时
但是又想跳过
- 数学
- 脑筋急转弯
相关题型,可以通过该油猴脚本检查并且显示在页面上
数学和脑筋急转弯 讨厌死了😠😠😠
效果图
// ==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
)
})();