1
- angular . module ( 'jlareau.pnotify' , [ ] )
1
+ ( function ( ) {
2
2
3
- . provider ( 'notificationService ', [ function ( ) {
3
+ angular . module ( 'jlareau.pnotify ', [ ] )
4
4
5
- var settings = {
6
- styling : 'bootstrap3'
7
- } ;
5
+ . provider ( 'notificationService' , [ function ( ) {
8
6
9
- var stacks = { } ;
10
- var defaultStack = false ;
11
-
12
- var initHash = function ( stackName ) {
13
- var hash = angular . copy ( settings ) ;
7
+ var settings = {
8
+ styling : 'bootstrap3'
9
+ } ;
14
10
15
- if ( ( stackName || ( stackName = defaultStack ) ) && stackName in stacks ) {
16
- hash . stack = stacks [ stackName ] . stack ;
11
+ var stacks = { } ;
12
+ var defaultStack = false ;
17
13
18
- if ( stacks [ stackName ] . addclass ) {
19
- hash . addclass = 'addclass' in hash ? hash . addclass + ' ' + stacks [ stackName ] . addclass : stacks [ stackName ] . addclass ;
20
- }
21
- }
14
+ var initHash = function ( stackName ) {
15
+ var hash = angular . copy ( settings ) ;
22
16
23
- return hash ;
24
- }
17
+ if ( ( stackName || ( stackName = defaultStack ) ) && stackName in stacks ) {
18
+ hash . stack = stacks [ stackName ] . stack ;
25
19
26
- this . setDefaults = function ( defaults ) {
27
- settings = defaults
28
- return this ;
29
- } ;
20
+ if ( stacks [ stackName ] . addclass ) {
21
+ hash . addclass = 'addclass' in hash ? hash . addclass + ' ' + stacks [ stackName ] . addclass : stacks [ stackName ] . addclass ;
22
+ }
23
+ }
30
24
31
- this . setStack = function ( name , addclass , stack ) {
32
- if ( angular . isObject ( addclass ) ) {
33
- stack = addclass ;
34
- addclass = false ;
25
+ return hash ;
35
26
}
36
27
37
- stacks [ name ] = {
38
- stack : stack ,
39
- addclass : addclass
28
+ this . setDefaults = function ( defaults ) {
29
+ settings = defaults
30
+ return this ;
40
31
} ;
41
- return this ;
42
- } ;
43
-
44
- this . setDefaultStack = function ( name ) {
45
- defaultStack = name ;
46
- return this ;
47
- } ;
48
-
49
- this . $get = [ function ( ) {
50
-
51
- return {
52
-
53
- /* ========== SETTINGS RELATED METHODS =============*/
54
-
55
- getSettings : function ( ) {
56
- return settings ;
57
- } ,
58
-
59
- /* ============== NOTIFICATION METHODS ==============*/
60
-
61
- notice : function ( content , stack ) {
62
- var hash = initHash ( stack ) ;
63
- hash . type = 'notice' ;
64
- hash . text = content ;
65
- return this . notify ( hash ) ;
66
- } ,
67
-
68
- info : function ( content , stack ) {
69
- var hash = initHash ( stack ) ;
70
- hash . type = 'info' ;
71
- hash . text = content ;
72
- return this . notify ( hash ) ;
73
- } ,
74
-
75
- success : function ( content , stack ) {
76
- var hash = initHash ( stack ) ;
77
- hash . type = 'success' ;
78
- hash . text = content ;
79
- return this . notify ( hash ) ;
80
- } ,
81
-
82
- error : function ( content , stack ) {
83
- var hash = initHash ( stack ) ;
84
- hash . type = 'error' ;
85
- hash . text = content ;
86
- return this . notify ( hash ) ;
87
- } ,
88
-
89
- notifyWithDefaults : function ( options , stack ) {
90
- var defaults = initHash ( stack ) ;
91
- var combined = angular . extend ( defaults , options ) ;
92
- return this . notify ( combined ) ;
93
- } ,
94
-
95
- notify : function ( hash ) {
96
- return new PNotify ( hash ) ;
32
+
33
+ this . setStack = function ( name , addclass , stack ) {
34
+ if ( angular . isObject ( addclass ) ) {
35
+ stack = addclass ;
36
+ addclass = false ;
97
37
}
98
38
39
+ stacks [ name ] = {
40
+ stack : stack ,
41
+ addclass : addclass
42
+ } ;
43
+ return this ;
99
44
} ;
100
45
101
- } ] ;
46
+ this . setDefaultStack = function ( name ) {
47
+ defaultStack = name ;
48
+ return this ;
49
+ } ;
50
+
51
+ this . $get = [ function ( ) {
52
+
53
+ return {
54
+
55
+ /* ========== SETTINGS RELATED METHODS =============*/
56
+
57
+ getSettings : function ( ) {
58
+ return settings ;
59
+ } ,
60
+
61
+ /* ============== NOTIFICATION METHODS ==============*/
62
+
63
+ notice : function ( content , stack ) {
64
+ var hash = initHash ( stack ) ;
65
+ hash . type = 'notice' ;
66
+ hash . text = content ;
67
+ return this . notify ( hash ) ;
68
+ } ,
69
+
70
+ info : function ( content , stack ) {
71
+ var hash = initHash ( stack ) ;
72
+ hash . type = 'info' ;
73
+ hash . text = content ;
74
+ return this . notify ( hash ) ;
75
+ } ,
76
+
77
+ success : function ( content , stack ) {
78
+ var hash = initHash ( stack ) ;
79
+ hash . type = 'success' ;
80
+ hash . text = content ;
81
+ return this . notify ( hash ) ;
82
+ } ,
83
+
84
+ error : function ( content , stack ) {
85
+ var hash = initHash ( stack ) ;
86
+ hash . type = 'error' ;
87
+ hash . text = content ;
88
+ return this . notify ( hash ) ;
89
+ } ,
90
+
91
+ notifyWithDefaults : function ( options , stack ) {
92
+ var defaults = initHash ( stack ) ;
93
+ var combined = angular . extend ( defaults , options ) ;
94
+ return this . notify ( combined ) ;
95
+ } ,
96
+
97
+ notify : function ( hash ) {
98
+ return new PNotify ( hash ) ;
99
+ }
100
+
101
+ } ;
102
+
103
+ } ] ;
104
+
105
+ } ] )
102
106
103
- } ] )
107
+ ;
104
108
105
- ;
109
+ } ) ( ) ;
0 commit comments