/* jQuery.loader Plugin * @author Stéphan Zych * @copyriht 2010-2011 Stéphan Zych * @license New BSD License */ (function(e){"use strict";var t=function(e,t){for(var n in t)e=e.replace(new RegExp("{"+n+"}","g"),t[n]);return e},n=function(){var n={className:"loader",tpl:'
',delay:200,loader:!0,overlay:!0,onHide:function(){},onShow:function(){}},r=function(r){return this.each(function(){n=e.extend({},n,r);var i=e(this),s;i.append(t(n.tpl,n));s=e("> ."+n.className,i);n.overlay&&s.addClass("overlay");n.loader&&e("."+n.className+"-load",s).on("click",function(){i.loader("hide",n.onHide)})})},i=function(t){n=e.extend({},n,t);var i=this,s=e(i),o=e("> ."+n.className+":first",s);if(!o.length){r.call(i,t);o=e("> ."+n.className+":first",s)}o.fadeIn(n.delay,function(){o.removeClass("hide");n.onShow(n)})},s=function(t){n=e.extend({},n,{onHide:t});var r=this,i=e(r),s=e("> ."+n.className+":first",i);s.length&&s.fadeOut(n.delay,function(){s.addClass("hide");n.onHide(n)})};return{init:r,show:i,hide:s}};e.fn.loader=function(t){e.data(this,"loader")||e.data(this,"loader",new n(this,t));var r=e.data(this,"loader");if(r[t])return r[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t=="object"||!t)return r.init.apply(this,arguments);e.error('Method "'+arguments[0]+'" does not exist in $.loader plugin!')}})(jQuery);