Current File : /pages/54/47/d0016649/home/htdocs/ipc1/wp-content/themes/lhst/cloudfw/js/notifications.min.js
/*!
 * Envision
 * 
 * @version 3.2.0
 * 
 * @author Wptation
 * @link http://envision.wptation.com/
 * @license ThemeForest Split Licence
 * @copyright 2019
 */

!function(f){jQuery(document).ready(function(){jQuery('<div id="overlays"></div>').appendTo("body")}),f.notification=function(i){var t,e,n,o,a,d,s;if(i=f.extend({title:void 0,content:void 0,timeout:0,img:void 0,border:!0,fill:!1,showTime:!1,click:void 0,icon:void 0,color:void 0,type:void 0,error:!1},i),(t=f("#notifications")).length||(t=f("<div>",{id:"notifications"}).appendTo(f("#overlays"))),t.show(),(e=f("<div>")).addClass("notification"),null!=i.type&&e.addClass(i.type),1==i.error&&e.addClass("notification-error"),0<f("#notifications .notification").length?e.addClass("more"):t.addClass("animated flipInX").delay(1e3).queue(function(){t.removeClass("animated flipInX"),t.clearQueue()}),(n=f("<div>",{click:function(){var e=f(this);e.parent().is(":last-child")&&f("#notifications .notification:last-child").removeClass("more"),1==f("#notifications .notification").length?t.addClass("animated fadeOutDown fast").delay(1e3).queue(function(){t.removeClass("animated fadeOutDown fast"),t.clearQueue(),e.parent().remove(),t.remove()}):e.parent().addClass("animated fadeOutRightBig").delay(200).queue(function(){jQuery(this).removeClass("animated fadeOutRightBig").css("visibility","hidden").clearQueue().slideUp(function(){jQuery(this).remove()})})}})).addClass("hide"),d=f("<div class='left'>"),a=f("<div class='right'>"),null!=i.title)var r="<h2>"+i.title+"</h2>";else r="";if(null!=i.content)var l=i.content;else l="";function c(e){var i=[[2,"One second","1 second from now"],[60,"seconds",1],[120,"One minute","1 minute from now"],[3600,"minutes",60],[7200,"One hour","1 hour from now"],[86400,"hours",3600],[172800,"One day","tomorrow"],[604800,"days",86400],[1209600,"One week","next week"],[2419200,"weeks",604800],[4838400,"One month","next month"],[29030400,"months",2419200],[58060800,"One year","next year"],[290304e4,"years",29030400],[580608e4,"One century","next century"],[580608e5,"centuries",290304e4]],t=(new Date-e)/1e3,n=1;t<0&&(t=Math.abs(t),n=1);for(var o,a=0;o=i[a++];)if(t<o[0])return"string"==typeof o[2]?o[n]:Math.floor(t/o[2])+" "+o[1];return e}if((s=f("<div>",{html:r+l})).addClass("inner"),s.appendTo(a),null!=i.img?((o=f("<div>",{style:"background-image: url('"+i.img+"')"})).addClass("img"),o.appendTo(d),0==i.border&&o.addClass("border"),1==i.fill&&o.addClass("fill")):(icon=f('<div class="icon">'),null!=i.color&&icon.css("color",i.color),icon.appendTo(d)),d.appendTo(e),a.appendTo(e),n.appendTo(e),0!=i.showTime){var u=Number(new Date);timeHTML=f("<div>",{html:"<strong>"+c(u)+"</strong> ago"}),timeHTML.addClass("time").attr("data-title",u),timeHTML.appendTo(a),setInterval(function(){f(".time").each(function(){var e=f(this).attr("data-title");f(this).html("<strong>"+c(e)+"</strong> ago")})},4e3)}return e.hover(function(){n.show()},function(){n.hide()}),e.prependTo(t),e.show(),i.timeout&&setTimeout(function(){e.find(".hide").click()},i.timeout),null!=i.click&&(e.addClass("click"),e.bind("click",function(e){f(e.target).is(".hide")||i.click.call(this)})),this}}(jQuery);