When I Ctrl+click on an email in Gmail, that email opens in a new tab. In that tab, there is a "mark as unread" button. How to make a userscript that automatically clicks that button when the tab opens? I'm trying to adapt a similar script as follows:
// ==UserScript==
// @name Auto-mark email as unread
// @namespace http://tampermonkey.net/
// @version 0.1
// @description -
// @author You
// @match https://mail.google.com/mail/u/0/?ui=2&view=btop&*
// @grant none
// ==/UserScript==
setTimeout(function() {
document.querySelector('.bAP').click()
alert("Hi");
}, 3000);
The script shows the alert box, but doesn't click the button. Same with '#bAP'
.