Skip to content
Snippets Groups Projects
Commit 5475ba6b authored by Robert Goldmann's avatar Robert Goldmann
Browse files

#681 - select account with corresponding index on hotkey

parent e8b14cdd
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ $(document).ready(function()
$('#globalAccountSelect').click(function()
{
fetchAndShowModal(this, 'globalAccountSelectModalOnDemand', '#modalGlobalAccountSelect');
enableAccountSelectHotKeys();
});
$('.sidenav').sidenav();
......@@ -124,3 +125,18 @@ function validateLoginForm()
let passwordInput = document.getElementById('login-password');
passwordInput.value = passwordInput.value.trim();
}
function enableAccountSelectHotKeys()
{
Mousetrap.bind(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], function(e)
{
if(areHotKeysEnabled())
{
let accountItem = document.querySelector('.global-account-select-option[data-account-index="' + e.key + '"]');
if(accountItem !== null)
{
accountItem.click();
}
}
});
}
......@@ -28,7 +28,7 @@
<div class="col s12 m6 xl6">
<a href="<@s.url '/accounts/${account.getID()?c}/select'/>" class="text-default">
<div class="card-panel global-account-select-option">
<div class="card-panel global-account-select-option" data-account-index="${account?index}">
<#if account?index < 10>
<div class="keyboard-key bold global-account-select-option-key">${account?index}</div>
<#else>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment