Last active
January 8, 2017 13:07
-
-
Save nikjft/0646c829de63f4c158b32846ca35b707 to your computer and use it in GitHub Desktop.
JS routine to give Keyboard Maestro custom HTML prompts a timeout function. The timeout is automatically paused as soon as a key in pressed in a text input field so that it won't time out while someone's typing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var timeout; | |
function KMInit() { | |
var dialogTimeout = 10000 | |
timeout = setTimeout(function(){ window.KeyboardMaestro.Submit('Timeout'); }, dialogTimeout); | |
$('input[type=text]').keypress(function() { | |
console.log('Clearing timeout'); | |
clearTimeout(timeout); | |
}); | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment