Add filter reset on location change.

This commit is contained in:
Lars Jung 2014-06-10 00:30:32 +02:00
parent af29d651b5
commit a1ebf1f4fb
3 changed files with 41 additions and 2 deletions

View file

@ -67,6 +67,11 @@ modulejs.define('ext/filter', ['_', '$', 'core/settings', 'core/resource', 'core
return new RegExp(sequence, 'i');
},
reset = function () {
$input.val('').blur();
},
update = function (focus) {
var val = $input.val();
@ -103,12 +108,12 @@ modulejs.define('ext/filter', ['_', '$', 'core/settings', 'core/resource', 'core
.on('keydown', function (event) {
if (event.which === 27) {
$input.val('').blur();
reset();
}
})
.on('keypress', updt);
event.sub('location.changed', updf);
event.sub('location.changed', reset);
};
init();