Problems with GMail script not working when changing pages
there is an issue with this script when transitioning between page one and page two. In most cases, it stops working
That's because when you're going to next page gmail creates a new second one layout and your code is just keeps looking for the first one. For the 'A' key this seems to be fixed by replacing document.querySelector("div.J-J5-Ji.J-JN-M-I-Jm > span").click()
to [...document.querySelectorAll("div.J-J5-Ji.J-JN-M-I-Jm > span")].pop().click()
, and for the 'F' you need to investigate by yourself
To use this script, please ensure that the website is currently in focus. To toggle the selection of all emails, simply press the 'A' key. To search for messages from the domain of a hovered email, first highlight the email and then press the 'F' key.
However, there is an issue with this script when transitioning between page one and page two. In most cases, it stops working. Even though the event listeners remain active and trigger an alert upon key presses, pressing the 'A' key will run the code but it doesn't work, but then I can run the same code in the console, and it'll work.