1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2024-12-22 16:12:13 +01:00
LocalCDN-Firefox-Chrome-Brave/resources/angularjs-toaster/3.0.0/toaster.min.jsm

14 lines
8.9 KiB
JavaScript
Raw Normal View History

/*
* @license
* AngularJS Toaster
* Version: 3.0.0
*
* Copyright 2013-2019 Jiri Kavulak, Stabzs.
* All Rights Reserved.
* Use, reproduction, distribution, and modification of this code is subject to the terms and
* conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
*
* Authors: Jiri Kavulak, Stabzs
* Related to project of John Papa, Hans Fjällemark and Nguyễn Thiện Hùng (thienhung1989)
*/
!function(t,e){"use strict";angular.module("toaster",[]).constant("toasterConfig",{limit:0,"tap-to-dismiss":!0,"close-button":!1,"close-html":'<button class="toast-close-button" type="button">&times;</button>',"newest-on-top":!0,"time-out":5e3,"icon-classes":{error:"toast-error",info:"toast-info",wait:"toast-wait",success:"toast-success",warning:"toast-warning"},"body-output-type":"","body-template":"toasterBodyTmpl.html","icon-class":"toast-info","position-class":"toast-top-right","title-class":"toast-title","message-class":"toast-message","prevent-duplicates":!1,"mouseover-timer-stop":!0}).run(["$templateCache",function(t){t.put("angularjs-toaster/toast.html",'<div id="toast-container" ng-class="[config.position, config.animation]"><div ng-repeat="toaster in toasters" class="toast" ng-class="toaster.type" ng-click="click($event, toaster)" ng-mouseover="stopTimer(toaster)" ng-mouseout="restartTimer(toaster)"><div ng-if="toaster.showCloseButton" ng-click="click($event, toaster, true)" ng-bind-html="toaster.closeHtml"></div><div ng-class="config.title">{{toaster.title}}</div><div ng-class="config.message" ng-switch on="toaster.bodyOutputType"><div ng-switch-when="html" ng-bind-html="toaster.body"></div><div ng-switch-when="trustedHtml" ng-bind-html="toaster.html"></div><div ng-switch-when="template"><div ng-include="toaster.bodyTemplate"></div></div><div ng-switch-when="templateWithData"><div ng-include="toaster.bodyTemplate"></div></div><div ng-switch-when="directive"><div directive-template directive-name="{{toaster.html}}" directive-data="toaster.directiveData"></div></div><div ng-switch-default >{{toaster.body}}</div></div></div></div>')}]).service("toaster",["$rootScope","toasterConfig",function(d,t){var m={newGuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})}};for(var e in this.pop=function(t,e,o,s,a,i,n,r,c,l){if(angular.isObject(t)){var u=t;this.toast={type:u.type,title:u.title,body:u.body,timeout:u.timeout,bodyOutputType:u.bodyOutputType,clickHandler:u.clickHandler,showCloseButton:u.showCloseButton,closeHtml:u.closeHtml,toastId:u.toastId,onShowCallback:u.onShowCallback,onHideCallback:u.onHideCallback,directiveData:u.directiveData,tapToDismiss:u.tapToDismiss},n=u.toasterId}else this.toast={type:t,title:e,body:o,timeout:s,bodyOutputType:a,clickHandler:i,showCloseButton:r,toastId:c,onHideCallback:l};return this.toast.toastId&&this.toast.toastId.length||(this.toast.toastId=m.newGuid()),d.$emit("toaster-newToast",n,this.toast.toastId),{toasterId:n,toastId:this.toast.toastId}},this.clear=function(t,e){angular.isObject(t)?d.$emit("toaster-clearToasts",t.toasterId,t.toastId):d.$emit("toaster-clearToasts",t,e)},t["icon-classes"])this[e]=o(e);function o(l){return function(t,e,o,s,a,i,n,r,c){return angular.isString(t)?this.pop(l,t,e,o,s,a,i,n,r,c):this.pop(angular.extend(t,{type:l}))}}}]).factory("toasterEventRegistry",["$rootScope",function(t){var e,o=null,s=null,i=[],n=[];return{setup:(e={setup:function(){o||(o=t.$on("toaster-newToast",function(t,e,o){for(var s=0,a=i.length;s<a;s++)i[s](t,e,o)})),s||(s=t.$on("toaster-clearToasts",function(t,e,o){for(var s=0,a=n.length;s<a;s++)n[s](t,e,o)}))},subscribeToNewToastEvent:function(t){i.push(t)},subscribeToClearToastsEvent:function(t){n.push(t)},unsubscribeToNewToastEvent:function(t){var e=i.indexOf(t);0<=e&&i.splice(e,1),0===i.length&&(o(),o=null)},unsubscribeToClearToastsEvent:function(t){var e=n.indexOf(t);0<=e&&n.splice(e,1),0===n.length&&(s(),s=null)}}).setup,subscribeToNewToastEvent:e.subscribeToNewToastEvent,subscribeToClearToastsEvent:e.subscribeToClearToastsEvent,unsubscribeToNewToastEvent:e.unsubscribeToNewToastEvent,unsubscribeToClearToastsEvent:e.unsubscribeToClearToastsEvent}}]).directive("directiveTemplate",["$compile","$injector",function(r,c){return{restrict:"A",scope:{directiveName:"@directiveName",directiveData:"=directiveData"},replace:!0,link:function(a,i,n){a.$watch("directiveName",function(e){if(angular.isUndefined(e)||e.length<=0)throw new Error("A valid