mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-23 16:01:26 +00:00
3 lines
2.5 KiB
JavaScript
Executable File
3 lines
2.5 KiB
JavaScript
Executable File
/*! UIkit 2.9.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
|
|
!function(a){var b;jQuery&&jQuery.UIkit&&(b=a(jQuery,jQuery.UIkit)),"function"==typeof define&&define.amd&&define("uikit-notify",["uikit"],function(){return b||a(jQuery,jQuery.UIkit)})}(function(a,b){var c={},d={},e=function(b){return"string"==a.type(b)&&(b={message:b}),arguments[1]&&(b=a.extend(b,"string"==a.type(arguments[1])?{status:arguments[1]}:arguments[1])),new g(b).show()},f=function(a,b){if(a)for(var c in d)a===d[c].group&&d[c].close(b);else for(var c in d)d[c].close(b)},g=function(b){this.options=a.extend({},g.defaults,b),this.uuid="ID"+(new Date).getTime()+"RAND"+Math.ceil(1e5*Math.random()),this.element=a(['<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,d[this.uuid]=this,c[this.options.pos]||(c[this.options.pos]=a('<div class="uk-notify uk-notify-'+this.options.pos+'"></div>').appendTo("body").on("click",".uk-notify-message",function(){a(this).data("notifyMessage").close()}))};return a.extend(g.prototype,{uuid:!1,element:!1,timout:!1,currentstatus:"",group:!1,show:function(){if(!this.element.is(":visible")){var a=this;c[this.options.pos].show().prepend(this.element);var b=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":b},function(){if(a.options.timeout){var b=function(){a.close()};a.timeout=setTimeout(b,a.options.timeout),a.element.hover(function(){clearTimeout(a.timeout)},function(){a.timeout=setTimeout(b,a.options.timeout)})}}),this}},close:function(a){var b=this,e=function(){b.element.remove(),c[b.options.pos].children().length||c[b.options.pos].hide(),b.options.onClose.apply(b,[]),delete d[b.uuid]};this.timeout&&clearTimeout(this.timeout),a?e():this.element.animate({opacity:0,"margin-top":-1*this.element.outerHeight(),"margin-bottom":0},function(){e()})},content:function(a){var b=this.element.find(">div");return a?(b.html(a),this):b.html()},status:function(a){return a?(this.element.removeClass("uk-notify-message-"+this.currentstatus).addClass("uk-notify-message-"+a),this.currentstatus=a,this):this.currentstatus}}),g.defaults={message:"",status:"",timeout:5e3,group:null,pos:"top-center",onClose:function(){}},b.notify=e,b.notify.message=g,b.notify.closeAll=f,e}); |