// ==UserScript== // @name Leetcode invisible // @version 0.1 // @description A script to hide Leetcode question difficultly // @author osjobs.net // @match https://leetcode.com/* // @exclude https://leetcode.com/problems/*/discuss/* // @grant none // @namespace https://greasyfork.org/users/555531 // @downloadURL none // ==/UserScript== // Since Leetcode use Ajax to load content, // we have to check the label in first few seconds if (window.location.href.indexOf("problemset") > -1) { var problemsetTimer = setInterval(problemsetFunction, 2000); } else if (window.location.href.indexOf("problems") > -1) { var updateTime = 0; var problemTimer = setInterval(problemFunction, 100); } function problemsetFunction() { // Problems list page if(document.querySelector("span.label-warning")) { var elementE = document.querySelectorAll("span.label-success"); var elementM = document.querySelectorAll("span.label-warning"); var elementH = document.querySelectorAll("span.label-danger"); update(elementE, "label-success"); update(elementM, "label-warning"); update(elementH, "label-danger"); } } function problemFunction () { if (updateTime > 0) { clearInterval(problemTimer); } if(document.querySelector("div.css-10o4wqw")) { var element = document.getElementsByClassName("css-10o4wqw")[0]; var child = element.getElementsByTagName("div")[0]; child.textContent = "Unknown"; child.className = child.className.replace(/css.*/,""); updateTime += 1; } if(document.querySelector("div.difficulty__ES5S")) { var similar_element = document.getElementsByClassName("difficulty__ES5S"); for (var i=0; i