Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bootstrap-list-filter

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bootstrap-list-filter - npm Package Compare versions

Comparing version 0.2.3 to 0.2.5

examples/multiple-field.html

6

bootstrap-list-filter.min.js
/*
* bootstrap-list-filter v0.2.2 - 2015-09-21
* bootstrap-list-filter v0.2.5 - 2016-04-20
*
* Copyright 2015 Stefano Cudini
* Copyright 2016 Stefano Cudini
* stefano.cudini@gmail.com

@@ -17,2 +17,2 @@ * http://labs.easyblog.it/

*/
!function(a){a.fn.btsListFilter=function(b,c){"use strict";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,h=this,i=a(this),j=a(b),k=i;return c=a.extend({delay:300,minLength:1,initial:!0,casesensitive:!1,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(a){return'<a class="list-group-item well" href="#"><span>No Results</span></a>'},itemClassTmp:"bts-dynamic-item",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,c.casesensitive?"":"i");return g.test(e)},cancelNode:function(){return'<span class="btn glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>'}},c),h.reset=function(){j.val("").trigger(c.eventKey)},a.isFunction(c.cancelNode)&&(f=a(c.cancelNode.call(h)),j.after(f),j.parents(".form-group").addClass("has-feedback"),j.prev().is(".control-label")||f.css({top:0}),f.on("click",h.reset)),j.on(c.eventKey,e(function(b){var d=a(this).val();c.itemEl&&(k=i.find(c.itemEl)),c.itemChild&&(k=k.find(c.itemChild));var e=k.filter(function(){return c.itemFilter.call(h,this,d)}),f=k.not(e);c.itemChild&&(e=e.parents(c.itemEl),f=f.parents(c.itemEl).hide()),""!==d&&d.length>=c.minLength?(e.show(),f.hide(),"function"===a.type(c.sourceData)?(e.hide(),f.hide(),g&&(a.isFunction(g.abort)?g.abort():a.isFunction(g.stop)&&g.stop()),g=c.sourceData.call(h,d,function(b){if(g=null,e.hide(),f.hide(),i.find("."+c.itemClassTmp).remove(),b&&0!==b.length)for(var d in b)a(c.sourceNode.call(h,b[d])).addClass(c.itemClassTmp).appendTo(i);else a(c.emptyNode.call(h)).addClass(c.itemClassTmp).appendTo(i)})):(i.find("."+c.itemClassTmp).remove(),0===e.length&&a(c.emptyNode.call(h)).addClass(c.itemClassTmp).appendTo(i))):(e.show(),f.show(),i.find("."+c.itemClassTmp).remove())},c.delay)),c.resetOnBlur&&j.on("blur",function(a){h.reset()}),i}}(jQuery);
!function(a){a.fn.btsListFilter=function(b,c){"use strict";function d(a,b){return a.replace(/\{ *([\w_]+) *\}/g,function(a,c){return b[c]||""})}function e(b,d){d=d&&d.replace(new RegExp("[({[^.$*+?\\]})]","g"),"");var e=a(b).text(),f=c.initial?"^":"",g=new RegExp(f+d,c.casesensitive?"":"i");return g.test(e)}function f(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 g,h,i=this,j=a(this),k=a(b),l=j;return c=a.extend({delay:300,minLength:1,initial:!0,casesensitive:!1,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(a){return'<a class="list-group-item well" href="#"><span>No Results</span></a>'},cancelNode:function(){return'<span class="btn glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>'},itemClassTmp:"bts-dynamic-item",itemEl:".list-group-item",itemChild:null,itemFilter:e},c),i.reset=function(){k.val("").trigger(c.eventKey)},a.isFunction(c.cancelNode)&&(g=a(c.cancelNode.call(i)),k.after(g),k.parents(".form-group").addClass("has-feedback"),k.prev().is(".control-label")||g.css({top:0}),g.css({"pointer-events":"auto"}),g.on("click",i.reset)),k.on(c.eventKey,f(function(b){var d=a(this).val();c.itemEl&&(l=j.find(c.itemEl)),c.itemChild&&(l=l.find(c.itemChild));var e=l.filter(function(){return c.itemFilter.call(i,this,d)}),f=l.not(e);c.itemChild&&(e=e.parents(c.itemEl),f=f.parents(c.itemEl).hide()),""!==d&&d.length>=c.minLength?(e.show(),f.hide(),"function"===a.type(c.sourceData)?(e.hide(),f.hide(),h&&(a.isFunction(h.abort)?h.abort():a.isFunction(h.stop)&&h.stop()),h=c.sourceData.call(i,d,function(b){if(h=null,e.hide(),f.hide(),j.find("."+c.itemClassTmp).remove(),b&&0!==b.length)for(var g in b)a(c.sourceNode.call(i,b[g])).addClass(c.itemClassTmp).appendTo(j);else a(c.emptyNode.call(i,d)).addClass(c.itemClassTmp).appendTo(j)})):(j.find("."+c.itemClassTmp).remove(),0===e.length&&a(c.emptyNode.call(i,d)).addClass(c.itemClassTmp).appendTo(j))):(e.show(),f.show(),j.find("."+c.itemClassTmp).remove())},c.delay)),c.resetOnBlur&&k.on("blur",function(a){i.reset()}),j}}(jQuery);

@@ -15,2 +15,19 @@

function tmpl(str, data) {
return str.replace(/\{ *([\w_]+) *\}/g, function (str, key) {
return data[key] || '';
});
}
function defaultItemFilter(item, val) {
val = val && val.replace(new RegExp("[({[^.$*+?\\\]})]","g"),'');
//sanitize regexp
var text = $(item).text(),
i = opts.initial ? '^' : '',
regSearch = new RegExp(i + val, opts.casesensitive ? '' : 'i');
return regSearch.test( text );
}
opts = $.extend({

@@ -31,26 +48,11 @@ delay: 300,

},
cancelNode: function() {
return '<span class="btn glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>';
},
itemClassTmp: 'bts-dynamic-item',
itemEl: '.list-group-item',
itemChild: null,
itemFilter: function(item, val) {
//val = val.replace(new RegExp("^[.]$|[\[\]|()*]",'g'),'');
//val = val.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
val = val && val.replace(new RegExp("[({[^.$*+?\\\]})]","g"),'');
var text = $(item).text(),
i = opts.initial?'^':'',
regSearch = new RegExp(i + val, opts.casesensitive?'':'i');
return regSearch.test( text );
},
cancelNode: function() {
return '<span class="btn glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>';
}
}, opts);
itemFilter: defaultItemFilter
}, opts);
function tmpl(str, data) {
return str.replace(/\{ *([\w_]+) *\}/g, function (str, key) {
return data[key] || '';
});
}
function debouncer(func, timeout) {

@@ -80,4 +82,6 @@ var timeoutID;

if(!inputEl$.prev().is('.control-label'))
cancelEl$.css({top: 0})
cancelEl$.css({top: 0});
cancelEl$.css({'pointer-events': 'auto'});
cancelEl$.on('click', self.reset);

@@ -132,3 +136,3 @@ }

