263263 angular . module ( 'toastr' )
264264 . constant ( 'toastrConfig' , {
265265 allowHtml : false ,
266+ autoDismiss : false ,
266267 closeButton : false ,
267268 closeHtml : '<button>×</button>' ,
268269 containerId : 'toast-container' ,
274275 warning : 'toast-warning'
275276 } ,
276277 maxOpened : 0 ,
277- autoDismiss : false ,
278278 messageClass : 'toast-message' ,
279279 newestOnTop : true ,
280280 onHidden : null ,
294294 } ) ;
295295} ( ) ) ;
296296
297- ( function ( ) {
298- 'use strict' ;
299-
300- angular . module ( 'toastr' )
301- . directive ( 'progressBar' , progressBar ) ;
302-
303- progressBar . $inject = [ 'toastrConfig' ] ;
304-
305- function progressBar ( toastrConfig ) {
306- return {
307- replace : true ,
308- require : '^toast' ,
309- templateUrl : function ( ) {
310- return toastrConfig . templates . progressbar ;
311- } ,
312- link : linkFunction
313- } ;
314-
315- function linkFunction ( scope , element , attrs , toastCtrl ) {
316- var intervalId , currentTimeOut , hideTime ;
317-
318- toastCtrl . progressBar = scope ;
319-
320- scope . start = function ( duration ) {
321- if ( intervalId ) {
322- clearInterval ( intervalId ) ;
323- }
324-
325- currentTimeOut = parseFloat ( duration ) ;
326- hideTime = new Date ( ) . getTime ( ) + currentTimeOut ;
327- intervalId = setInterval ( updateProgress , 10 ) ;
328- } ;
329-
330- scope . stop = function ( ) {
331- if ( intervalId ) {
332- clearInterval ( intervalId ) ;
333- }
334- } ;
335-
336- function updateProgress ( ) {
337- var percentage = ( ( hideTime - ( new Date ( ) . getTime ( ) ) ) / currentTimeOut ) * 100 ;
338- element . css ( 'width' , percentage + '%' ) ;
339- }
340-
341- scope . $on ( '$destroy' , function ( ) {
342- // Failsafe stop
343- clearInterval ( intervalId ) ;
344- } ) ;
345- }
346- }
347- } ( ) ) ;
348-
349297( function ( ) {
350298 'use strict' ;
351299
458406 }
459407} ( ) ) ;
460408
409+ ( function ( ) {
410+ 'use strict' ;
411+
412+ angular . module ( 'toastr' )
413+ . directive ( 'progressBar' , progressBar ) ;
414+
415+ progressBar . $inject = [ 'toastrConfig' ] ;
416+
417+ function progressBar ( toastrConfig ) {
418+ return {
419+ replace : true ,
420+ require : '^toast' ,
421+ templateUrl : function ( ) {
422+ return toastrConfig . templates . progressbar ;
423+ } ,
424+ link : linkFunction
425+ } ;
426+
427+ function linkFunction ( scope , element , attrs , toastCtrl ) {
428+ var intervalId , currentTimeOut , hideTime ;
429+
430+ toastCtrl . progressBar = scope ;
431+
432+ scope . start = function ( duration ) {
433+ if ( intervalId ) {
434+ clearInterval ( intervalId ) ;
435+ }
436+
437+ currentTimeOut = parseFloat ( duration ) ;
438+ hideTime = new Date ( ) . getTime ( ) + currentTimeOut ;
439+ intervalId = setInterval ( updateProgress , 10 ) ;
440+ } ;
441+
442+ scope . stop = function ( ) {
443+ if ( intervalId ) {
444+ clearInterval ( intervalId ) ;
445+ }
446+ } ;
447+
448+ function updateProgress ( ) {
449+ var percentage = ( ( hideTime - ( new Date ( ) . getTime ( ) ) ) / currentTimeOut ) * 100 ;
450+ element . css ( 'width' , percentage + '%' ) ;
451+ }
452+
453+ scope . $on ( '$destroy' , function ( ) {
454+ // Failsafe stop
455+ clearInterval ( intervalId ) ;
456+ } ) ;
457+ }
458+ }
459+ } ( ) ) ;
460+
461461angular . module ( "toastr" ) . run ( [ "$templateCache" , function ( $templateCache ) { $templateCache . put ( "directives/progressbar/progressbar.html" , "<div class=\"toast-progress\"></div>\n" ) ;
462462$templateCache . put ( "directives/toast/toast.html" , "<div class=\"{{toastClass}} {{toastType}}\" ng-click=\"tapToast()\">\n <div ng-switch on=\"allowHtml\">\n <div ng-switch-default ng-if=\"title\" class=\"{{titleClass}}\">{{title}}</div>\n <div ng-switch-default class=\"{{messageClass}}\">{{message}}</div>\n <div ng-switch-when=\"true\" ng-if=\"title\" class=\"{{titleClass}}\" ng-bind-html=\"title\"></div>\n <div ng-switch-when=\"true\" class=\"{{messageClass}}\" ng-bind-html=\"message\"></div>\n </div>\n <progress-bar ng-if=\"progressBar\"></progress-bar>\n</div>\n" ) ; } ] ) ;
0 commit comments