Sha256: 489dd22e4729ad84dfe90f460ab7f62300cb654d61fc2b1c1c126e8480bbbb62
Contents?: true
Size: 1.8 KB
Versions: 14
Compression:
Stored size: 1.8 KB
Contents
I"*(function() { if (typeof window.Alchemy === 'undefined') { window.Alchemy = {}; } Alchemy.ListFilterHandler = (function() { function ListFilterHandler(filter) { this.filter_field = $(filter); this.items = $(this.filter_field.data('alchemy-list-filter')); this.clear = this.filter_field.siblings('.js_filter_field_clear'); this._observe(); } ListFilterHandler.prototype._observe = function() { this.filter_field.on('keyup', (function(_this) { return function(e) { _this.clear.show(); return _this._filter(_this.filter_field.val()); }; })(this)); this.clear.click((function(_this) { return function(e) { e.preventDefault(); return _this._clear(); }; })(this)); this.filter_field.focus(function() { return key.setScope('list_filter'); }); return key('esc', 'list_filter', (function(_this) { return function() { _this._clear(); return _this.filter_field.blur(); }; })(this)); }; ListFilterHandler.prototype._filter = function(term) { if (term === '') { this.clear.hide(); } return this.items.map(function() { var item; item = $(this); if (item.attr('name').toLowerCase().indexOf(term.toLowerCase()) !== -1) { return item.show(); } else { return item.hide(); } }); }; ListFilterHandler.prototype._clear = function() { this.filter_field.val(''); return this._filter(''); }; return ListFilterHandler; })(); Alchemy.ListFilter = function(scope) { return $('[data-alchemy-list-filter]', scope).map(function() { return new Alchemy.ListFilterHandler(this); }); }; }).call(this); :ET
Version data entries
14 entries across 11 versions & 2 rubygems