You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3 lines
2.6 KiB
3 lines
2.6 KiB
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
|
|
(function(t){"function"==typeof define&&define.amd&&define("uikit-notify",["uikit"],function(){return jQuery.UIkit.notify||t(window,window.jQuery,window.jQuery.UIkit)}),window&&window.jQuery&&window.jQuery.UIkit&&t(window,window.jQuery,window.jQuery.UIkit)})(function(t,e,i){var n={},s={},o=function(t){return"string"==e.type(t)&&(t={message:t}),arguments[1]&&(t=e.extend(t,"string"==e.type(arguments[1])?{status:arguments[1]}:arguments[1])),new r(t).show()},a=function(t,e){if(t)for(var i in s)t===s[i].group&&s[i].close(e);else for(var i in s)s[i].close(e)},r=function(t){this.options=e.extend({},r.defaults,t),this.uuid="ID"+(new Date).getTime()+"RAND"+Math.ceil(1e5*Math.random()),this.element=e(['<div class="uk-notify-message">','<a class="uk-close"></a>',"<div>"+this.options.message+"</div>","</div>"].join("")).data("notifyMessage",this),this.options.status&&(this.element.addClass("uk-notify-message-"+this.options.status),this.currentstatus=this.options.status),this.group=this.options.group,s[this.uuid]=this,n[this.options.pos]||(n[this.options.pos]=e('<div class="uk-notify uk-notify-'+this.options.pos+'"></div>').appendTo("body").on("click",".uk-notify-message",function(){e(this).data("notifyMessage").close()}))};return e.extend(r.prototype,{uuid:!1,element:!1,timout:!1,currentstatus:"",group:!1,show:function(){if(!this.element.is(":visible")){var t=this;n[this.options.pos].show().prepend(this.element);var e=parseInt(this.element.css("margin-bottom"),10);return this.element.css({opacity:0,"margin-top":-1*this.element.outerHeight(),"margin-bottom":0}).animate({opacity:1,"margin-top":0,"margin-bottom":e},function(){if(t.options.timeout){var e=function(){t.close()};t.timeout=setTimeout(e,t.options.timeout),t.element.hover(function(){clearTimeout(t.timeout)},function(){t.timeout=setTimeout(e,t.options.timeout)})}}),this}},close:function(t){var e=this,i=function(){e.element.remove(),n[e.options.pos].children().length||n[e.options.pos].hide(),delete s[e.uuid]};this.timeout&&clearTimeout(this.timeout),t?i():this.element.animate({opacity:0,"margin-top":-1*this.element.outerHeight(),"margin-bottom":0},function(){i()})},content:function(t){var e=this.element.find(">div");return t?(e.html(t),this):e.html()},status:function(t){return t?(this.element.removeClass("uk-notify-message-"+this.currentstatus).addClass("uk-notify-message-"+t),this.currentstatus=t,this):this.currentstatus}}),r.defaults={message:"",status:"",timeout:5e3,group:null,pos:"top-center"},i.notify=o,i.notify.message=r,i.notify.closeAll=a,o});
|