Merge pull request #5178 from williamboman/fix-tabcomplete-hint

Fix search input hint not clearing properly.
This commit is contained in:
Geremia Taglialatela 2014-12-10 19:03:56 +01:00
commit 8bc1bd1c5d
2 changed files with 12 additions and 6 deletions

View File

@ -5,10 +5,10 @@
</div> </div>
<script> <script>
try { try {
var filterSet = JSON.parse('{{ icons | flattenIconFilters | jsonify }}'); window.filterSet = JSON.parse('{{ icons | flattenIconFilters | jsonify }}');
} catch (e) { } catch (e) {
console.error('Invalid JSON data!'); console.error('Invalid JSON data!');
var filterSet = []; window.filterSet = [];
} }
</script> </script>
<{% if page.navbar_active == "icons" %}div{% else %}section{% endif %} id="filter"> <{% if page.navbar_active == "icons" %}div{% else %}section{% endif %} id="filter">

View File

@ -21,13 +21,19 @@ $(function() {
arrowKeys: true arrowKeys: true
}); });
$clear.click(function(e) { $clear.on('click', function(e) {
e.preventDefault(); e.preventDefault();
$filter_by.val('').trigger('keyup').focus(); $filter_by
.val('')
.trigger('input')
.trigger('keyup')
.focus();
$clear.addClass('gone'); // Hide clear button
}); });
$filter_by.keyup(function() { $filter_by.on('keyup', function() {
var $this = $(this); var $this = $(this);
var val = $this.val().toLowerCase(); var val = $this.val().toLowerCase();
$filter.toggle(!!val); $filter.toggle(!!val);
@ -57,7 +63,7 @@ $(function() {
} else { } else {
$no_results.hide(); $no_results.hide();
} }
}).trigger('keyup'); });
} }
function inFilter(val, filter) { function inFilter(val, filter) {