diff --git a/LICENSE b/LICENSE index 349b6f3..60ce744 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 Invertase +Copyright (c) 2015-2016 Team FA Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/README.md b/README.md index 68c9592..5ec092b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Angular Toasty #### Demo -[Check it out!](https://invertase.github.io/angular-toasty/example/) +[Check it out!](http://teamfa.com/angular-toasty/example/) #### Current Features * 3 Themes (Default, Material Design & Bootstrap 3) @@ -175,4 +175,4 @@ $rootScope.$on('toasty-cleared', function(event, toast) { console.log(toast) }); #### Contributing -Please see the [contributing guidelines](https://github.com/invertase/angular-toasty/blob/master/CONTRIBUTING.md). +Please see the [contributing guidelines](https://github.com/teamfa/angular-toasty/blob/master/CONTRIBUTING.md). diff --git a/bower.json b/bower.json index 164b968..f0083e6 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "angular-toasty", "description": "A slick, simple, standalone AngularJS module with extensive features that provides growl-style alerts and messages for your app.", - "version": "1.0.5", + "version": "1.0.6", "main": [ "dist/angular-toasty.js", "dist/angular-toasty.css" @@ -16,12 +16,12 @@ "src" ], "dependencies": { - "angular": "~1.4.3" + "angular": "~1.6.0" }, - "homepage": "https://github.com/invertase/angular-toasty", + "homepage": "https://github.com/teamfa/angular-toasty", "repository": { "type": "git", - "url": "git://github.com/invertase/angular-toasty.git" + "url": "git://github.com/teamfa/angular-toasty.git" }, "license": "MIT" } diff --git a/dist/angular-toasty.js b/dist/angular-toasty.js index 5b5f121..e7f3d43 100644 --- a/dist/angular-toasty.js +++ b/dist/angular-toasty.js @@ -31,7 +31,7 @@ */ angular.module('angular-toasty', []); -angular.module('angular-toasty').directive('toasty', ['toasty', '$timeout', '$sce', function(toasty, $timeout, $sce) { +angular.module('angular-toasty').directive('toasty', ['toasty', '$interval', '$sce', function(toasty, $interval, $sce) { return { replace: true, restrict: 'EA', @@ -105,7 +105,7 @@ angular.module('angular-toasty').directive('toasty', ['toasty', '$timeout', '$sc // Custom setTimeout function for specific // setTimeouts on individual toasts function setTimeout(toasty, time) { - toasty.timeout = $timeout(function() { + toasty.timeout = $interval(function() { clear(toasty.id); }, time); } diff --git a/dist/angular-toasty.min.js b/dist/angular-toasty.min.js index e86ea9d..6a9e9ff 100644 --- a/dist/angular-toasty.min.js +++ b/dist/angular-toasty.min.js @@ -1,4 +1,4 @@ /*! * angular-toasty */ -"use strict";angular.module("angular-toasty",[]),angular.module("angular-toasty").directive("toasty",["toasty","$timeout","$sce",function(A,P,g){return{replace:!0,restrict:"EA",scope:!0,link:function(A,D,j){function B(P){P?angular.forEach(A.toasty,function(g,D){g.id==P&&(A.$broadcast("toasty-cleared",A.toasty[D]),g.onRemove&&angular.isFunction(g.onRemove)&&g.onRemove.call(A.toasty[D]),A.toasty.splice(D,1),A.$$phase||A.$digest())}):(angular.forEach(A.toasty,function(P,g){P.onRemove&&angular.isFunction(P.onRemove)&&P.onRemove.call(A.toasty[g])}),A.toasty=[],A.$broadcast("toasty-cleared"))}function o(A,g){A.timeout=P(function(){B(A.id)},g)}function w(A,P,g){return 0==P[g]?!1:P[g]?!0:A[g]}function I(P,D){Q++;var j,B=w(P,D,"sound"),I=w(P,D,"showClose"),Y=w(P,D,"clickToClose"),t=w(P,D,"html"),a=w(P,D,"shake");j=D.theme&&C.indexOf(D.theme)>-1?D.theme:P.theme,A.toasty.length>=P.limit&&A.toasty.shift(),B&&document.getElementById("toasty-sound").play();var s={id:Q,title:t?g.trustAsHtml(D.title):D.title,msg:t?g.trustAsHtml(D.msg):D.msg,showClose:I,clickToClose:Y,sound:B,shake:a?"toasty-shake":"",html:t,type:"toasty-type-"+D.type,theme:"toasty-theme-"+j,onAdd:D.onAdd&&angular.isFunction(D.onAdd)?D.onAdd:null,onRemove:D.onRemove&&angular.isFunction(D.onRemove)?D.onRemove:null,onClick:D.onClick&&angular.isFunction(D.onClick)?D.onClick:null};A.toasty.push(s),D.onAdd&&angular.isFunction(D.onAdd)&&D.onAdd.call(s),A.$broadcast("toasty-added",s),0!=D.timeout&&(D.timeout||P.timeout)&&o(A.toasty[A.toasty.length-1],D.timeout||P.timeout)}var Q=0,C=["default","material","bootstrap"];A.position="",A.toasty=[],A.$on("toasty-new",function(P,g){var D=g.config,j=g.options;A.position||(A.position="toasty-position-"+D.position),I(D,j)}),A.$on("toasty-clear",function(A,P){B(P.id)}),A.close=function(A){B(A)},A.clickToasty=function(P){A.$broadcast("toasty-clicked",P),P.onClick&&angular.isFunction(P.onClick)&&P.onClick.call(P),P.clickToClose&&B(P.id)}},template:'