if(!data || data.length===0)
$( opts.emptyNode.call(self) ).addClass(opts.itemClassTmp).appendTo(searchlist$);
$( opts.emptyNode.call(self, val) ).addClass(opts.itemClassTmp).appendTo(searchlist$);
else

@@ -143,3 +147,3 @@ for(var i in data)

if(contains.length===0)
$( opts.emptyNode.call(self) ).addClass(opts.itemClassTmp).appendTo(searchlist$);
$( opts.emptyNode.call(self, val) ).addClass(opts.itemClassTmp).appendTo(searchlist$);
}

@@ -146,0 +150,0 @@

{
"name": "bootstrap-list-filter",
"version": "0.2.2",
"version": "0.2.5",
"main": "bootstrap-list-filter.min.js",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/stefanocudini/bootstrap-list-filter",

Package.describe({
version: "0.2.2",
name: "bootstrap-list-filter",
summary: "bootstrap-list-filter"
version: "0.2.5",
name: "stefcud:bootstrap-list-filter",
summary: "bootstrap-list-filter",
git: "https://github.com/stefanocudini/bootstrap-list-filter.git"
});

@@ -9,3 +10,3 @@

api.use('bootstrap-3', 'client');
api.add_files('bootstrap-list-filter.min.js', 'client');
api.addFiles('bootstrap-list-filter.min.js', 'client');
});
{
"name": "bootstrap-list-filter",
"version": "0.2.3",
"version": "0.2.5",
"description": "Search widget to filter Bootstrap lists",

@@ -5,0 +5,0 @@ "main": "bootstrap-list-filter.src.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc