Skip to content

Instantly share code, notes, and snippets.

@solidgoldpig
Last active April 14, 2016 18:19
Show Gist options
  • Save solidgoldpig/c2561e13e2982ab0a98d3cd1fbf3cb74 to your computer and use it in GitHub Desktop.
Save solidgoldpig/c2561e13e2982ab0a98d3cd1fbf3cb74 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name SGP Mail
// @namespace http://solidgoldpig.com/tampermonkey/sgp-mail
// @version 0.1
// @description Make Gmail more bearable
// @author tampermonkey@alex.solidgoldpig.com
// @match https://mail.google.com/*
// @grant none
// ==/UserScript==
/* jshint ignore:start */
(function () {
'use strict'
var labelsToIgnore = [
'cwjobs',
'node-js',
'wsg-announce',
'w3c-training',
'logcheck',
'tzutzik@cloudband.com'
]
var searchList = `label:unread ${labelsToIgnore.map((l) => '-label:' + l).join(' ')}`
function showUnread () {
document.querySelector('input[aria-label^="Search"]').value = searchList
document.querySelector('button[aria-label^="Search"]').click()
}
if (window.Shortcut) {
window.Shortcut.add('Meta+Shift+u', showUnread)
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment