simplify listener registration

since the function reference is constant, only one listener will be registered
This commit is contained in:
tophf 2018-08-07 20:11:11 +03:00
parent e3d1526b52
commit 92d6530c8f

View File

@ -583,10 +583,8 @@ function showHelp(title = '', body) {
window.dispatchEvent(new Event('closeHelp'));
});
if (getComputedStyle(div).display === 'none') {
window.addEventListener('keydown', showHelp.close, true);
$('.dismiss', div).onclick = showHelp.close;
}
window.addEventListener('keydown', showHelp.close, true);
$('.dismiss', div).onclick = showHelp.close;
// reset any inline styles
div.style = 'display: block';