Skip to content

Instantly share code, notes, and snippets.

@karlhinze
Created August 19, 2022 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karlhinze/b4ae2bef14c15c5a1f2c0db65059ad14 to your computer and use it in GitHub Desktop.
Save karlhinze/b4ae2bef14c15c5a1f2c0db65059ad14 to your computer and use it in GitHub Desktop.
Adds keyboard shortcuts to the LiveWhale interface
$("body").on('keydown', function ( e ) {
if ((e.ctrlKey)) {
switch (String.fromCharCode(e.which).toLowerCase()) {
case 'e':
e.preventDefault();
if ($('#lw_pages_edit').is(":visible")) {
$('#lw_pages_edit_link').click(); // Edit Page
}
if ($('#lw_pages_edit_item').is(":visible")) {
window.location.href = $('#lw_pages_edit_item_link').attr('href'); // Edit Item
}
break;
case 'd':
e.preventDefault();
$('#lw-page-details-dropdown').click(); // Page Details
break;
case 'n':
e.preventDefault();
$('#lw-page-notes-dropdown').click(); // Page Notes
break;
case 'g':
e.preventDefault();
$('#lw-group-switcher-dropdown').click(); // Open Group Switcher
break;
case 's':
case 'c':
e.preventDefault();
$('#lw-content-dropdown').click(); // Open Your Content/Search Content
break;
case 't':
e.preventDefault();
$('#lw-toolbox-dropdown').click(); // Open Toolbox
break;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment