1

Adding reset button, fixing references to features

This commit is contained in:
Alex Yatskov 2014-11-09 12:57:28 +09:00
parent 5ad9f71451
commit 1d49c6ac30
2 changed files with 6 additions and 2 deletions

View File

@ -21,6 +21,7 @@
<big>Visualizer</big> <big>Visualizer</big>
<div class="pull-right"> <div class="pull-right">
<button class="btn btn-xs btn-danger" id="forget">Forget</button> <button class="btn btn-xs btn-danger" id="forget">Forget</button>
<button class="btn btn-xs btn-warning" style="display: none;" id="reset">Reset</button>
<button class="btn btn-xs btn-default" id="learn">Learn</button> <button class="btn btn-xs btn-default" id="learn">Learn</button>
</div> </div>
</div> </div>

View File

@ -65,6 +65,7 @@
$('#historyIndex').on('slideStop', onSelectSnapshot); $('#historyIndex').on('slideStop', onSelectSnapshot);
$('#learn').click(onLearn); $('#learn').click(onLearn);
$('#forget').click(onForget); $('#forget').click(onForget);
$('#reset').click(onSearch);
}); });
} }
@ -81,7 +82,7 @@
$.getJSON('/add_keyword', query, function(results) { $.getJSON('/add_keyword', query, function(results) {
if (results.success) { if (results.success) {
_ctx.parameters.keywords[keyword] = query.features; _ctx.parameters.keywords[keyword] = _.clone(query.features);
$('#searchKeyword').append($('<option></option>', { value: keyword, text: keyword })); $('#searchKeyword').append($('<option></option>', { value: keyword, text: keyword }));
$('#searchKeyword').val(keyword); $('#searchKeyword').val(keyword);
setCustomized(false); setCustomized(false);
@ -117,7 +118,7 @@
var keyword = $('#searchKeyword').val(); var keyword = $('#searchKeyword').val();
_ctx.query = { _ctx.query = {
features: _ctx.parameters.keywords[keyword], features: _.clone(_ctx.parameters.keywords[keyword]),
range: { min: -1.0, max: 1.0 }, range: { min: -1.0, max: 1.0 },
minScore: parseFloat($('#minScore').val()), minScore: parseFloat($('#minScore').val()),
hintSteps: parseInt($('#hintSteps').val()), hintSteps: parseInt($('#hintSteps').val()),
@ -180,10 +181,12 @@
function setCustomized(customized) { function setCustomized(customized) {
if (customized) { if (customized) {
$('#customized').show(); $('#customized').show();
$('#reset').show();
$('#forget').hide(); $('#forget').hide();
} }
else { else {
$('#customized').hide(); $('#customized').hide();
$('#reset').hide();
$('#forget').show(); $('#forget').show();
} }
} }