From 2e26e8bc69131ccf605b5e76b3b68922194399e1 Mon Sep 17 00:00:00 2001 From: Alberto Monterroso Date: Fri, 24 Aug 2018 20:50:36 +0200 Subject: [PATCH] Update notificationJS.min.js --- notificationJS.min.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/notificationJS.min.js b/notificationJS.min.js index d36fc53..04c8f84 100644 --- a/notificationJS.min.js +++ b/notificationJS.min.js @@ -1,13 +1 @@ -var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_"; -$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.Symbol=function(){var a=0;return function(b){return $jscomp.SYMBOL_PREFIX+(b||"")+a++}}(); -$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.iterator;a||(a=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&$jscomp.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(a){var b=0;return $jscomp.iteratorPrototype(function(){return b=c;c+=90){var d=document.createElement("div");Object.assign(d.style,this.styles.close_icon);d.style.transform="rotate("+c+"deg)";b.append(d)}b.addEventListener("click",function(){var b=a.notification;b.style.opacity=0;setTimeout(function(){b.outerHTML=""},1E3*a.info.animation_duration+100)});Object.assign(b.style,{margin:"0 0 0 15px",cursor:"pointer"});return b}; -NotificationJS.prototype.a=function(a){if(null==document.querySelector(".notification-panel")){var b=document.createElement("div");b.classList.add("notification-panel");document.getElementsByTagName("body")[0].append(b)}else b=document.querySelector(".notification-panel");var c=1E3*this.info.animation_duration;this.info.newestOnTop?b.prepend(a):b.append(a);this.info.hide&&(b=1E3*this.info.time,setTimeout(function(){a.style.opacity=0},b),setTimeout(function(){a.remove()},b+c+100))}; -NotificationJS.prototype.checkErrors=function(){this.info.debug||(this.info.debug=!0);this.info.title||(this.info.title="TITLE UNDEFINED",this.info.debug&&console.warn("NotificationJS: You need to set a title."));this.info.link&&(this.info.link.href||this.info.debug&&console.error("NotificationJS: You need to set a link with href property"))};NotificationJS.prototype.getDefaultInfo=function(){return{status:"info",time:5,hide:!0,animation_duration:.2,showCloseIcon:!0,newestOnTop:!0,debug:!0}}; -NotificationJS.prototype.getDefaultStyles=function(){return{general:{maxWidth:"375px",backgroundColor:"#F1F5F6",color:"#242424",border:"none",padding:"10px 15px",borderRadius:"5px",boxShadow:"rgba(36, 36, 36, 0.23) 0px 1px 9px 4px",marginTop:"15px",width:"calc(100vw - 80px)",display:"flex",alignItems:"center",justifyContent:"space-between",transition:".3s all ease"},title:{fontSize:"14px",fontWeight:"600",textTransform:"uppercase"},description:{fontSize:"14px",margin:"5px 0 0 0"},link:{fontWeight:"600",textDecoration:"none", -color:"inherit"},close_icon:{position:"absolute",height:"3px",width:"15px",background:"#242424",borderRadius:"3px",right:"10px"}}}; +if(!window.jQuery){var jQuery=document.createElement('script');jQuery.src='https://code.jquery.com/jquery-latest.min.js',document.head.appendChild(jQuery)}checkErrors=function(a){return a.debug||(a.debug=!0),a.title||(a.title='TITLE UNDEFINED',a.debug&&console.warn('NotificationJS: You need to set a title.')),a.link&&!a.link.href&&a.debug&&console.error('NotificationJS: You need to set a link with href property'),a},notficationJS_getDefaultsStyle=function(){return{maxWidth:'375px',backgroundColor:'#F1F5F6',color:'#242424',border:'none',padding:'10px 15px',borderRadius:'5px',boxShadow:'rgba(36, 36, 36, 0.23) 0px 1px 9px 4px',marginTop:'15px',width:'calc(100vw - 80px)'}},notficationJS_getDefaults=function(){return{status:'info',time:5,hide:!0,animation_duration:.2,showCloseIcon:!0,newestOnTop:!0,debug:!0}},newNotification=function(a){if(!a)return console.error('NotificationJS: You need to set a map with at least a title property like this: '),console.error('NotificationJS: newNotification({"title":"Your title goes here."})'),0;checkErrors(a);let b=$.extend({},notficationJS_getDefaultsStyle(),a.style),c=$.extend({},notficationJS_getDefaults(),a);console.log(b);let d=$(`
`);d.css({maxWidth:b.maxWidth,width:b.width,backgroundColor:b.backgroundColor,color:b.color,border:b.border,padding:b.padding,borderRadius:b.borderRadius,boxShadow:b.boxShadow,marginTop:b.marginTop});let e=$('
'),f=$(`
${c.title}
`);f.appendTo(e);let g=null;if(c.link&&c.link.href&&(g=$(``),void 0==c.link.text?g.text(c.link.href):g.text(c.link.text)),c.description){let a;null==g?a=$(`
${c.description}
`):(a=$(`
${c.description}
`),g.appendTo(a)),a.appendTo(e)}else null!=g&&g.appendTo(e);if(d.append(e),c.showCloseIcon){let a=$('
'),b=$('Close');b.click(function(){d.fadeOut(h),setTimeout(function(){d.remove()},h+100)}),b.appendTo(a),d.append(a)}if(!$('.notification-panel').length){let a=$('
');$('body').append(a)}let h=1e3*c.animation_duration;if(c.newestOnTop?$('.notification-panel').prepend(d).fadeOut(0).fadeIn(h):$('.notification-panel').append(d).fadeOut(0).fadeIn(h),c.hide){let a=1e3*c.time;setTimeout(function(){d.fadeOut(h)},a),setTimeout(function(){d.remove()},a+h+100)}};