Skip to content

Instantly share code, notes, and snippets.

@beinoriusju
Created February 9, 2022 07:19
Show Gist options
  • Save beinoriusju/012b3faba8eb743fbced0eb198206960 to your computer and use it in GitHub Desktop.
Save beinoriusju/012b3faba8eb743fbced0eb198206960 to your computer and use it in GitHub Desktop.
Protonmaill Read All Solution
/*
Protonmail does not allow to "mark all email as read". You can only do this page by page (50 at a time), but when you have thousands manualy going through each page is not possible. Here is my solution.
1. Open "All email" folder
2. Select "Unread"
3. Open browser developer tools (F12)
4. Paste this script.
5. If it does not work ask a friend developer to help you.
*/
const process = () => {
console.log('Working...')
return new Promise((resolve) => {
//Find "Select all email" checkobx and click it
document.querySelector('[data-testid="toolbar:select-all-checkbox"]').click()
setTimeout(() => {
//Find "Mark all as read" button and click it
document.querySelector('[data-testid="toolbar:read"]').click()
setTimeout(() => {
//Find next button
const next = document.querySelector('[data-testid="pagination-row:go-to-next-page"]');
if (next) {
//Click next button
next.click();
setTimeout(() => {
resolve(false);
}, 1000)
} else {
resolve(true)
}
}, 1000)
}, 500)
})
}
const rall = async () => {
let finished = false;
console.log('Starting work.')
while (!finished) {
finished = await process()
}
console.log('Finished.')
}
rall();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment