/*! jQuery Searcher Plugin - v0.1.0 - 2014-01-06 * https://github.com/lloiser/jquery-searcher/ * Copyright (c) 2014 Lukas Beranek; Licensed MIT */ !function(a){"use strict";function b(b,c){this.element=b,this.options=a.extend({},e,c),this._create()}var c="searcher",d="plugin_"+c,e={itemSelector:"tbody > tr",textSelector:"td",inputSelector:"",caseSensitive:!1,toggle:function(b,c){a(b).toggle(c)}};b.prototype={_create:function(){this._$element=a(this.element);var b=a.proxy(this._onValueChange,this);this._$input=a(this.options.inputSelector).bind("input change keyup",b),this._lastValue=""},_onValueChange:function(){var b=this.options,c=b.textSelector,d=b.caseSensitive,e=b.toggle,f=this._$input.val();d||(f=f.toLowerCase()),f!==this._lastValue&&(this._lastValue=f,this._$element.find(b.itemSelector).each(function(){var b=a(this),g=b;c&&(g=b.find(c)),g=g.filter(function(){var b=a(this).text();return d||(b=b.toLowerCase()),b.indexOf(f)>=0}),e(this,g.length>0)}))}},a.fn[c]=function(c){return this.each(function(){var e=a.data(this,d);e?a.extend(e.options,c):a.data(this,d,new b(this,c))})}}(jQuery,window,document);