1

Improvements to keyword adding

This commit is contained in:
Alex Yatskov 2014-11-09 06:49:01 +09:00
parent 1225d605c3
commit dcd777610a

View File

@ -68,8 +68,8 @@
$('#historyIndex').on('slideStop', onSelectSnapshot); $('#historyIndex').on('slideStop', onSelectSnapshot);
$('#learn').click(function() { $('#learn').click(function() {
var keyword = prompt('Input keyword to learn as'); var keyword = prompt('Input keyword to learn as (alphanumeric, no spaces)');
if (name === null) { if (keyword === null) {
return; return;
} }
@ -80,7 +80,9 @@
$.getJSON('/add_keyword', query, function(results) { $.getJSON('/add_keyword', query, function(results) {
if (results.success) { if (results.success) {
_ctx.parameters.keywords[keyword] = query.features;
$('#searchKeyword').append($('<option></option>', { value: keyword, text: keyword }));
$('#searchKeyword').val(keyword);
} }
else { else {
alert('Failed to learn keyword'); alert('Failed to learn keyword');