This commit is contained in:
chad3814 2016-06-13 19:34:29 +00:00 committed by GitHub
commit 152e947665

View file

@ -43,7 +43,7 @@ function Scratch(project_id) {
project.val(project_id);
// Validate project ID field
project.keyup(function() {
project.keyup(function(evnt) {
var n = this.value;
// Allow URL pasting
@ -54,7 +54,12 @@ function Scratch(project_id) {
// Eventually, this will xhr to /projects/{{this.value}}/ and
// change color based on whether the response is 404 or 200.
$('#project-id, #address-hint').toggleClass('error', isNaN(n));
if (isNaN(n)) {
$('#project-id, #address-hint').toggleClass('error', true);
} else if (evnt.keyCode === 13) {
// simulate click on #go-project
$('#go-project').click();
}
});
// Focus the actual input when the user clicks on the URL hint