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>
<div class="pull-right">
<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>
</div>
</div>

View File

@ -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($('<option></option>', { 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();
}
}