From 0d173835ee7f411cbfe39b8d0d3bb9dbd8a0acda Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sat, 13 Jul 2013 00:31:51 +0200 Subject: Handle enter key in lexer dropdown's text input Before it would simply redirect to "base_url/ID/?", now if you enter "foo" in the text box and don't select any value below you will go to "base_url/ID/foo". Signed-off-by: Florian Pritz --- data/js/script.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data/js/script.js b/data/js/script.js index 3f145d1be..a7cf3aa54 100644 --- a/data/js/script.js +++ b/data/js/script.js @@ -32,6 +32,12 @@ function fixedEncodeURIComponent (str) { } }); + $(document).on("keyup", "#language", function(event) { + if (event.keyCode == 13) { + window.location = window.paste_base + '/' + fixedEncodeURIComponent($(this).val()); + } + }); + $('#language-toggle').click(function() { setTimeout(function() { $('#language').focus(); -- cgit v1.2.3-24-g4f1b