Skip to content

Instantly share code, notes, and snippets.

@krizajb
Last active August 8, 2019 14:08
Show Gist options
  • Save krizajb/4d32429f807e212da2e6461886eab208 to your computer and use it in GitHub Desktop.
Save krizajb/4d32429f807e212da2e6461886eab208 to your computer and use it in GitHub Desktop.
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