Sha256: 91fc0bf626d68874ab612a8ad85d63b77a4b39362fdcd88aa4efe4968374f00b

Contents?: true

Size: 1.22 KB

Versions: 85

Compression:

Stored size: 1.22 KB

Contents

/*
 * Plugin Name: QuickFilter
 * Author: Collin Henderson (collin@syropia.net)
 * Version: 1.0
 * © 2012, http://syropia.net
 * You are welcome to freely use and modify this script in your personal and commercial products. Please don't sell it or release it as your own work. Thanks!
*/
(function($){
$.extend($.expr[':'], {missing: function (elem, index, match) {
    return (elem.textContent || elem.innerText || "").toLowerCase().indexOf(match[3]) == -1;
}});
$.extend($.expr[':'], {exists: function(elem, i, match, array){
    return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
}});
$.extend($.fn,{
    quickfilter: function(el){
         return this.each(function(){
            var _this = $(this);
            var query = _this.val().toLowerCase();
            _this.keyup(function () {
                query = $(this).val().toLowerCase();
                if(query.replace(/\s/g,"") != ""){
                    $(el+':exists("' + query.toString() + '")').show();
                    $(el+':missing("' + query.toString() + '")').hide();
                }
                else {
                    $(el).show();
                }
            });
        });
    }
});
})(jQuery);

Version data entries

85 entries across 85 versions & 1 rubygems

Version Path
padma-assets-0.3.36 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.35 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.34 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.33 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.32 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.31 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.30 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.29 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.28 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.27 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.26 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.25 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.24 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.23 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.22 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.21 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.20 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.19 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.17 app/assets/javascripts/jquery.quickfilter.js
padma-assets-0.3.16 app/assets/javascripts/jquery.quickfilter.js