'}}]),angular.module("angular-toasty").provider("toastyConfig",function(){var A={limit:5,showClose:!0,clickToClose:!1,position:"bottom-right",timeout:5e3,sound:!0,html:!1,shake:!1,theme:"default"},P={};return{setConfig:function(A){P=A},$get:function(){return{config:angular.extend(A,P)}}}}),angular.module("angular-toasty").factory("toasty",["$rootScope","toastyConfig",function(A,P){var g=P.config,D=function(P,D){(angular.isString(P)&&""!=P||angular.isNumber(P))&&(P={title:P.toString()}),P&&(P.title||P.msg)?(P.type=D||"default",A.$broadcast("toasty-new",{config:g,options:P})):console.error("angular-toasty: No toast title or message specified!")};return D["default"]=function(A){D(A)},D.info=function(A){D(A,"info")},D.wait=function(A){D(A,"wait")},D.success=function(A){D(A,"success")},D.error=function(A){D(A,"error")},D.warning=function(A){D(A,"warning")},D.clear=function(P){A.$broadcast("toasty-clear",{id:P})},D.getGlobalConfig=function(){return g},D}]); \ No newline at end of file +"use strict";angular.module("angular-toasty",[]),angular.module("angular-toasty").directive("toasty",["toasty","$interval","$sce",function(A,P,g){return{replace:!0,restrict:"EA",scope:!0,link:function(A,D,j){function B(P){P?angular.forEach(A.toasty,function(g,D){g.id==P&&(A.$broadcast("toasty-cleared",A.toasty[D]),g.onRemove&&angular.isFunction(g.onRemove)&&g.onRemove.call(A.toasty[D]),A.toasty.splice(D,1),A.$$phase||A.$digest())}):(angular.forEach(A.toasty,function(P,g){P.onRemove&&angular.isFunction(P.onRemove)&&P.onRemove.call(A.toasty[g])}),A.toasty=[],A.$broadcast("toasty-cleared"))}function o(A,g){A.timeout=P(function(){B(A.id)},g)}function w(A,P,g){return 0!=P[g]&&(!!P[g]||A[g])}function I(P,D){Q++;var j,B=w(P,D,"sound"),I=w(P,D,"showClose"),Y=w(P,D,"clickToClose"),t=w(P,D,"html"),a=w(P,D,"shake");j=D.theme&&C.indexOf(D.theme)>-1?D.theme:P.theme,A.toasty.length>=P.limit&&A.toasty.shift(),B&&document.getElementById("toasty-sound").play();var s={id:Q,title:t?g.trustAsHtml(D.title):D.title,msg:t?g.trustAsHtml(D.msg):D.msg,showClose:I,clickToClose:Y,sound:B,shake:a?"toasty-shake":"",html:t,type:"toasty-type-"+D.type,theme:"toasty-theme-"+j,onAdd:D.onAdd&&angular.isFunction(D.onAdd)?D.onAdd:null,onRemove:D.onRemove&&angular.isFunction(D.onRemove)?D.onRemove:null,onClick:D.onClick&&angular.isFunction(D.onClick)?D.onClick:null};A.toasty.push(s),D.onAdd&&angular.isFunction(D.onAdd)&&D.onAdd.call(s),A.$broadcast("toasty-added",s),0!=D.timeout&&(D.timeout||P.timeout)&&o(A.toasty[A.toasty.length-1],D.timeout||P.timeout)}var Q=0,C=["default","material","bootstrap"];A.position="",A.toasty=[],A.$on("toasty-new",function(P,g){var D=g.config,j=g.options;A.position||(A.position="toasty-position-"+D.position),I(D,j)}),A.$on("toasty-clear",function(A,P){B(P.id)}),A.close=function(A){B(A)},A.clickToasty=function(P){A.$broadcast("toasty-clicked",P),P.onClick&&angular.isFunction(P.onClick)&&P.onClick.call(P),P.clickToClose&&B(P.id)}},template:'

