Created
February 2, 2025 10:02
-
-
Save vinhjaxt/940d7dea88291e351936725700af5401 to your computer and use it in GitHub Desktop.
Gmail delete all mail (to trash)
This file contains hidden or 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
var delay = ms => new Promise(resolve => setTimeout(resolve, ms)) | |
function simulateMouseClick(targetNode) { | |
function triggerMouseEvent(targetNode, eventType) { | |
var clickEvent = document.createEvent('MouseEvents'); | |
clickEvent.initEvent(eventType, true, true); | |
targetNode.dispatchEvent(clickEvent); | |
} | |
["mouseover", "mousedown", "mouseup", "click"].forEach(function(eventType) { | |
triggerMouseEvent(targetNode, eventType); | |
}); | |
}; | |
(async function a(){ | |
while(true){ | |
try{ | |
var a = document.querySelector('div[role="toolbar"]').nextElementSibling.querySelector('span[role="checkbox"]') | |
if (a.attributes.getNamedItem('aria-checked').value != "true") a.click() | |
simulateMouseClick(document.querySelector(`[aria-label="Xóa"]`)) | |
}catch(e){ | |
console.error(e) | |
} | |
await delay(1000) | |
}})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment