Skip to content

Instantly share code, notes, and snippets.

@jemikanegara
Last active January 7, 2021 08:49
Show Gist options
  • Save jemikanegara/ce9b7e291b96eaa2c973cdc895a83e95 to your computer and use it in GitHub Desktop.
Save jemikanegara/ce9b7e291b96eaa2c973cdc895a83e95 to your computer and use it in GitHub Desktop.
Delete all unread gmail
Search -> is:unread
const checkIcon = document.querySelector('.T-Jo')
const deleteIcon = document.querySelector('.nX')
// https://stackoverflow.com/questions/24025165/simulating-a-mousedown-click-mouseup-sequence-in-tampermonkey/24026594
function triggerMouseEvent (node, eventType) {
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent (eventType, true, true);
node.dispatchEvent (clickEvent);
}
function deleteNow(el) {
triggerMouseEvent (el, "mouseover");
triggerMouseEvent (el, "mousedown");
triggerMouseEvent (el, "mouseup");
triggerMouseEvent (el, "click");
}
const intv212 = setInterval(() => { checkIcon.click(); }, 10000);
const intv213 = setInterval(() => {deleteNow(deleteIcon); }, 10000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment