-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.filter.min.js
8 lines (8 loc) · 1.08 KB
/
jquery.filter.min.js
1
2
3
4
5
6
7
8
/*
* jQuery Filter Plugin 1.0
* www.sam-benne.co.uk
* Copyright 2012, Sam Bennett
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
;(function(a){var b=null;var c={init:function(d){b=a.extend({animationspeed:250,id:"filter",onCreate:null,onDestroy:null,onStop:null},d);return this.each(function(a){c.create()})},destroy:function(){if(typeof b.onDestroy==="function")b.onDestroy.call()},create:function(){a(document).on("click","#"+b.id+" [data-tag]",function(c){c.preventDefault();var d=a(this).data("tag");var e=new RegExp(d,"i");a("[data-tags]").each(function(c,d){if(a(d).data("tags").match(e)===null)a(d).fadeOut(b.animationspeed);else a(d).fadeIn(b.animationspeed)})});if(typeof b.onCreate==="function")b.onCreate.call()},stop:function(){if(typeof b.onStop==="function")b.onStop.call()},update:function(a){}};a.fn.filter=function(b){if(c[b]){return c[b].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof b==="object"||!b){return c.init.apply(this,arguments)}else{a.error("Method "+b+" does not exist on jQuery.filter")}}})(jQuery);