Greasy Fork is available in English.

Remove locked problems from leetcode.com

try to take over the leetcode site!

  1. // ==UserScript==
  2. // @copyright 2023, D0n9X1n (https://openuserjs.org/users/MikeCoder)
  3. // @license MIT
  4. // @name Remove locked problems from leetcode.com
  5. // @namespace http://d0n9x1n.dev/leetcode.com
  6. // @version 1.0
  7. // @description try to take over the leetcode site!
  8. // @author D0n9X1n
  9. // @match https://leetcode.com/problemset/*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. var mainPage = document.getElementsByTagName("body")[0];
  17. var button = document.createElement("input");
  18. button.type = "button";
  19. button.classList = "px-4 py-[10px] leading-tight rounded-full whitespace-nowrap flex space-x-2 items-center text-base pointer-event-none bg-gray-8 dark:bg-white text-label-r dark:text-dark-label-r shadow-level2 dark:shadow-dark-level2";
  20. button.style = "position: fixed;z-index: 10000;top: 80%;left: 80%;width:150px";
  21. button.value = "Hide Locked";
  22. button.onclick = removeLocks;
  23. mainPage.append(button);
  24.  
  25. function removeLocks() {
  26. console.log("remove locks");
  27. // Get all div elements with the specified class names and role attribute
  28. var divElements = document.querySelectorAll('div[role="row"].odd\\:bg-layer-1.even\\:bg-overlay-1.dark\\:odd\\:bg-dark-layer-bg.dark\\:even\\:bg-dark-fill-4');
  29.  
  30. // Define the SVG code as a string
  31. var svgCode = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="currentColor" class="text-brand-orange h-[18px] w-[18px]" style="--darkreader-inline-fill: currentColor;" data-darkreader-inline-fill=""><path fill-rule="evenodd" d="M7 8v2H6a3 3 0 00-3 3v6a3 3 0 003 3h12a3 3 0 003-3v-6a3 3 0 00-3-3h-1V8A5 5 0 007 8zm8 0v2H9V8a3 3 0 116 0zm-3 6a2 2 0 100 4 2 2 0 000-4z" clip-rule="evenodd"></path></svg>';
  32.  
  33. // Iterate through each div element
  34. divElements.forEach((divElement) => {
  35. console.log(divElement);
  36.  
  37. // Check if the divElement's innerHTML contains the SVG code as a substring
  38. if (divElement.innerHTML.includes(svgCode)) {
  39. divElement.style.display = 'none'; // Hide the div if the SVG code is found
  40. }
  41. });
  42. }
  43. })();