Select Git revision
-
Robert Goldmann authoredRobert Goldmann authored
To learn more about this project, read the wiki.
hotkeys.js 2.01 KiB
Mousetrap.bind('n', function()
{
if(areHotKeysEnabled())
{
window.location.href = rootURL + '/transactions/newTransaction/normal';
}
});
Mousetrap.bind('t', function()
{
if(areHotKeysEnabled())
{
window.location.href = rootURL + '/transactions/newTransaction/transfer';
}
});
Mousetrap.bind('v', function()
{
if(areHotKeysEnabled())
{
window.location.href = rootURL + '/templates';
}
});
Mousetrap.bind('f', function()
{
if(areHotKeysEnabled())
{
window.location.href = rootURL + '/transactions#modalFilter';
}
});
Mousetrap.bind('s', function(e)
{
if(areHotKeysEnabled())
{
document.getElementById('search').focus();
e.preventDefault();
}
});
Mousetrap.bind('esc', function()
{
if(isSearchFocused())
{
document.getElementById('nav-logo-container').focus();
}
});
Mousetrap.bind('o', function()
{
if(areHotKeysEnabled())
{
window.location.href = rootURL + '/transactions';
}
});
let saveTransactionOrTemplateButton = document.getElementById('button-save-transaction');
if(saveTransactionOrTemplateButton !== null)
{
Mousetrap(document.querySelector('body')).bind('mod+enter', function(e)
{
document.getElementById('button-save-transaction').click();
});
}
function areHotKeysEnabled()
{
return !isSearchFocused() && !isCustomSelectFocused() && !isTemplateSearchFocused();
}