'}}]),angular.module("angular-toasty").provider("toastyConfig",function(){var A={limit:5,showClose:!0,clickToClose:!1,position:"bottom-right",timeout:5e3,sound:!0,html:!1,shake:!1,theme:"default"},P={};return{setConfig:function(A){P=A},$get:function(){return{config:angular.extend(A,P)}}}}),angular.module("angular-toasty").factory("toasty",["$rootScope","toastyConfig",function(A,P){var g=P.config,D=function(P,D){(angular.isString(P)&&""!=P||angular.isNumber(P))&&(P={title:P.toString()}),P&&(P.title||P.msg)?(P.type=D||"default",A.$broadcast("toasty-new",{config:g,options:P})):console.error("angular-toasty: No toast title or message specified!")};return D["default"]=function(A){D(A)},D.info=function(A){D(A,"info")},D.wait=function(A){D(A,"wait")},D.success=function(A){D(A,"success")},D.error=function(A){D(A,"error")},D.warning=function(A){D(A,"warning")},D.clear=function(P){A.$broadcast("toasty-clear",{id:P})},D.getGlobalConfig=function(){return g},D}]); \ No newline at end of file diff --git a/example/index.html b/example/index.html index 3cce204..0f5ec5c 100644 --- a/example/index.html +++ b/example/index.html @@ -53,9 +53,9 @@
@@ -115,8 +115,8 @@

- - + + diff --git a/package.json b/package.json index 5abe762..7268be5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "angular-toasty", - "version": "1.0.5", - "author": "Invertase", + "version": "1.0.6", + "author": "Team FA", "devDependencies": { "bower": "~1.4.1", "del": "^1.2.0", diff --git a/src/js/directive.js b/src/js/directive.js index e1207bf..035667a 100644 --- a/src/js/directive.js +++ b/src/js/directive.js @@ -1,4 +1,4 @@ -angular.module('angular-toasty').directive('toasty', ['toasty', '$timeout', '$sce', function(toasty, $timeout, $sce) { +angular.module('angular-toasty').directive('toasty', ['toasty', '$interval', '$sce', function(toasty, $interval, $sce) { return { replace: true, restrict: 'EA', @@ -72,7 +72,7 @@ angular.module('angular-toasty').directive('toasty', ['toasty', '$timeout', '$sc // Custom setTimeout function for specific // setTimeouts on individual toasts function setTimeout(toasty, time) { - toasty.timeout = $timeout(function() { + toasty.timeout = $interval(function() { clear(toasty.id); }, time); }