Enable and disable forget button
This commit is contained in:
parent
11d25531a4
commit
16da52d53f
@ -19,7 +19,8 @@
|
|||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<big>Visualizer</big>
|
<big>Visualizer</big>
|
||||||
<div class="pull-right">
|
<div class="btn-group pull-right">
|
||||||
|
<button class="btn btn-xs btn-default" id="forget">Forget</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>
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
$.getJSON('/search', _ctx.query, function(results) {
|
$.getJSON('/search', _ctx.query, function(results) {
|
||||||
saveSnapshot(results);
|
saveSnapshot(results);
|
||||||
outputSnapshot(results);
|
outputSnapshot(results);
|
||||||
$('#customized').show();
|
setCustomized(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,15 +60,16 @@
|
|||||||
$('#searchKeyword').append($('<option></option>', { value: keyword, text: keyword }));
|
$('#searchKeyword').append($('<option></option>', { value: keyword, text: keyword }));
|
||||||
}
|
}
|
||||||
|
|
||||||
search();
|
onSearch();
|
||||||
|
|
||||||
$('#searchKeyword,#minScore,#hintSteps,#maxResults').change(function() {
|
|
||||||
search();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
$('#searchKeyword,#minScore,#hintSteps,#maxResults').change(onSearch);
|
||||||
$('#historyIndex').on('slideStop', onSelectSnapshot);
|
$('#historyIndex').on('slideStop', onSelectSnapshot);
|
||||||
|
$('#learn').click(onLearn);
|
||||||
|
$('#forget').click(onForget);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$('#learn').click(function() {
|
function onLearn() {
|
||||||
var keyword = prompt('Input keyword to learn as (alphanumeric, no spaces)');
|
var keyword = prompt('Input keyword to learn as (alphanumeric, no spaces)');
|
||||||
if (keyword === null) {
|
if (keyword === null) {
|
||||||
return;
|
return;
|
||||||
@ -89,11 +90,13 @@
|
|||||||
alert('Failed to learn keyword');
|
alert('Failed to learn keyword');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function search() {
|
function onForget() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSearch() {
|
||||||
var keyword = $('#searchKeyword').val();
|
var keyword = $('#searchKeyword').val();
|
||||||
|
|
||||||
_ctx.query = {
|
_ctx.query = {
|
||||||
@ -134,14 +137,14 @@
|
|||||||
$.getJSON('/search', _ctx.query, function(results) {
|
$.getJSON('/search', _ctx.query, function(results) {
|
||||||
saveSnapshot(results);
|
saveSnapshot(results);
|
||||||
outputSnapshot(results);
|
outputSnapshot(results);
|
||||||
$('#customized').hide();
|
setCustomized(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSelectSnapshot() {
|
function onSelectSnapshot() {
|
||||||
var index = $('#historyIndex').slider('getValue');
|
var index = $('#historyIndex').slider('getValue');
|
||||||
outputSnapshot(_ctx.log[index]);
|
outputSnapshot(_ctx.log[index]);
|
||||||
$('#customized').show();
|
setCustomized(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveSnapshot(results) {
|
function saveSnapshot(results) {
|
||||||
@ -157,6 +160,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setCustomized(customized) {
|
||||||
|
$('#forget').prop('disabled', customized);
|
||||||
|
if (customized) {
|
||||||
|
$('#customized').show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#customized').hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function outputSnapshot(results) {
|
function outputSnapshot(results) {
|
||||||
for (var name in results.columns) {
|
for (var name in results.columns) {
|
||||||
_ctx.query.features[name] = results.columns[name].value;
|
_ctx.query.features[name] = results.columns[name].value;
|
||||||
|
Loading…
Reference in New Issue
Block a user