zZzzZ.
home2
/
zrzvbdry
/
public_html
/
wp-content
/
plugins
/
wc-multi-currency
/
uilib
/
sliding-growl-notification
/
js
New Folder
Editing: notify.min.js
Save
Cancel
function notify(a){this.options=$.extend({style:"default",title:"",message:"",icon:"",theme:null,timeout:null,close_button:true,id:""},a||{});this.config=$.extend({theme:"default"},window.JSNOTIFY_CONFIG||{});this.id="";this.show=function(){var b=this.buildNotification();b.animate({right:"15px",opacity:1},500)};this.buildNotification=function(){var b=this.getNotificationId();var d=this.getNotificationClass();var j=this.getNotificationTitle();var l=this.getNotificationMessage();var i=this.getNotificationIcon();var h=this.getNotificationTimeout();var f=this.getNotificationClose();if(l===null){console.error("Message not set in notification");return false}if(j!==null){j='<span class="notify-body-title">'+j+"</span>"}else{j=""}if(i!==null){i='<div class="notification-body-icon">'+i+"</div>"}else{i=""}if(f===true){f='<div class="notify-action-buttons"><a href="#" class="notify-square-button notify-close-button"></a></div>'}else{f=""}var e=$('<div id="'+b+'" class="'+d+'"><div class="notify-body-wrapper"><div class="notify-body">'+i+j+'<div class="notify-body-text"></div></div>'+f+"</div></div>");e.find(".notify-body-text").append(l);if($("#notify-holster").length===0){$("body").append('<div id="notify-holster"></div>')}$("#notify-holster").prepend(e);var c=$("#"+b);notify_body=c.find(".notify-body");notify_body.find(".notification-body-icon").css({height:notify_body.height()});var k=this;if(f.length>0){var g=c.find(".notify-close-button")}else{var g=c}g.on("click",function(m){m.preventDefault();k.hide()});if(h!==null){setTimeout(function(){g.click()},h)}return c};this.hide=function(c){var d=$("#"+this.getNotificationId());var b=this;d.animate({right:"-360px",opacity:0},500,function(){b.destroy();if(typeof c=="function"){c()}})};this.destroy=function(){var b=$("#"+this.getNotificationId());b.remove();if($("#notify-holster").children().length===0){$("#notify-holster").remove()}};this.getNotificationIcon=function(){if(this.options.icon.length===0){return null}return'<i class="fa fa-'+this.options.icon+'"></i>'};this.getNotificationClose=function(){return this.options.close_button};this.getNotificationTimeout=function(){return this.options.timeout};this.getNotificationTitle=function(){if(this.options.title.length===0){return null}return this.options.title};this.getNotificationMessage=function(){if(this.options.message.length===0){return null}return this.options.message};this.getNotificationClass=function(){var b="notify notify-"+this.options.style;if(this.getNotificationIcon()!==null){b=b+" notify-with-icon"}if(this.options.theme===null){b=b+" notify-theme-"+this.config.theme}else{b=b+" notify-theme-"+this.options.theme}return b};this.getNotificationId=function(){if(this.id.length===0){this.id=this.makeId()}return this.id};this.makeId=function(){if(this.options.id!=""){return this.options.id}var d="";var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(var c=0;c<32;c++){d+=b.charAt(Math.floor(Math.random()*b.length))}return"notifyjs-"+d};return this};