reset LeetCode editor on load

Reset LeetCode on load so you wouldn't accidentally see a previously submitted solution!

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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/*
// @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);
})();