bmc_hub/static/js/quick-time-shortcut.js

13 lines
672 B
JavaScript
Raw Normal View History

/* Bare minus opens standalone time; typing and modifier shortcuts are preserved. */
(()=>{'use strict';
function handle(event){
const target=event.target;
if(event.defaultPrevented||event.repeat||event.isComposing||event.key!=='-'||event.ctrlKey||event.metaKey||event.altKey||event.shiftKey)return;
if(target?.isContentEditable||target?.closest?.('input,textarea,select,[role="textbox"]')||document.querySelector('.modal.show,dialog[open]'))return;
event.preventDefault();
if(typeof window.openQuickTimeOnly==='function')window.openQuickTimeOnly();
else window.location.assign('/sag/new?quick_time=1');
}
document.addEventListener('keydown',handle);
})();