Bind Enter to the start button.

This commit is contained in:
Ethan Dalool 2020-02-28 16:07:42 -08:00
parent 4a9735cb7a
commit 638b466835

View file

@ -122,6 +122,26 @@ var check_timer = null;
var page_focused_cached;
function bind_box_to_button(box, button, ctrl_enter)
{
// Thanks Yaroslav Yakovlev
// http://stackoverflow.com/a/9343095
var bound_box_hook = function(event)
{
if (event.key !== "Enter")
{return;}
ctrl_success = !ctrl_enter || (event.ctrlKey)
if (! ctrl_success)
{return;}
button.click();
}
box.addEventListener("keyup", bound_box_hook);
}
bind_box_to_button(document.getElementById("subreddit_field"), document.getElementById("start_button"));
var HTTPClient = function()
{