Skip to content

Instantly share code, notes, and snippets.

@pbelskiy
Last active April 14, 2024 09:07
Show Gist options
  • Save pbelskiy/67e69ecac22e523c6259f789d1cc15db to your computer and use it in GitHub Desktop.
Save pbelskiy/67e69ecac22e523c6259f789d1cc15db to your computer and use it in GitHub Desktop.
How to find user name on Leetcode contest table
javascript
(function () {
const username = 'pbelskiy';
function find() {
if (document.body.innerHTML.search(username) !== -1) {
alert('found!');
return;
}
document.getElementsByClassName('next-btn')[0].click();
setTimeout(find, 1000);
}
setTimeout(find, 1000);
})();
@YogeshP93
Copy link

Nice. I added this small line of jQuery code below, after your alert statement
$('[title='+username+']').parent().parent().css("background-color", "yellow");
This highlights the entire row of the user, so we don't have to look for it manually in that page 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment