Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Toggle gmail left sidebar with escape key
// ==UserScript==
// @name Toggle left sidebar
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Toggles left gmail sidebar on "esc" keypress.
// @author blaz.krizaj@gmail.com
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @match *://mail.google.com/*
// @grant none
// ==/UserScript==
$(document).ready(function() {
$(document).keydown(function(e) {
if (27 == e.keyCode) {
var leftSideBar = $(".nH.oy8Mbf.nn.aeN");
if (leftSideBar.css('display') == 'none') {
leftSideBar.fadeIn();
}
else {
leftSideBar.fadeOut();
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment