From 1d49c6ac30fa89c9e2d160c8f1f5917ba44c6ac3 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 9 Nov 2014 12:57:28 +0900 Subject: [PATCH] Adding reset button, fixing references to features --- client/html/index.html | 1 + client/scripts/application.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client/html/index.html b/client/html/index.html index 806c75a..ed00aa1 100644 --- a/client/html/index.html +++ b/client/html/index.html @@ -21,6 +21,7 @@ Visualizer
+
diff --git a/client/scripts/application.js b/client/scripts/application.js index a017890..4909d56 100644 --- a/client/scripts/application.js +++ b/client/scripts/application.js @@ -65,6 +65,7 @@ $('#historyIndex').on('slideStop', onSelectSnapshot); $('#learn').click(onLearn); $('#forget').click(onForget); + $('#reset').click(onSearch); }); } @@ -81,7 +82,7 @@ $.getJSON('/add_keyword', query, function(results) { if (results.success) { - _ctx.parameters.keywords[keyword] = query.features; + _ctx.parameters.keywords[keyword] = _.clone(query.features); $('#searchKeyword').append($('', { value: keyword, text: keyword })); $('#searchKeyword').val(keyword); setCustomized(false); @@ -117,7 +118,7 @@ var keyword = $('#searchKeyword').val(); _ctx.query = { - features: _ctx.parameters.keywords[keyword], + features: _.clone(_ctx.parameters.keywords[keyword]), range: { min: -1.0, max: 1.0 }, minScore: parseFloat($('#minScore').val()), hintSteps: parseInt($('#hintSteps').val()), @@ -180,10 +181,12 @@ function setCustomized(customized) { if (customized) { $('#customized').show(); + $('#reset').show(); $('#forget').hide(); } else { $('#customized').hide(); + $('#reset').hide(); $('#forget').show(); } }