bootstrap-list-filter
Advanced tools
Comparing version 0.1.6 to 0.1.7
/* | ||
* bootstrap-list-filter v0.1.6 - 2014-07-28 | ||
* bootstrap-list-filter v0.1.7 - 2014-11-18 | ||
* | ||
@@ -10,3 +10,3 @@ * Copyright 2014 Stefano Cudini | ||
* | ||
* Demo: | ||
* Demos: | ||
* http://labs.easyblog.it/bootstrap-list-filter/ | ||
@@ -18,2 +18,2 @@ * | ||
*/ | ||
!function(a){a.fn.btsListFilter=function(b,c){function d(a,b){return a.replace(/\{ *([\w_]+) *\}/g,function(a,c){return b[c]||""})}function e(a,b){var c;return b=b||300,function(){var d=this,e=arguments;clearTimeout(c),c=setTimeout(function(){a.apply(d,Array.prototype.slice.call(e))},b)}}var f,g=this,h=a(this),i=a(b),j=h;return c=a.extend({delay:300,minLength:1,initial:!0,eventKey:"keyup",resetOnBlur:!0,sourceData:null,sourceTmpl:'<a class="list-group-item" href="#"><span>{title}</span></a>',sourceNode:function(a){return d(c.sourceTmpl,a)},itemEl:".list-group-item",itemChild:null,itemFilter:function(b,d){d=d&&d.replace(new RegExp("[({[^.$*+?\\]})]","g"),"");var e=a(b).text(),f=c.initial?"^":"",g=new RegExp(f+d,"i");return g.test(e)}},c),i.on(c.eventKey,e(function(){var b=a(this).val();c.itemEl&&(j=h.find(c.itemEl)),c.itemChild&&(j=j.find(c.itemChild));var d=j.filter(function(){return c.itemFilter.call(g,this,b)}),e=j.not(d);c.itemChild&&(d=d.parents(c.itemEl),e=e.parents(c.itemEl).hide()),""!==b&&b.length>=c.minLength?(d.show(),e.hide(),"function"===a.type(c.sourceData)&&(d.hide(),e.hide(),f&&(a.isFunction(f.abort)?f.abort():a.isFunction(f.stop)&&f.stop()),f=c.sourceData.call(g,b,function(b){f=null,d.hide(),e.hide(),h.find(".bts-dynamic-item").remove();for(var i in b)a(c.sourceNode.call(g,b[i])).addClass("bts-dynamic-item").appendTo(h)}))):(d.show(),e.show(),h.find(".bts-dynamic-item").remove())},c.delay)),c.resetOnBlur&&i.on("blur",function(){a(this).val("").trigger(c.eventKey)}),h}}(jQuery); | ||
!function(a){a.fn.btsListFilter=function(b,c){function d(a,b){return a.replace(/\{ *([\w_]+) *\}/g,function(a,c){return b[c]||""})}function e(a,b){var c;return b=b||300,function(){var d=this,e=arguments;clearTimeout(c),c=setTimeout(function(){a.apply(d,Array.prototype.slice.call(e))},b)}}var f,g=this,h=a(this),i=a(b),j=h;return c=a.extend({delay:300,minLength:1,initial:!0,eventKey:"keyup",resetOnBlur:!0,sourceData:null,sourceTmpl:'<a class="list-group-item" href="#"><span>{title}</span></a>',sourceNode:function(a){return d(c.sourceTmpl,a)},emptyNode:function(){return'<a class="list-group-item well" href="#"><span>No Results</span></a>'},itemEl:".list-group-item",itemChild:null,itemFilter:function(b,d){d=d&&d.replace(new RegExp("[({[^.$*+?\\]})]","g"),"");var e=a(b).text(),f=c.initial?"^":"",g=new RegExp(f+d,"i");return g.test(e)}},c),i.on(c.eventKey,e(function(){var b=a(this).val();c.itemEl&&(j=h.find(c.itemEl)),c.itemChild&&(j=j.find(c.itemChild));var d=j.filter(function(){return c.itemFilter.call(g,this,b)}),e=j.not(d);c.itemChild&&(d=d.parents(c.itemEl),e=e.parents(c.itemEl).hide()),""!==b&&b.length>=c.minLength?(d.show(),e.hide(),"function"===a.type(c.sourceData)&&(d.hide(),e.hide(),f&&(a.isFunction(f.abort)?f.abort():a.isFunction(f.stop)&&f.stop()),f=c.sourceData.call(g,b,function(b){if(f=null,d.hide(),e.hide(),h.find(".bts-dynamic-item").remove(),b&&0!==b.length)for(var i in b)a(c.sourceNode.call(g,b[i])).addClass("bts-dynamic-item").appendTo(h);else a(c.emptyNode.call(g)).addClass("bts-dynamic-item").appendTo(h)}))):(d.show(),e.show(),h.find(".bts-dynamic-item").remove())},c.delay)),c.resetOnBlur&&i.on("blur",function(){a(this).val("").trigger(c.eventKey)}),h}}(jQuery); |
@@ -41,2 +41,5 @@ | ||
}, | ||
emptyNode: function(data) { | ||
return '<a class="list-group-item well" href="#"><span>No Results</span></a>'; | ||
}, | ||
itemEl: '.list-group-item', | ||
@@ -101,4 +104,8 @@ itemChild: null, | ||
searchlist$.find('.bts-dynamic-item').remove(); | ||
for(var i in data) | ||
$( options.sourceNode.call(searchlist, data[i]) ).addClass('bts-dynamic-item').appendTo(searchlist$); | ||
if(!data || data.length===0) | ||
$( options.emptyNode.call(searchlist) ).addClass('bts-dynamic-item').appendTo(searchlist$); | ||
else | ||
for(var i in data) | ||
$( options.sourceNode.call(searchlist, data[i]) ).addClass('bts-dynamic-item').appendTo(searchlist$); | ||
}); | ||
@@ -105,0 +112,0 @@ } |
{ | ||
"name": "bootstrap-list-filter", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"main": "bootstrap-list-filter.min.js", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/stefanocudini/bootstrap-list-filter", |
@@ -12,3 +12,3 @@ 'use strict'; | ||
' * \n'+ | ||
' * Copyright 2014 <%= pkg.author.name %> \n'+ | ||
' * Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> \n'+ | ||
' * <%= pkg.author.email %> \n'+ | ||
@@ -19,3 +19,3 @@ ' * <%= pkg.author.url %> \n'+ | ||
' * \n'+ | ||
' * Demo: \n'+ | ||
' * Demos: \n'+ | ||
' * <%= pkg.homepage %> \n'+ | ||
@@ -54,3 +54,3 @@ ' * \n'+ | ||
} | ||
}, | ||
}, | ||
markdown: { | ||
@@ -57,0 +57,0 @@ readme: { |
{ | ||
"name": "bootstrap-list-filter", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Search widget to filter Bootstrap lists", | ||
@@ -5,0 +5,0 @@ "repository": { |
{ | ||
"name": "bootstrap-list-filter", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Search widget to filter Bootstrap lists", | ||
@@ -5,0 +5,0 @@ "homepage": "http://labs.easyblog.it/bootstrap-list-filter/", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
89185
348