Last active
September 16, 2025 13:30
-
-
Save piec/d17ac9317025c96bb5f3a88ecab7f8e0 to your computer and use it in GitHub Desktop.
violentmonkey script to toggle gmail "is unread"
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
| // ==UserScript== | |
| // @name gmail - toggle is unread | |
| // @namespace Violentmonkey Scripts | |
| // @match https://mail.google.com/* | |
| // @grant none | |
| // @version 1.2 | |
| // @author piec | |
| // @description 3/17/2025, 10:19:57 AM | |
| // @require https://cdn.jsdelivr.net/npm/@violentmonkey/shortcut@1 | |
| // @homepageURL https://gist.github.com/piec/d17ac9317025c96bb5f3a88ecab7f8e0 | |
| // @downloadURL https://gist.github.com/piec/d17ac9317025c96bb5f3a88ecab7f8e0/raw/gmail-toggle-unread.js | |
| // @grant GM_getValue | |
| // ==/UserScript== | |
| function isVisible(el) { | |
| return !!el.offsetParent; | |
| } | |
| VM.shortcut.register(GM_getValue('is-unread-binding', 'c-s-a'), () => { | |
| console.log("CSA"); | |
| const spans = Array.from(document.querySelectorAll('span')).filter(el => el.textContent.includes('unread') && isVisible(el)) | |
| if (spans.length == 1) { | |
| spans[0].click(); | |
| } | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment