Last active
May 10, 2024 04:44
-
-
Save Zackhardtoname/32a535ab0d7775b5aa253a913ff3e4ec to your computer and use it in GitHub Desktop.
reset LeetCode editor on load
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name reset LeetCode editor on load | |
// @namespace https://zacklight.com/ | |
// @version 0.3 | |
// @description Reset LeetCode on load so you wouldn't accidentally see a previously submitted solution! | |
// @author Zack Light | |
// @match https://leetcode.com/problems/* | |
// @downloadURL https://gist.github.com/Zackhardtoname/32a535ab0d7775b5aa253a913ff3e4ec/raw/41f7ffb2358d979f44adbefeaa4ad83370311cca/reset_LeetCode_editor_on_load.user.js | |
// @updateURL https://gist.github.com/Zackhardtoname/32a535ab0d7775b5aa253a913ff3e4ec/raw/41f7ffb2358d979f44adbefeaa4ad83370311cca/reset_LeetCode_editor_on_load.user.js | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @grant none | |
// ==/UserScript== | |
function confirm() { | |
let confirm_button = document.querySelector('#editor > div.flex.h-8.items-center.justify-between.border-b.p-1.border-border-quaternary.dark\\:border-border-quaternary > div.flex.items-center.gap-1 > div > div > div > div.my-8.inline-block.min-w-full.transform.overflow-hidden.rounded-\\[13px\\].text-left.transition-all.bg-overlay-3.md\\:min-w-\\[420px\\].shadow-level4.dark\\:shadow-dark-level4.dark\\:bg-dark-layer-2.p-0.w-\\[480px\\].opacity-100.scale-100 > div > div.mt-8.flex.justify-end > div > div > div:nth-child(2) > button'); | |
confirm_button.click(); | |
} | |
function reset() { | |
let reset_button = document.querySelector('#editor > div.flex.h-8.items-center.justify-between.border-b.p-1.border-border-quaternary.dark\\:border-border-quaternary > div.flex.items-center.gap-1 > button:nth-child(4)'); | |
reset_button.click(); | |
setTimeout(confirm, 50); | |
} | |
(function() { | |
'use strict'; | |
setTimeout(reset, 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment