Created
May 12, 2021 22:18
-
-
Save mansona/0726ecb7150cff456b3f5f0df198d13a to your computer and use it in GitHub Desktop.
This is a super simple snippet that I paste into my browser console to clear github notifications. Once It has been run once I just push up-enter-up-enter until they are all gone!
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
let foundStuff = false; | |
let items = document.querySelectorAll('li.notifications-list-item') | |
items.forEach((item) => { | |
if(item.querySelector('img.avatar-user[alt="@dependabot-preview[bot]"]') || item.querySelector('img.avatar-user[alt="@dependabot[bot]"]') || item.querySelector('img.avatar-user[alt="@renovate[bot]"]')) { | |
console.log('did find one'); | |
foundStuff = true; | |
item.querySelector('input[type="checkbox"]').click(); | |
} | |
}); | |
if(foundStuff) { | |
foundStuff = false; | |
console.log('found some stuff - refresh'); | |
document.querySelector('button[Title="Done"]').click(); | |
setTimeout(() => window.location.reload(), 200); | |
} else { | |
console.log('found nothing, next page'); | |
setTimeout(() => { | |
document.querySelector('a[aria-label="Next"]').click(); | |
}, 200); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment