Created
August 6, 2021 22:14
-
-
Save mattmight/36fe4f13d487baea13b7c6c3aa7b7d0e to your computer and use it in GitHub Desktop.
A Tampermonkey script to hide the gmail inbox to prevent being distracted
This file contains 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 Temporarily hide gmail inbox at first | |
// @namespace http://matt.might.net/ | |
// @version 0.1 | |
// @description Intended to prevent being distracted by your inbox if you meant to send an email or search your inbox. Mouse over the Gmail in upper left to make it re-appear. | |
// @author Matt Might | |
// @match https://mail.google.com/mail/u/0/ | |
// @icon https://www.google.com/s2/favicons?domain=google.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Your code here... | |
setTimeout(function () { | |
// WARNING: If the class name changes from "Cp" this will break: | |
var inboxDivs = document.getElementsByClassName("Cp") ; | |
var mainInbox = inboxDivs[1] ; | |
mainInbox.style.display = "none" ; | |
var inboxLabel = null; | |
function showInboxAgain () { | |
mainInbox.style.display = "block"; | |
inboxLabel.removeEventListener("mouseover",showInboxAgain,false) ; | |
} | |
var divs = document.getElementsByTagName("a"); | |
for (var i = 0; i < divs.length; ++i) { | |
var d = divs[i] ; | |
if (d.getAttribute("href") == "#inbox") { | |
inboxLabel = d; | |
} | |
} | |
inboxLabel.addEventListener("mouseover",showInboxAgain,false); | |
},2000) ; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment