mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-30 16:40:28 +01:00
2 lines
32 KiB
JavaScript
2 lines
32 KiB
JavaScript
|
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){"function"!=typeof Object.create&&(Object.create=function(a){function b(){}return b.prototype=a,new b});var b={init:function(b){if(this.options=a.extend({},a.noty.defaults,b),this.options.layout=this.options.custom?a.noty.layouts.inline:a.noty.layouts[this.options.layout],a.noty.themes[this.options.theme]?(this.options.theme=a.noty.themes[this.options.theme],this.options.theme.template&&(this.options.template=this.options.theme.template),this.options.theme.animation&&(this.options.animation=this.options.theme.animation)):this.options.themeClassName=this.options.theme,this.options=a.extend({},this.options,this.options.layout.options),this.options.id){if(a.noty.store[this.options.id])return a.noty.store[this.options.id]}else this.options.id="noty_"+(new Date).getTime()*Math.floor(1e6*Math.random());return this._build(),this},_build:function(){var b=a('<div class="noty_bar noty_type_'+this.options.type+'"></div>').attr("id",this.options.id);if(b.append(this.options.template).find(".noty_text").html(this.options.text),this.$bar=null!==this.options.layout.parent.object?a(this.options.layout.parent.object).css(this.options.layout.parent.css).append(b):b,this.options.themeClassName&&this.$bar.addClass(this.options.themeClassName).addClass("noty_container_type_"+this.options.type),this.options.buttons){var c;this.$bar.find(".noty_buttons").length>0?c=this.$bar.find(".noty_buttons"):(c=a("<div/>").addClass("noty_buttons"),null!==this.options.layout.parent.object?this.$bar.find(".noty_bar").append(c):this.$bar.append(c));var d=this;a.each(this.options.buttons,function(b,e){var f=a("<button/>").addClass(e.addClass?e.addClass:"gray").html(e.text).attr("id",e.id?e.id:"button-"+b).attr("title",e.title).appendTo(c).on("click",function(b){a.isFunction(e.onClick)&&e.onClick.call(f,d,b)})})}else this.$bar.find(".noty_buttons").remove();if(this.options.progressBar&&this.options.timeout){var e=a("<div/>").addClass("noty_progress_bar");null!==this.options.layout.parent.object?this.$bar.find(".noty_bar").append(e):this.$bar.append(e)}this.$message=this.$bar.find(".noty_message"),this.$closeButton=this.$bar.find(".noty_close"),this.$buttons=this.$bar.find(".noty_buttons"),this.$progressBar=this.$bar.find(".noty_progress_bar"),a.noty.store[this.options.id]=this},show:function(){var b=this;return b.options.custom?b.options.custom.find(b.options.layout.container.selector).append(b.$bar):a(b.options.layout.container.selector).append(b.$bar),b.options.theme&&b.options.theme.style&&b.options.theme.style.apply(b),"function"===a.type(b.options.layout.css)?this.options.layout.css.apply(b.$bar):b.$bar.css(this.options.layout.css||{}),b.$bar.addClass(b.options.layout.addClass),b.options.layout.container.style.apply(a(b.options.layout.container.selector),[b.options.within]),b.showing=!0,b.options.theme&&b.options.theme.style&&b.options.theme.callback.onShow.apply(this),a.inArray("click",b.options.closeWith)>-1&&b.$bar.css("cursor","pointer").on("click",function(a){b.stopPropagation(a),b.options.callback.onCloseClick&&b.options.callback.onCloseClick.apply(b),b.close()}),a.inArray("hover",b.options.closeWith)>-1&&b.$bar.one("mouseenter",function(){b.close()}),a.inArray("button",b.options.closeWith)>-1&&b.$closeButton.one("click",function(a){b.stopPropagation(a),b.close()}),a.inArray("button",b.options.closeWith)==-1&&b.$closeButton.remove(),b.options.callback.beforeShow&&b.options.callback.beforeShow.apply(b),"string"==typeof b.options.animation.open?(b.animationTypeOpen="css",b.$bar.css("min-height",b.$bar.innerHeight()),b.$bar.on("click",function(a){b.wasClicked=!0}),b.$bar.show(),b.options.callback.onShow&&b.options.callback.onShow.apply(b),b.$bar.addClass(b.options.animation.open).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){b.options.callback.afterShow&&b.options.callback.afterShow.apply(b),b.showing=!1,b.shown=!0,b.bindTimeout(),b.hasOwnPro
|
||
|
this.$message.addClass("huge");break;case"massive":this.$message.addClass("massive")}switch(this.options.type){case"info":this.$message.addClass("info");break;case"warning":this.$message.addClass("warning");break;case"error":this.$message.addClass("error");break;case"negative":this.$message.addClass("negative");break;case"success":this.$message.addClass("success");break;case"positive":this.$message.addClass("positive");break;case"floating":this.$message.addClass("floating")}},callback:{onShow:function(){this.$bar.addClass("transition"),this.$bar.transition(this.options.animation.open)},onClose:function(){this.$bar.transition(this.options.animation.close)}}},window.noty});
|