-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #24 by replacing the findIndex usage with ES5 compatible code. …
…For some reason that I have no time to figure out now, the Babel isn't transpiling it to valid ES5. Probably problem with presets. Also added grunt-banner to print code banner on every file distributed.
- Loading branch information
1 parent
6029d3f
commit 90054de
Showing
9 changed files
with
109 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,77 @@ | ||
/*! angular-flash - v2.2.4 - 2016-03-05 | ||
/*! angular-flash - v2.2.5 - 2016-03-17 | ||
* https://github.com/sachinchoolur/angular-flash | ||
* Copyright (c) 2016 Sachin; Licensed MIT */ | ||
"use strict";var app=angular.module("ngFlash",[]);app.run(["$rootScope",function(a){return a.flashes=[]}]),app.directive("dynamic",["$compile",function(a){return{restrict:"A",replace:!0,link:function(b,c,d){return b.$watch(d.dynamic,function(d){return c.html(d),a(c.contents())(b)})}}}]),app.directive("closeFlash",["$compile","$rootScope","Flash",function(a,b,c){return{link:function(a,d,e){return d.on("click",function(){var a=parseInt(e.closeFlash,10);c.dismiss(a),b.$apply()})}}}]),app.directive("flashMessage",["Flash",function(a){return{restrict:"E",scope:{duration:"=",showClose:"=",onDismiss:"&"},template:'<div role="alert" ng-repeat="flash in $root.flashes track by $index" id="{{flash.config.id}}" class="alert {{flash.config.class}} alert-{{flash.type}} alert-dismissible alertIn alertOut"><div type="button" class="close" ng-show="flash.showClose" close-flash="{{flash.id}}"><span aria-hidden="true">×</span><span class="sr-only">Close</span></div> <span dynamic="flash.text"></span> </div>',link:function(b,c,d){function e(a){"function"==typeof b.onDismiss&&b.onDismiss({flash:a})}a.setDefaultTimeout(b.duration),a.setShowClose(b.showClose),a.setOnDismiss(e)}}}]),app.factory("Flash",["$rootScope","$timeout",function(a,b){function c(b){return a.flashes.findIndex(function(a){return a.id===b})}var d={},e=0;return d.setDefaultTimeout=function(a){"number"==typeof a&&(d.defaultTimeout=a)},d.defaultShowClose=!0,d.setShowClose=function(a){"boolean"==typeof a&&(d.defaultShowClose=a)},d.setOnDismiss=function(a){"function"==typeof a&&(d.onDismiss=a)},d.create=function(c,f,g,h,i){var j=void 0,k=void 0;return j=this,k={type:c,text:f,config:h,id:e++},k.showClose="undefined"!=typeof i?i:d.defaultShowClose,d.defaultTimeout&&"undefined"==typeof g?k.timeout=d.defaultTimeout:g&&(k.timeout=g),a.flashes.push(k),k.timeout&&(k.timeoutObj=b(function(){j.dismiss(k.id)},k.timeout)),k.id},d.pause=function(c){a.flashes[c].timeoutObj&&b.cancel(a.flashes[c].timeoutObj)},d.dismiss=function(b){var e=c(b);if(-1!==e){var f=a.flashes[e];d.pause(e),a.flashes.splice(e,1),a.$digest(),"function"==typeof d.onDismiss&&d.onDismiss(f)}},d.clear=function(){for(;a.flashes.length>0;)d.dismiss(a.flashes[0].id)},d.reset=d.clear,d}]); | ||
|
||
/*! angular-flash - v2.2.5 - 2016-03-17 | ||
* https://github.com/sachinchoolur/angular-flash | ||
* Copyright (c) 2016 Sachin; Licensed MIT */ | ||
"use strict"; | ||
var app = angular.module("ngFlash", []); | ||
app.run(["$rootScope", function(a) { | ||
return a.flashes = [] | ||
}]), app.directive("dynamic", ["$compile", function(a) { | ||
return { | ||
restrict: "A", replace: !0, link: function(b, c, d) { | ||
return b.$watch(d.dynamic, function(d) { | ||
return c.html(d), a(c.contents())(b) | ||
}) | ||
} | ||
} | ||
}]), app.directive("closeFlash", ["$compile", "$rootScope", "Flash", function(a, b, c) { | ||
return { | ||
link: function(a, d, e) { | ||
return d.on("click", function() { | ||
var a = parseInt(e.closeFlash, 10); | ||
c.dismiss(a), b.$apply() | ||
}) | ||
} | ||
} | ||
}]), app.directive("flashMessage", ["Flash", function(a) { | ||
return { | ||
restrict: "E", | ||
scope: {duration: "=", showClose: "=", onDismiss: "&"}, | ||
template: '<div role="alert" ng-repeat="flash in $root.flashes track by $index" id="{{flash.config.id}}" class="alert {{flash.config.class}} alert-{{flash.type}} alert-dismissible alertIn alertOut"><div type="button" class="close" ng-show="flash.showClose" close-flash="{{flash.id}}"><span aria-hidden="true">×</span><span class="sr-only">Close</span></div> <span dynamic="flash.text"></span> </div>', | ||
link: function(b, c, d) { | ||
function e(a) { | ||
"function" == typeof b.onDismiss && b.onDismiss({flash: a}) | ||
} | ||
|
||
a.setDefaultTimeout(b.duration), a.setShowClose(b.showClose), a.setOnDismiss(e) | ||
} | ||
} | ||
}]), app.factory("Flash", ["$rootScope", "$timeout", function(a, b) { | ||
function c(b) { | ||
return a.flashes.map(function(a) { | ||
return a.id | ||
}).indexOf(b) | ||
} | ||
|
||
var d = {}, e = 0; | ||
return d.setDefaultTimeout = function(a) { | ||
"number" == typeof a && (d.defaultTimeout = a) | ||
}, d.defaultShowClose = !0, d.setShowClose = function(a) { | ||
"boolean" == typeof a && (d.defaultShowClose = a) | ||
}, d.setOnDismiss = function(a) { | ||
"function" == typeof a && (d.onDismiss = a) | ||
}, d.create = function(c, f, g, h, i) { | ||
var j = void 0, k = void 0; | ||
return j = this, k = { | ||
type: c, | ||
text: f, | ||
config: h, | ||
id: e++ | ||
}, k.showClose = "undefined" != typeof i ? i : d.defaultShowClose, d.defaultTimeout && "undefined" == typeof g ? k.timeout = d.defaultTimeout : g && (k.timeout = g), a.flashes.push(k), k.timeout && (k.timeoutObj = b(function() { | ||
j.dismiss(k.id) | ||
}, k.timeout)), k.id | ||
}, d.pause = function(c) { | ||
a.flashes[c].timeoutObj && b.cancel(a.flashes[c].timeoutObj) | ||
}, d.dismiss = function(b) { | ||
var e = c(b); | ||
if (-1 !== e) { | ||
var f = a.flashes[e]; | ||
d.pause(e), a.flashes.splice(e, 1), a.$digest(), "function" == typeof d.onDismiss && d.onDismiss(f) | ||
} | ||
}, d.clear = function() { | ||
for (; a.flashes.length > 0;)d.dismiss(a.flashes[0].id) | ||
}, d.reset = d.clear, d | ||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters