Last active
April 27, 2017 13:08
-
-
Save akuhn/2880dbfd38b06f7b7b6b7977960675b8 to your computer and use it in GitHub Desktop.
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 Pokemon meme for inbox zero | |
// @namespace http://example.com | |
// @author You | |
// @match https://mail.google.com/* | |
// @version 1.1 | |
// @grant GM_addStyle | |
// ==/UserScript== | |
GM_addStyle('tr.TD td.my_congratulations { font: 25.6px Serif; padding: 8px 0 36px 0; }'); | |
function congratulations() { | |
var node = document.querySelector('tr.TD td.TC'); | |
if (node && node.innerText == 'No new mail!') { | |
node.innerHTML = '' + | |
'<p>So excited to see this happening!</p>' + | |
'<img src="http://media1.giphy.com/media/MhHXeM4SpKrpC/giphy.gif">'; | |
node.setAttribute('class', node.getAttribute('class') + ' my_congratulations'); | |
} | |
} | |
var token = null; | |
document.addEventListener( | |
"DOMNodeInserted", | |
function() { clearTimeout(token); token = setTimeout(congratulations, 1); }, | |
false | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment