heat-dashboard/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/vendors/angular-notify.min.js

1 line
3.2 KiB
JavaScript

angular.module("cgNotify",[]).factory("notify",["$timeout","$http","$compile","$templateCache","$rootScope",function(a,b,c,d,e){var f=10,g=15,h=1e4,i="angular-notify.html",j="center",k=document.body,l=0,m=[],n=[],o=function(o){"object"!=typeof o&&(o={message:o}),o.duration=o.duration?o.duration:h,o.templateUrl=o.templateUrl?o.templateUrl:i,o.container=o.container?o.container:k,o.classes=o.classes?o.classes:"";var p=o.scope?o.scope.$new():e.$new();if(p.$position=o.position?o.position:j,p.$message=o.message,p.$classes=o.classes,p.$messageTemplate=o.messageTemplate,l>0)for(var q=n.length+1-l,r=0;q>r;r++)n[r].$close();b.get(o.templateUrl,{cache:d}).then(function(b){var d=c(b.data)(p);if(d.bind("webkitTransitionEnd oTransitionEnd otransitionend transitionend msTransitionEnd",function(a){("opacity"===a.propertyName||0===a.currentTarget.style.opacity||a.originalEvent&&"opacity"===a.originalEvent.propertyName)&&(d.remove(),m.splice(m.indexOf(d),1),n.splice(n.indexOf(p),1),i())}),o.messageTemplate){for(var e,h=0;h<d.children().length;h++)if(angular.element(d.children()[h]).hasClass("cg-notify-message-template")){e=angular.element(d.children()[h]);break}if(!e)throw new Error("cgNotify could not find the .cg-notify-message-template element in "+o.templateUrl+".");e.append(c(o.messageTemplate)(p))}angular.element(o.container).append(d),m.push(d),"center"===p.$position&&a(function(){p.$centerMargin="-"+d[0].offsetWidth/2+"px"}),p.$close=function(){d.css("opacity",0).attr("data-closing","true"),i()};var i=function(){for(var a=0,b=f,c=m.length-1;c>=0;c--){var d=10,e=m[c],h=e[0].offsetHeight,i=b+h+d;e.attr("data-closing")?i+=20:b+=h+g,e.css("top",i+"px").css("margin-top","-"+(h+d)+"px").css("visibility","visible"),a++}};a(function(){i()}),o.duration>0&&a(function(){p.$close()},o.duration)},function(a){throw new Error("Template specified for cgNotify ("+o.templateUrl+") could not be loaded. "+a)});var s={};return s.close=function(){p.$close&&p.$close()},Object.defineProperty(s,"message",{get:function(){return p.$message},set:function(a){p.$message=a}}),n.push(p),s};return o.config=function(a){f=angular.isUndefined(a.startTop)?f:a.startTop,g=angular.isUndefined(a.verticalSpacing)?g:a.verticalSpacing,h=angular.isUndefined(a.duration)?h:a.duration,i=a.templateUrl?a.templateUrl:i,j=angular.isUndefined(a.position)?j:a.position,k=a.container?a.container:k,l=a.maximumOpen?a.maximumOpen:l},o.closeAll=function(){for(var a=m.length-1;a>=0;a--){var b=m[a];b.css("opacity",0)}},o}]),angular.module("cgNotify").run(["$templateCache",function(a){"use strict";a.put("angular-notify.html","<div class=\"cg-notify-message\" ng-class=\"[$classes, \n $position === 'center' ? 'cg-notify-message-center' : '',\n $position === 'left' ? 'cg-notify-message-left' : '',\n $position === 'right' ? 'cg-notify-message-right' : '']\"\n ng-style=\"{'margin-left': $centerMargin}\">\n\n <div ng-show=\"!$messageTemplate\">\n {$ $message $}\n </div>\n\n"+' <div ng-show="$messageTemplate" class="cg-notify-message-template">\n \n </div>\n\n <button type="button" class="cg-notify-close" ng-click="$close()">\n <span aria-hidden="true">&times;</span>\n <span class="cg-notify-sr-only">Close</span>\n </button>\n\n</div>')}]);