noty-rails 2.1.0.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 119b6e910a047dd45a0b83578ccdb4d645ca72e2
4
- data.tar.gz: 27b9d414815ae135dfd3d16aafe36716c751d199
3
+ metadata.gz: 1bb93801c08bd7473d8efc3fcc9fee5b60de7edb
4
+ data.tar.gz: aab2ef3c4c125b1a0f77337a267106c87dd1743c
5
5
  SHA512:
6
- metadata.gz: 7bfd4c7efaa1ade2136f0f1194af027b0ffba1cac6859b9f811109f4467e79b1c8cae7f39203ad496a08d9931978d6d5e7f81492344d8ec383e70a225a840dbc
7
- data.tar.gz: 6273265e6a511dfea664c73ccd081d7b63d2ef1e46ba6cc102b84a4fd674444eb99310867d9fff8e4c65730b58da8827915a8e5fa9ef977f4a4210b33489cf14
6
+ metadata.gz: 83b52f07d3be60a1fed7f56952b50afc35f6d18636824b42b21073b74230a736db67114a48db242c2ae515174d80f855a218909f6bc4e9e564d1f190030858fa
7
+ data.tar.gz: aeb077270a08f9434acfde33ceaec0de9261052cfc25adb87f67d00964b463a5c17d111d869152d87d7ca0b3f24dc085570b530b69fd5c2b5e94419377bd5f0f
data/README.md CHANGED
@@ -27,6 +27,14 @@ $.noty.defaults.layout = 'bottom'
27
27
 
28
28
  # Changelog
29
29
 
30
+ ### 2.2.0
31
+
32
+ - Update Noty to `2.2.0`
33
+
34
+ ### 2.1.4
35
+
36
+ - Update Noty to `2.1.4`
37
+
30
38
  ### 2.1.0.1
31
39
 
32
40
  - Add MIT Licence to gemspec
@@ -1,5 +1,5 @@
1
1
  module Noty
2
2
  module Rails
3
- VERSION = "2.1.0.1"
3
+ VERSION = "2.2.0".freeze
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /**
2
- * noty - jQuery Notification Plugin v2.1.0
2
+ * noty - jQuery Notification Plugin v2.2.0
3
3
  * Contributors: https://github.com/needim/noty/graphs/contributors
4
4
  *
5
5
  * Examples and Documentation - http://needim.github.com/noty/
@@ -29,7 +29,11 @@ if (typeof Object.create !== 'function') {
29
29
  this.options = $.extend({}, $.noty.defaults, options);
30
30
 
31
31
  this.options.layout = (this.options.custom) ? $.noty.layouts['inline'] : $.noty.layouts[this.options.layout];
32
- this.options.theme = $.noty.themes[this.options.theme];
32
+
33
+ if ($.noty.themes[this.options.theme])
34
+ this.options.theme = $.noty.themes[this.options.theme];
35
+ else
36
+ options.themeClassName = this.options.theme;
33
37
 
34
38
  delete options.layout;
35
39
  delete options.theme;
@@ -49,11 +53,14 @@ if (typeof Object.create !== 'function') {
49
53
  _build:function () {
50
54
 
51
55
  // Generating noty bar
52
- var $bar = $('<div class="noty_bar"></div>').attr('id', this.options.id);
56
+ var $bar = $('<div class="noty_bar noty_type_' + this.options.type + '"></div>').attr('id', this.options.id);
53
57
  $bar.append(this.options.template).find('.noty_text').html(this.options.text);
54
58
 
55
59
  this.$bar = (this.options.layout.parent.object !== null) ? $(this.options.layout.parent.object).css(this.options.layout.parent.css).append($bar) : $bar;
56
60
 
61
+ if (this.options.themeClassName)
62
+ this.$bar.addClass(this.options.themeClassName).addClass('noty_container_type_' + this.options.type);
63
+
57
64
  // Set buttons if available
58
65
  if (this.options.buttons) {
59
66
 
@@ -68,7 +75,7 @@ if (typeof Object.create !== 'function') {
68
75
  var self = this;
69
76
 
70
77
  $.each(this.options.buttons, function (i, button) {
71
- var $button = $('<button/>').addClass((button.addClass) ? button.addClass : 'gray').html(button.text)
78
+ var $button = $('<button/>').addClass((button.addClass) ? button.addClass : 'gray').html(button.text).attr('id', button.id ? button.id : 'button-' + i)
72
79
  .appendTo(self.$bar.find('.noty_buttons'))
73
80
  .bind('click', function () {
74
81
  if ($.isFunction(button.onClick)) {
@@ -91,9 +98,10 @@ if (typeof Object.create !== 'function') {
91
98
 
92
99
  var self = this;
93
100
 
94
- $(self.options.layout.container.selector).append(self.$bar);
101
+ (self.options.custom) ? self.options.custom.find(self.options.layout.container.selector).append(self.$bar) : $(self.options.layout.container.selector).append(self.$bar);
95
102
 
96
- self.options.theme.style.apply(self);
103
+ if (self.options.theme && self.options.theme.style)
104
+ self.options.theme.style.apply(self);
97
105
 
98
106
  ($.type(self.options.layout.css) === 'function') ? this.options.layout.css.apply(self.$bar) : self.$bar.css(this.options.layout.css || {});
99
107
 
@@ -101,7 +109,10 @@ if (typeof Object.create !== 'function') {
101
109
 
102
110
  self.options.layout.container.style.apply($(self.options.layout.container.selector));
103
111
 
104
- self.options.theme.callback.onShow.apply(this);
112
+ self.showing = true;
113
+
114
+ if (self.options.theme && self.options.theme.style)
115
+ self.options.theme.callback.onShow.apply(this);
105
116
 
106
117
  if ($.inArray('click', self.options.closeWith) > -1)
107
118
  self.$bar.css('cursor', 'pointer').one('click', function (evt) {
@@ -135,6 +146,7 @@ if (typeof Object.create !== 'function') {
135
146
  self.options.animation.easing,
136
147
  function () {
137
148
  if (self.options.callback.afterShow) self.options.callback.afterShow.apply(self);
149
+ self.showing = false;
138
150
  self.shown = true;
139
151
  });
140
152
 
@@ -155,7 +167,16 @@ if (typeof Object.create !== 'function') {
155
167
 
156
168
  var self = this;
157
169
 
158
- if (!this.shown) { // If we are still waiting in the queue just delete from queue
170
+ if (this.showing) {
171
+ self.$bar.queue(
172
+ function () {
173
+ self.close.apply(self);
174
+ }
175
+ )
176
+ return;
177
+ }
178
+
179
+ if (!this.shown && !this.showing) { // If we are still waiting in the queue just delete from queue
159
180
  var queue = [];
160
181
  $.each($.noty.queue, function (i, n) {
161
182
  if (n.options.id != self.options.id) {
@@ -256,6 +277,7 @@ if (typeof Object.create !== 'function') {
256
277
  },
257
278
 
258
279
  closed:false,
280
+ showing:false,
259
281
  shown:false
260
282
 
261
283
  }; // end NotyObject
@@ -267,6 +289,9 @@ if (typeof Object.create !== 'function') {
267
289
  // Renderer creates a new noty
268
290
  var notification = Object.create(NotyObject).init(options);
269
291
 
292
+ if (notification.options.killer)
293
+ $.noty.closeAll();
294
+
270
295
  (notification.options.force) ? $.noty.queue.unshift(notification) : $.noty.queue.push(notification);
271
296
 
272
297
  $.notyRenderer.render();
@@ -309,15 +334,19 @@ if (typeof Object.create !== 'function') {
309
334
  }
310
335
 
311
336
  // Where is the container?
312
- if ($(notification.options.layout.container.selector).length == 0) {
313
- if (notification.options.custom) {
314
- notification.options.custom.append($(notification.options.layout.container.object).addClass('i-am-new'));
315
- } else {
316
- $('body').append($(notification.options.layout.container.object).addClass('i-am-new'));
317
- }
318
- } else {
319
- $(notification.options.layout.container.selector).removeClass('i-am-new');
320
- }
337
+ if (notification.options.custom) {
338
+ if (notification.options.custom.find(notification.options.layout.container.selector).length == 0) {
339
+ notification.options.custom.append($(notification.options.layout.container.object).addClass('i-am-new'));
340
+ } else {
341
+ notification.options.custom.find(notification.options.layout.container.selector).removeClass('i-am-new');
342
+ }
343
+ } else {
344
+ if ($(notification.options.layout.container.selector).length == 0) {
345
+ $('body').append($(notification.options.layout.container.object).addClass('i-am-new'));
346
+ } else {
347
+ $(notification.options.layout.container.selector).removeClass('i-am-new');
348
+ }
349
+ }
321
350
 
322
351
  $.notyRenderer.setLayoutCountFor(notification, +1);
323
352
 
@@ -420,6 +449,7 @@ if (typeof Object.create !== 'function') {
420
449
  force:false,
421
450
  modal:false,
422
451
  maxVisible:5,
452
+ killer: false,
423
453
  closeWith:['click'],
424
454
  callback:{
425
455
  onShow:function () {
@@ -446,102 +476,5 @@ if (typeof Object.create !== 'function') {
446
476
 
447
477
  // Helpers
448
478
  window.noty = function noty(options) {
449
-
450
- // This is for BC - Will be deleted on v2.2.0
451
- var using_old = 0
452
- , old_to_new = {
453
- 'animateOpen':'animation.open',
454
- 'animateClose':'animation.close',
455
- 'easing':'animation.easing',
456
- 'speed':'animation.speed',
457
- 'onShow':'callback.onShow',
458
- 'onShown':'callback.afterShow',
459
- 'onClose':'callback.onClose',
460
- 'onCloseClick':'callback.onCloseClick',
461
- 'onClosed':'callback.afterClose'
462
- };
463
-
464
- jQuery.each(options, function (key, value) {
465
- if (old_to_new[key]) {
466
- using_old++;
467
- var _new = old_to_new[key].split('.');
468
-
469
- if (!options[_new[0]]) options[_new[0]] = {};
470
-
471
- options[_new[0]][_new[1]] = (value) ? value : function () {
472
- };
473
- delete options[key];
474
- }
475
- });
476
-
477
- if (!options.closeWith) {
478
- options.closeWith = jQuery.noty.defaults.closeWith;
479
- }
480
-
481
- if (options.hasOwnProperty('closeButton')) {
482
- using_old++;
483
- if (options.closeButton) options.closeWith.push('button');
484
- delete options.closeButton;
485
- }
486
-
487
- if (options.hasOwnProperty('closeOnSelfClick')) {
488
- using_old++;
489
- if (options.closeOnSelfClick) options.closeWith.push('click');
490
- delete options.closeOnSelfClick;
491
- }
492
-
493
- if (options.hasOwnProperty('closeOnSelfOver')) {
494
- using_old++;
495
- if (options.closeOnSelfOver) options.closeWith.push('hover');
496
- delete options.closeOnSelfOver;
497
- }
498
-
499
- if (options.hasOwnProperty('custom')) {
500
- using_old++;
501
- if (options.custom.container != 'null') options.custom = options.custom.container;
502
- }
503
-
504
- if (options.hasOwnProperty('cssPrefix')) {
505
- using_old++;
506
- delete options.cssPrefix;
507
- }
508
-
509
- if (options.theme == 'noty_theme_default') {
510
- using_old++;
511
- options.theme = 'defaultTheme';
512
- }
513
-
514
- if (!options.hasOwnProperty('dismissQueue')) {
515
- options.dismissQueue = jQuery.noty.defaults.dismissQueue;
516
- }
517
-
518
- if (!options.hasOwnProperty('maxVisible')) {
519
- options.maxVisible = jQuery.noty.defaults.maxVisible;
520
- }
521
-
522
- if (options.buttons) {
523
- jQuery.each(options.buttons, function (i, button) {
524
- if (button.click) {
525
- using_old++;
526
- button.onClick = button.click;
527
- delete button.click;
528
- }
529
- if (button.type) {
530
- using_old++;
531
- button.addClass = button.type;
532
- delete button.type;
533
- }
534
- });
535
- }
536
-
537
- if (using_old) {
538
- if (typeof console !== "undefined" && console.warn) {
539
- console.warn('You are using noty v2 with v1.x.x options. @deprecated until v2.2.0 - Please update your options.');
540
- }
541
- }
542
-
543
- // console.log(options);
544
- // End of the BC
545
-
546
479
  return jQuery.notyRenderer.init(options);
547
- }
480
+ };
@@ -1,4 +1,4 @@
1
- ;(function($) {
1
+ (function($) {
2
2
 
3
3
  $.noty.layouts.bottom = {
4
4
  name: 'bottom',
@@ -1,4 +1,4 @@
1
- ;(function($) {
1
+ (function($) {
2
2
 
3
3
  $.noty.layouts.bottomCenter = {
4
4
  name: 'bottomCenter',
@@ -1,4 +1,4 @@
1
- ;(function($) {
1
+ (function($) {
2
2
 
3
3
  $.noty.layouts.bottomLeft = {
4
4
  name: 'bottomLeft',
@@ -1,4 +1,4 @@
1
- ;(function($) {
1
+ (function($) {
2
2
 
3
3
  $.noty.layouts.bottomRight = {
4
4
  name: 'bottomRight',
@@ -1,4 +1,4 @@
1
- ;(function($) {
1
+ (function($) {
2
2
 
3
3
  $.noty.layouts.center = {
4
4
  name: 'center',
@@ -1,4 +1,4 @@
1
- ;(function($) {
1
+ (function($) {
2
2
 
3
3
  $.noty.layouts.centerLeft = {
4
4
  name: 'centerLeft',
@@ -1,4 +1,4 @@
1
- ;(function($) {
1
+ (function($) {
2
2
 
3
3
  $.noty.layouts.centerRight = {
4
4
  name: 'centerRight',
@@ -1,11 +1,11 @@
1
- ;(function($) {
1
+ (function($) {
2
2
 
3
3
  $.noty.layouts.inline = {
4
4
  name: 'inline',
5
5
  options: {},
6
6
  container: {
7
- object: '<ul id="noty_inline_layout_container" />',
8
- selector: 'ul#noty_inline_layout_container',
7
+ object: '<ul class="noty_inline_layout_container" />',
8
+ selector: 'ul.noty_inline_layout_container',
9
9
  style: function() {
10
10
  $(this).css({
11
11
  width: '100%',
@@ -1,4 +1,4 @@
1
- ;(function($) {
1
+ (function($) {
2
2
 
3
3
  $.noty.layouts.top = {
4
4
  name: 'top',
@@ -1,4 +1,4 @@
1
- ;(function($) {
1
+ (function($) {
2
2
 
3
3
  $.noty.layouts.topCenter = {
4
4
  name: 'topCenter',
@@ -1,4 +1,4 @@
1
- ;(function($) {
1
+ (function($) {
2
2
 
3
3
  $.noty.layouts.topLeft = {
4
4
  name: 'topLeft',
@@ -1,4 +1,4 @@
1
- ;(function($) {
1
+ (function($) {
2
2
 
3
3
  $.noty.layouts.topRight = {
4
4
  name: 'topRight',
@@ -0,0 +1,1172 @@
1
+ /**
2
+ * noty - jQuery Notification Plugin v2.2.0
3
+ * Contributors: https://github.com/needim/noty/graphs/contributors
4
+ *
5
+ * Examples and Documentation - http://needim.github.com/noty/
6
+ *
7
+ * Licensed under the MIT licenses:
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ *
10
+ **/
11
+
12
+ if (typeof Object.create !== 'function') {
13
+ Object.create = function (o) {
14
+ function F() {
15
+ }
16
+
17
+ F.prototype = o;
18
+ return new F();
19
+ };
20
+ }
21
+
22
+ (function ($) {
23
+
24
+ var NotyObject = {
25
+
26
+ init:function (options) {
27
+
28
+ // Mix in the passed in options with the default options
29
+ this.options = $.extend({}, $.noty.defaults, options);
30
+
31
+ this.options.layout = (this.options.custom) ? $.noty.layouts['inline'] : $.noty.layouts[this.options.layout];
32
+
33
+ if ($.noty.themes[this.options.theme])
34
+ this.options.theme = $.noty.themes[this.options.theme];
35
+ else
36
+ options.themeClassName = this.options.theme;
37
+
38
+ delete options.layout;
39
+ delete options.theme;
40
+
41
+ this.options = $.extend({}, this.options, this.options.layout.options);
42
+ this.options.id = 'noty_' + (new Date().getTime() * Math.floor(Math.random() * 1000000));
43
+
44
+ this.options = $.extend({}, this.options, options);
45
+
46
+ // Build the noty dom initial structure
47
+ this._build();
48
+
49
+ // return this so we can chain/use the bridge with less code.
50
+ return this;
51
+ }, // end init
52
+
53
+ _build:function () {
54
+
55
+ // Generating noty bar
56
+ var $bar = $('<div class="noty_bar noty_type_' + this.options.type + '"></div>').attr('id', this.options.id);
57
+ $bar.append(this.options.template).find('.noty_text').html(this.options.text);
58
+
59
+ this.$bar = (this.options.layout.parent.object !== null) ? $(this.options.layout.parent.object).css(this.options.layout.parent.css).append($bar) : $bar;
60
+
61
+ if (this.options.themeClassName)
62
+ this.$bar.addClass(this.options.themeClassName).addClass('noty_container_type_' + this.options.type);
63
+
64
+ // Set buttons if available
65
+ if (this.options.buttons) {
66
+
67
+ // If we have button disable closeWith & timeout options
68
+ this.options.closeWith = [];
69
+ this.options.timeout = false;
70
+
71
+ var $buttons = $('<div/>').addClass('noty_buttons');
72
+
73
+ (this.options.layout.parent.object !== null) ? this.$bar.find('.noty_bar').append($buttons) : this.$bar.append($buttons);
74
+
75
+ var self = this;
76
+
77
+ $.each(this.options.buttons, function (i, button) {
78
+ var $button = $('<button/>').addClass((button.addClass) ? button.addClass : 'gray').html(button.text).attr('id', button.id ? button.id : 'button-' + i)
79
+ .appendTo(self.$bar.find('.noty_buttons'))
80
+ .bind('click', function () {
81
+ if ($.isFunction(button.onClick)) {
82
+ button.onClick.call($button, self);
83
+ }
84
+ });
85
+ });
86
+ }
87
+
88
+ // For easy access
89
+ this.$message = this.$bar.find('.noty_message');
90
+ this.$closeButton = this.$bar.find('.noty_close');
91
+ this.$buttons = this.$bar.find('.noty_buttons');
92
+
93
+ $.noty.store[this.options.id] = this; // store noty for api
94
+
95
+ }, // end _build
96
+
97
+ show:function () {
98
+
99
+ var self = this;
100
+
101
+ (self.options.custom) ? self.options.custom.find(self.options.layout.container.selector).append(self.$bar) : $(self.options.layout.container.selector).append(self.$bar);
102
+
103
+ if (self.options.theme && self.options.theme.style)
104
+ self.options.theme.style.apply(self);
105
+
106
+ ($.type(self.options.layout.css) === 'function') ? this.options.layout.css.apply(self.$bar) : self.$bar.css(this.options.layout.css || {});
107
+
108
+ self.$bar.addClass(self.options.layout.addClass);
109
+
110
+ self.options.layout.container.style.apply($(self.options.layout.container.selector));
111
+
112
+ self.showing = true;
113
+
114
+ if (self.options.theme && self.options.theme.style)
115
+ self.options.theme.callback.onShow.apply(this);
116
+
117
+ if ($.inArray('click', self.options.closeWith) > -1)
118
+ self.$bar.css('cursor', 'pointer').one('click', function (evt) {
119
+ self.stopPropagation(evt);
120
+ if (self.options.callback.onCloseClick) {
121
+ self.options.callback.onCloseClick.apply(self);
122
+ }
123
+ self.close();
124
+ });
125
+
126
+ if ($.inArray('hover', self.options.closeWith) > -1)
127
+ self.$bar.one('mouseenter', function () {
128
+ self.close();
129
+ });
130
+
131
+ if ($.inArray('button', self.options.closeWith) > -1)
132
+ self.$closeButton.one('click', function (evt) {
133
+ self.stopPropagation(evt);
134
+ self.close();
135
+ });
136
+
137
+ if ($.inArray('button', self.options.closeWith) == -1)
138
+ self.$closeButton.remove();
139
+
140
+ if (self.options.callback.onShow)
141
+ self.options.callback.onShow.apply(self);
142
+
143
+ self.$bar.animate(
144
+ self.options.animation.open,
145
+ self.options.animation.speed,
146
+ self.options.animation.easing,
147
+ function () {
148
+ if (self.options.callback.afterShow) self.options.callback.afterShow.apply(self);
149
+ self.showing = false;
150
+ self.shown = true;
151
+ });
152
+
153
+ // If noty is have a timeout option
154
+ if (self.options.timeout)
155
+ self.$bar.delay(self.options.timeout).promise().done(function () {
156
+ self.close();
157
+ });
158
+
159
+ return this;
160
+
161
+ }, // end show
162
+
163
+ close:function () {
164
+
165
+ if (this.closed) return;
166
+ if (this.$bar && this.$bar.hasClass('i-am-closing-now')) return;
167
+
168
+ var self = this;
169
+
170
+ if (this.showing) {
171
+ self.$bar.queue(
172
+ function () {
173
+ self.close.apply(self);
174
+ }
175
+ )
176
+ return;
177
+ }
178
+
179
+ if (!this.shown && !this.showing) { // If we are still waiting in the queue just delete from queue
180
+ var queue = [];
181
+ $.each($.noty.queue, function (i, n) {
182
+ if (n.options.id != self.options.id) {
183
+ queue.push(n);
184
+ }
185
+ });
186
+ $.noty.queue = queue;
187
+ return;
188
+ }
189
+
190
+ self.$bar.addClass('i-am-closing-now');
191
+
192
+ if (self.options.callback.onClose) {
193
+ self.options.callback.onClose.apply(self);
194
+ }
195
+
196
+ self.$bar.clearQueue().stop().animate(
197
+ self.options.animation.close,
198
+ self.options.animation.speed,
199
+ self.options.animation.easing,
200
+ function () {
201
+ if (self.options.callback.afterClose) self.options.callback.afterClose.apply(self);
202
+ })
203
+ .promise().done(function () {
204
+
205
+ // Modal Cleaning
206
+ if (self.options.modal) {
207
+ $.notyRenderer.setModalCount(-1);
208
+ if ($.notyRenderer.getModalCount() == 0) $('.noty_modal').fadeOut('fast', function () {
209
+ $(this).remove();
210
+ });
211
+ }
212
+
213
+ // Layout Cleaning
214
+ $.notyRenderer.setLayoutCountFor(self, -1);
215
+ if ($.notyRenderer.getLayoutCountFor(self) == 0) $(self.options.layout.container.selector).remove();
216
+
217
+ // Make sure self.$bar has not been removed before attempting to remove it
218
+ if (typeof self.$bar !== 'undefined' && self.$bar !== null ) {
219
+ self.$bar.remove();
220
+ self.$bar = null;
221
+ self.closed = true;
222
+ }
223
+
224
+ delete $.noty.store[self.options.id]; // deleting noty from store
225
+
226
+ self.options.theme.callback.onClose.apply(self);
227
+
228
+ if (!self.options.dismissQueue) {
229
+ // Queue render
230
+ $.noty.ontap = true;
231
+
232
+ $.notyRenderer.render();
233
+ }
234
+
235
+ if (self.options.maxVisible > 0 && self.options.dismissQueue) {
236
+ $.notyRenderer.render();
237
+ }
238
+ })
239
+
240
+ }, // end close
241
+
242
+ setText:function (text) {
243
+ if (!this.closed) {
244
+ this.options.text = text;
245
+ this.$bar.find('.noty_text').html(text);
246
+ }
247
+ return this;
248
+ },
249
+
250
+ setType:function (type) {
251
+ if (!this.closed) {
252
+ this.options.type = type;
253
+ this.options.theme.style.apply(this);
254
+ this.options.theme.callback.onShow.apply(this);
255
+ }
256
+ return this;
257
+ },
258
+
259
+ setTimeout:function (time) {
260
+ if (!this.closed) {
261
+ var self = this;
262
+ this.options.timeout = time;
263
+ self.$bar.delay(self.options.timeout).promise().done(function () {
264
+ self.close();
265
+ });
266
+ }
267
+ return this;
268
+ },
269
+
270
+ stopPropagation:function (evt) {
271
+ evt = evt || window.event;
272
+ if (typeof evt.stopPropagation !== "undefined") {
273
+ evt.stopPropagation();
274
+ } else {
275
+ evt.cancelBubble = true;
276
+ }
277
+ },
278
+
279
+ closed:false,
280
+ showing:false,
281
+ shown:false
282
+
283
+ }; // end NotyObject
284
+
285
+ $.notyRenderer = {};
286
+
287
+ $.notyRenderer.init = function (options) {
288
+
289
+ // Renderer creates a new noty
290
+ var notification = Object.create(NotyObject).init(options);
291
+
292
+ if (notification.options.killer)
293
+ $.noty.closeAll();
294
+
295
+ (notification.options.force) ? $.noty.queue.unshift(notification) : $.noty.queue.push(notification);
296
+
297
+ $.notyRenderer.render();
298
+
299
+ return ($.noty.returns == 'object') ? notification : notification.options.id;
300
+ };
301
+
302
+ $.notyRenderer.render = function () {
303
+
304
+ var instance = $.noty.queue[0];
305
+
306
+ if ($.type(instance) === 'object') {
307
+ if (instance.options.dismissQueue) {
308
+ if (instance.options.maxVisible > 0) {
309
+ if ($(instance.options.layout.container.selector + ' li').length < instance.options.maxVisible) {
310
+ $.notyRenderer.show($.noty.queue.shift());
311
+ } else {
312
+
313
+ }
314
+ } else {
315
+ $.notyRenderer.show($.noty.queue.shift());
316
+ }
317
+ } else {
318
+ if ($.noty.ontap) {
319
+ $.notyRenderer.show($.noty.queue.shift());
320
+ $.noty.ontap = false;
321
+ }
322
+ }
323
+ } else {
324
+ $.noty.ontap = true; // Queue is over
325
+ }
326
+
327
+ };
328
+
329
+ $.notyRenderer.show = function (notification) {
330
+
331
+ if (notification.options.modal) {
332
+ $.notyRenderer.createModalFor(notification);
333
+ $.notyRenderer.setModalCount(+1);
334
+ }
335
+
336
+ // Where is the container?
337
+ if (notification.options.custom) {
338
+ if (notification.options.custom.find(notification.options.layout.container.selector).length == 0) {
339
+ notification.options.custom.append($(notification.options.layout.container.object).addClass('i-am-new'));
340
+ } else {
341
+ notification.options.custom.find(notification.options.layout.container.selector).removeClass('i-am-new');
342
+ }
343
+ } else {
344
+ if ($(notification.options.layout.container.selector).length == 0) {
345
+ $('body').append($(notification.options.layout.container.object).addClass('i-am-new'));
346
+ } else {
347
+ $(notification.options.layout.container.selector).removeClass('i-am-new');
348
+ }
349
+ }
350
+
351
+ $.notyRenderer.setLayoutCountFor(notification, +1);
352
+
353
+ notification.show();
354
+ };
355
+
356
+ $.notyRenderer.createModalFor = function (notification) {
357
+ if ($('.noty_modal').length == 0)
358
+ $('<div/>').addClass('noty_modal').data('noty_modal_count', 0).css(notification.options.theme.modal.css).prependTo($('body')).fadeIn('fast');
359
+ };
360
+
361
+ $.notyRenderer.getLayoutCountFor = function (notification) {
362
+ return $(notification.options.layout.container.selector).data('noty_layout_count') || 0;
363
+ };
364
+
365
+ $.notyRenderer.setLayoutCountFor = function (notification, arg) {
366
+ return $(notification.options.layout.container.selector).data('noty_layout_count', $.notyRenderer.getLayoutCountFor(notification) + arg);
367
+ };
368
+
369
+ $.notyRenderer.getModalCount = function () {
370
+ return $('.noty_modal').data('noty_modal_count') || 0;
371
+ };
372
+
373
+ $.notyRenderer.setModalCount = function (arg) {
374
+ return $('.noty_modal').data('noty_modal_count', $.notyRenderer.getModalCount() + arg);
375
+ };
376
+
377
+ // This is for custom container
378
+ $.fn.noty = function (options) {
379
+ options.custom = $(this);
380
+ return $.notyRenderer.init(options);
381
+ };
382
+
383
+ $.noty = {};
384
+ $.noty.queue = [];
385
+ $.noty.ontap = true;
386
+ $.noty.layouts = {};
387
+ $.noty.themes = {};
388
+ $.noty.returns = 'object';
389
+ $.noty.store = {};
390
+
391
+ $.noty.get = function (id) {
392
+ return $.noty.store.hasOwnProperty(id) ? $.noty.store[id] : false;
393
+ };
394
+
395
+ $.noty.close = function (id) {
396
+ return $.noty.get(id) ? $.noty.get(id).close() : false;
397
+ };
398
+
399
+ $.noty.setText = function (id, text) {
400
+ return $.noty.get(id) ? $.noty.get(id).setText(text) : false;
401
+ };
402
+
403
+ $.noty.setType = function (id, type) {
404
+ return $.noty.get(id) ? $.noty.get(id).setType(type) : false;
405
+ };
406
+
407
+ $.noty.clearQueue = function () {
408
+ $.noty.queue = [];
409
+ };
410
+
411
+ $.noty.closeAll = function () {
412
+ $.noty.clearQueue();
413
+ $.each($.noty.store, function (id, noty) {
414
+ noty.close();
415
+ });
416
+ };
417
+
418
+ var windowAlert = window.alert;
419
+
420
+ $.noty.consumeAlert = function (options) {
421
+ window.alert = function (text) {
422
+ if (options)
423
+ options.text = text;
424
+ else
425
+ options = {text:text};
426
+
427
+ $.notyRenderer.init(options);
428
+ };
429
+ };
430
+
431
+ $.noty.stopConsumeAlert = function () {
432
+ window.alert = windowAlert;
433
+ };
434
+
435
+ $.noty.defaults = {
436
+ layout:'top',
437
+ theme:'defaultTheme',
438
+ type:'alert',
439
+ text:'',
440
+ dismissQueue:true,
441
+ template:'<div class="noty_message"><span class="noty_text"></span><div class="noty_close"></div></div>',
442
+ animation:{
443
+ open:{height:'toggle'},
444
+ close:{height:'toggle'},
445
+ easing:'swing',
446
+ speed:500
447
+ },
448
+ timeout:false,
449
+ force:false,
450
+ modal:false,
451
+ maxVisible:5,
452
+ killer: false,
453
+ closeWith:['click'],
454
+ callback:{
455
+ onShow:function () {
456
+ },
457
+ afterShow:function () {
458
+ },
459
+ onClose:function () {
460
+ },
461
+ afterClose:function () {
462
+ },
463
+ onCloseClick:function () {
464
+ }
465
+ },
466
+ buttons:false
467
+ };
468
+
469
+ $(window).resize(function () {
470
+ $.each($.noty.layouts, function (index, layout) {
471
+ layout.container.style.apply($(layout.container.selector));
472
+ });
473
+ });
474
+
475
+ })(jQuery);
476
+
477
+ // Helpers
478
+ window.noty = function noty(options) {
479
+ return jQuery.notyRenderer.init(options);
480
+ };
481
+
482
+ (function($) {
483
+
484
+ $.noty.layouts.bottom = {
485
+ name: 'bottom',
486
+ options: {},
487
+ container: {
488
+ object: '<ul id="noty_bottom_layout_container" />',
489
+ selector: 'ul#noty_bottom_layout_container',
490
+ style: function() {
491
+ $(this).css({
492
+ bottom: 0,
493
+ left: '5%',
494
+ position: 'fixed',
495
+ width: '90%',
496
+ height: 'auto',
497
+ margin: 0,
498
+ padding: 0,
499
+ listStyleType: 'none',
500
+ zIndex: 9999999
501
+ });
502
+ }
503
+ },
504
+ parent: {
505
+ object: '<li />',
506
+ selector: 'li',
507
+ css: {}
508
+ },
509
+ css: {
510
+ display: 'none'
511
+ },
512
+ addClass: ''
513
+ };
514
+
515
+ })(jQuery);
516
+ (function($) {
517
+
518
+ $.noty.layouts.bottomCenter = {
519
+ name: 'bottomCenter',
520
+ options: { // overrides options
521
+
522
+ },
523
+ container: {
524
+ object: '<ul id="noty_bottomCenter_layout_container" />',
525
+ selector: 'ul#noty_bottomCenter_layout_container',
526
+ style: function() {
527
+ $(this).css({
528
+ bottom: 20,
529
+ left: 0,
530
+ position: 'fixed',
531
+ width: '310px',
532
+ height: 'auto',
533
+ margin: 0,
534
+ padding: 0,
535
+ listStyleType: 'none',
536
+ zIndex: 10000000
537
+ });
538
+
539
+ $(this).css({
540
+ left: ($(window).width() - $(this).outerWidth(false)) / 2 + 'px'
541
+ });
542
+ }
543
+ },
544
+ parent: {
545
+ object: '<li />',
546
+ selector: 'li',
547
+ css: {}
548
+ },
549
+ css: {
550
+ display: 'none',
551
+ width: '310px'
552
+ },
553
+ addClass: ''
554
+ };
555
+
556
+ })(jQuery);
557
+
558
+ (function($) {
559
+
560
+ $.noty.layouts.bottomLeft = {
561
+ name: 'bottomLeft',
562
+ options: { // overrides options
563
+
564
+ },
565
+ container: {
566
+ object: '<ul id="noty_bottomLeft_layout_container" />',
567
+ selector: 'ul#noty_bottomLeft_layout_container',
568
+ style: function() {
569
+ $(this).css({
570
+ bottom: 20,
571
+ left: 20,
572
+ position: 'fixed',
573
+ width: '310px',
574
+ height: 'auto',
575
+ margin: 0,
576
+ padding: 0,
577
+ listStyleType: 'none',
578
+ zIndex: 10000000
579
+ });
580
+
581
+ if (window.innerWidth < 600) {
582
+ $(this).css({
583
+ left: 5
584
+ });
585
+ }
586
+ }
587
+ },
588
+ parent: {
589
+ object: '<li />',
590
+ selector: 'li',
591
+ css: {}
592
+ },
593
+ css: {
594
+ display: 'none',
595
+ width: '310px'
596
+ },
597
+ addClass: ''
598
+ };
599
+
600
+ })(jQuery);
601
+ (function($) {
602
+
603
+ $.noty.layouts.bottomRight = {
604
+ name: 'bottomRight',
605
+ options: { // overrides options
606
+
607
+ },
608
+ container: {
609
+ object: '<ul id="noty_bottomRight_layout_container" />',
610
+ selector: 'ul#noty_bottomRight_layout_container',
611
+ style: function() {
612
+ $(this).css({
613
+ bottom: 20,
614
+ right: 20,
615
+ position: 'fixed',
616
+ width: '310px',
617
+ height: 'auto',
618
+ margin: 0,
619
+ padding: 0,
620
+ listStyleType: 'none',
621
+ zIndex: 10000000
622
+ });
623
+
624
+ if (window.innerWidth < 600) {
625
+ $(this).css({
626
+ right: 5
627
+ });
628
+ }
629
+ }
630
+ },
631
+ parent: {
632
+ object: '<li />',
633
+ selector: 'li',
634
+ css: {}
635
+ },
636
+ css: {
637
+ display: 'none',
638
+ width: '310px'
639
+ },
640
+ addClass: ''
641
+ };
642
+
643
+ })(jQuery);
644
+ (function($) {
645
+
646
+ $.noty.layouts.center = {
647
+ name: 'center',
648
+ options: { // overrides options
649
+
650
+ },
651
+ container: {
652
+ object: '<ul id="noty_center_layout_container" />',
653
+ selector: 'ul#noty_center_layout_container',
654
+ style: function() {
655
+ $(this).css({
656
+ position: 'fixed',
657
+ width: '310px',
658
+ height: 'auto',
659
+ margin: 0,
660
+ padding: 0,
661
+ listStyleType: 'none',
662
+ zIndex: 10000000
663
+ });
664
+
665
+ // getting hidden height
666
+ var dupe = $(this).clone().css({visibility:"hidden", display:"block", position:"absolute", top: 0, left: 0}).attr('id', 'dupe');
667
+ $("body").append(dupe);
668
+ dupe.find('.i-am-closing-now').remove();
669
+ dupe.find('li').css('display', 'block');
670
+ var actual_height = dupe.height();
671
+ dupe.remove();
672
+
673
+ if ($(this).hasClass('i-am-new')) {
674
+ $(this).css({
675
+ left: ($(window).width() - $(this).outerWidth(false)) / 2 + 'px',
676
+ top: ($(window).height() - actual_height) / 2 + 'px'
677
+ });
678
+ } else {
679
+ $(this).animate({
680
+ left: ($(window).width() - $(this).outerWidth(false)) / 2 + 'px',
681
+ top: ($(window).height() - actual_height) / 2 + 'px'
682
+ }, 500);
683
+ }
684
+
685
+ }
686
+ },
687
+ parent: {
688
+ object: '<li />',
689
+ selector: 'li',
690
+ css: {}
691
+ },
692
+ css: {
693
+ display: 'none',
694
+ width: '310px'
695
+ },
696
+ addClass: ''
697
+ };
698
+
699
+ })(jQuery);
700
+ (function($) {
701
+
702
+ $.noty.layouts.centerLeft = {
703
+ name: 'centerLeft',
704
+ options: { // overrides options
705
+
706
+ },
707
+ container: {
708
+ object: '<ul id="noty_centerLeft_layout_container" />',
709
+ selector: 'ul#noty_centerLeft_layout_container',
710
+ style: function() {
711
+ $(this).css({
712
+ left: 20,
713
+ position: 'fixed',
714
+ width: '310px',
715
+ height: 'auto',
716
+ margin: 0,
717
+ padding: 0,
718
+ listStyleType: 'none',
719
+ zIndex: 10000000
720
+ });
721
+
722
+ // getting hidden height
723
+ var dupe = $(this).clone().css({visibility:"hidden", display:"block", position:"absolute", top: 0, left: 0}).attr('id', 'dupe');
724
+ $("body").append(dupe);
725
+ dupe.find('.i-am-closing-now').remove();
726
+ dupe.find('li').css('display', 'block');
727
+ var actual_height = dupe.height();
728
+ dupe.remove();
729
+
730
+ if ($(this).hasClass('i-am-new')) {
731
+ $(this).css({
732
+ top: ($(window).height() - actual_height) / 2 + 'px'
733
+ });
734
+ } else {
735
+ $(this).animate({
736
+ top: ($(window).height() - actual_height) / 2 + 'px'
737
+ }, 500);
738
+ }
739
+
740
+ if (window.innerWidth < 600) {
741
+ $(this).css({
742
+ left: 5
743
+ });
744
+ }
745
+
746
+ }
747
+ },
748
+ parent: {
749
+ object: '<li />',
750
+ selector: 'li',
751
+ css: {}
752
+ },
753
+ css: {
754
+ display: 'none',
755
+ width: '310px'
756
+ },
757
+ addClass: ''
758
+ };
759
+
760
+ })(jQuery);
761
+
762
+ (function($) {
763
+
764
+ $.noty.layouts.centerRight = {
765
+ name: 'centerRight',
766
+ options: { // overrides options
767
+
768
+ },
769
+ container: {
770
+ object: '<ul id="noty_centerRight_layout_container" />',
771
+ selector: 'ul#noty_centerRight_layout_container',
772
+ style: function() {
773
+ $(this).css({
774
+ right: 20,
775
+ position: 'fixed',
776
+ width: '310px',
777
+ height: 'auto',
778
+ margin: 0,
779
+ padding: 0,
780
+ listStyleType: 'none',
781
+ zIndex: 10000000
782
+ });
783
+
784
+ // getting hidden height
785
+ var dupe = $(this).clone().css({visibility:"hidden", display:"block", position:"absolute", top: 0, left: 0}).attr('id', 'dupe');
786
+ $("body").append(dupe);
787
+ dupe.find('.i-am-closing-now').remove();
788
+ dupe.find('li').css('display', 'block');
789
+ var actual_height = dupe.height();
790
+ dupe.remove();
791
+
792
+ if ($(this).hasClass('i-am-new')) {
793
+ $(this).css({
794
+ top: ($(window).height() - actual_height) / 2 + 'px'
795
+ });
796
+ } else {
797
+ $(this).animate({
798
+ top: ($(window).height() - actual_height) / 2 + 'px'
799
+ }, 500);
800
+ }
801
+
802
+ if (window.innerWidth < 600) {
803
+ $(this).css({
804
+ right: 5
805
+ });
806
+ }
807
+
808
+ }
809
+ },
810
+ parent: {
811
+ object: '<li />',
812
+ selector: 'li',
813
+ css: {}
814
+ },
815
+ css: {
816
+ display: 'none',
817
+ width: '310px'
818
+ },
819
+ addClass: ''
820
+ };
821
+
822
+ })(jQuery);
823
+
824
+ (function($) {
825
+
826
+ $.noty.layouts.inline = {
827
+ name: 'inline',
828
+ options: {},
829
+ container: {
830
+ object: '<ul class="noty_inline_layout_container" />',
831
+ selector: 'ul.noty_inline_layout_container',
832
+ style: function() {
833
+ $(this).css({
834
+ width: '100%',
835
+ height: 'auto',
836
+ margin: 0,
837
+ padding: 0,
838
+ listStyleType: 'none',
839
+ zIndex: 9999999
840
+ });
841
+ }
842
+ },
843
+ parent: {
844
+ object: '<li />',
845
+ selector: 'li',
846
+ css: {}
847
+ },
848
+ css: {
849
+ display: 'none'
850
+ },
851
+ addClass: ''
852
+ };
853
+
854
+ })(jQuery);
855
+ (function($) {
856
+
857
+ $.noty.layouts.top = {
858
+ name: 'top',
859
+ options: {},
860
+ container: {
861
+ object: '<ul id="noty_top_layout_container" />',
862
+ selector: 'ul#noty_top_layout_container',
863
+ style: function() {
864
+ $(this).css({
865
+ top: 0,
866
+ left: '5%',
867
+ position: 'fixed',
868
+ width: '90%',
869
+ height: 'auto',
870
+ margin: 0,
871
+ padding: 0,
872
+ listStyleType: 'none',
873
+ zIndex: 9999999
874
+ });
875
+ }
876
+ },
877
+ parent: {
878
+ object: '<li />',
879
+ selector: 'li',
880
+ css: {}
881
+ },
882
+ css: {
883
+ display: 'none'
884
+ },
885
+ addClass: ''
886
+ };
887
+
888
+ })(jQuery);
889
+ (function($) {
890
+
891
+ $.noty.layouts.topCenter = {
892
+ name: 'topCenter',
893
+ options: { // overrides options
894
+
895
+ },
896
+ container: {
897
+ object: '<ul id="noty_topCenter_layout_container" />',
898
+ selector: 'ul#noty_topCenter_layout_container',
899
+ style: function() {
900
+ $(this).css({
901
+ top: 20,
902
+ left: 0,
903
+ position: 'fixed',
904
+ width: '310px',
905
+ height: 'auto',
906
+ margin: 0,
907
+ padding: 0,
908
+ listStyleType: 'none',
909
+ zIndex: 10000000
910
+ });
911
+
912
+ $(this).css({
913
+ left: ($(window).width() - $(this).outerWidth(false)) / 2 + 'px'
914
+ });
915
+ }
916
+ },
917
+ parent: {
918
+ object: '<li />',
919
+ selector: 'li',
920
+ css: {}
921
+ },
922
+ css: {
923
+ display: 'none',
924
+ width: '310px'
925
+ },
926
+ addClass: ''
927
+ };
928
+
929
+ })(jQuery);
930
+
931
+ (function($) {
932
+
933
+ $.noty.layouts.topLeft = {
934
+ name: 'topLeft',
935
+ options: { // overrides options
936
+
937
+ },
938
+ container: {
939
+ object: '<ul id="noty_topLeft_layout_container" />',
940
+ selector: 'ul#noty_topLeft_layout_container',
941
+ style: function() {
942
+ $(this).css({
943
+ top: 20,
944
+ left: 20,
945
+ position: 'fixed',
946
+ width: '310px',
947
+ height: 'auto',
948
+ margin: 0,
949
+ padding: 0,
950
+ listStyleType: 'none',
951
+ zIndex: 10000000
952
+ });
953
+
954
+ if (window.innerWidth < 600) {
955
+ $(this).css({
956
+ left: 5
957
+ });
958
+ }
959
+ }
960
+ },
961
+ parent: {
962
+ object: '<li />',
963
+ selector: 'li',
964
+ css: {}
965
+ },
966
+ css: {
967
+ display: 'none',
968
+ width: '310px'
969
+ },
970
+ addClass: ''
971
+ };
972
+
973
+ })(jQuery);
974
+ (function($) {
975
+
976
+ $.noty.layouts.topRight = {
977
+ name: 'topRight',
978
+ options: { // overrides options
979
+
980
+ },
981
+ container: {
982
+ object: '<ul id="noty_topRight_layout_container" />',
983
+ selector: 'ul#noty_topRight_layout_container',
984
+ style: function() {
985
+ $(this).css({
986
+ top: 20,
987
+ right: 20,
988
+ position: 'fixed',
989
+ width: '310px',
990
+ height: 'auto',
991
+ margin: 0,
992
+ padding: 0,
993
+ listStyleType: 'none',
994
+ zIndex: 10000000
995
+ });
996
+
997
+ if (window.innerWidth < 600) {
998
+ $(this).css({
999
+ right: 5
1000
+ });
1001
+ }
1002
+ }
1003
+ },
1004
+ parent: {
1005
+ object: '<li />',
1006
+ selector: 'li',
1007
+ css: {}
1008
+ },
1009
+ css: {
1010
+ display: 'none',
1011
+ width: '310px'
1012
+ },
1013
+ addClass: ''
1014
+ };
1015
+
1016
+ })(jQuery);
1017
+ (function($) {
1018
+
1019
+ $.noty.themes.defaultTheme = {
1020
+ name: 'defaultTheme',
1021
+ helpers: {
1022
+ borderFix: function() {
1023
+ if (this.options.dismissQueue) {
1024
+ var selector = this.options.layout.container.selector + ' ' + this.options.layout.parent.selector;
1025
+ switch (this.options.layout.name) {
1026
+ case 'top':
1027
+ $(selector).css({borderRadius: '0px 0px 0px 0px'});
1028
+ $(selector).last().css({borderRadius: '0px 0px 5px 5px'}); break;
1029
+ case 'topCenter': case 'topLeft': case 'topRight':
1030
+ case 'bottomCenter': case 'bottomLeft': case 'bottomRight':
1031
+ case 'center': case 'centerLeft': case 'centerRight': case 'inline':
1032
+ $(selector).css({borderRadius: '0px 0px 0px 0px'});
1033
+ $(selector).first().css({'border-top-left-radius': '5px', 'border-top-right-radius': '5px'});
1034
+ $(selector).last().css({'border-bottom-left-radius': '5px', 'border-bottom-right-radius': '5px'}); break;
1035
+ case 'bottom':
1036
+ $(selector).css({borderRadius: '0px 0px 0px 0px'});
1037
+ $(selector).first().css({borderRadius: '5px 5px 0px 0px'}); break;
1038
+ default: break;
1039
+ }
1040
+ }
1041
+ }
1042
+ },
1043
+ modal: {
1044
+ css: {
1045
+ position: 'fixed',
1046
+ width: '100%',
1047
+ height: '100%',
1048
+ backgroundColor: '#000',
1049
+ zIndex: 10000,
1050
+ opacity: 0.6,
1051
+ display: 'none',
1052
+ left: 0,
1053
+ top: 0
1054
+ }
1055
+ },
1056
+ style: function() {
1057
+
1058
+ this.$bar.css({
1059
+ overflow: 'hidden',
1060
+ background: "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAoCAYAAAAPOoFWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAPZJREFUeNq81tsOgjAMANB2ov7/7ypaN7IlIwi9rGuT8QSc9EIDAsAznxvY4pXPKr05RUE5MEVB+TyWfCEl9LZApYopCmo9C4FKSMtYoI8Bwv79aQJU4l6hXXCZrQbokJEksxHo9KMOgc6w1atHXM8K9DVC7FQnJ0i8iK3QooGgbnyKgMDygBWyYFZoqx4qS27KqLZJjA1D0jK6QJcYEQEiWv9PGkTsbqxQ8oT+ZtZB6AkdsJnQDnMoHXHLGKOgDYuCWmYhEERCI5gaamW0bnHdA3k2ltlIN+2qKRyCND0bhqSYCyTB3CAOc4WusBEIpkeBuPgJMAAX8Hs1NfqHRgAAAABJRU5ErkJggg==') repeat-x scroll left top #fff"
1061
+ });
1062
+
1063
+ this.$message.css({
1064
+ fontSize: '13px',
1065
+ lineHeight: '16px',
1066
+ textAlign: 'center',
1067
+ padding: '8px 10px 9px',
1068
+ width: 'auto',
1069
+ position: 'relative'
1070
+ });
1071
+
1072
+ this.$closeButton.css({
1073
+ position: 'absolute',
1074
+ top: 4, right: 4,
1075
+ width: 10, height: 10,
1076
+ background: "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQ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+ });
1080
+
1081
+ this.$buttons.css({
1082
+ padding: 5,
1083
+ textAlign: 'right',
1084
+ borderTop: '1px solid #ccc',
1085
+ backgroundColor: '#fff'
1086
+ });
1087
+
1088
+ this.$buttons.find('button').css({
1089
+ marginLeft: 5
1090
+ });
1091
+
1092
+ this.$buttons.find('button:first').css({
1093
+ marginLeft: 0
1094
+ });
1095
+
1096
+ this.$bar.bind({
1097
+ mouseenter: function() { $(this).find('.noty_close').stop().fadeTo('normal',1); },
1098
+ mouseleave: function() { $(this).find('.noty_close').stop().fadeTo('normal',0); }
1099
+ });
1100
+
1101
+ switch (this.options.layout.name) {
1102
+ case 'top':
1103
+ this.$bar.css({
1104
+ borderRadius: '0px 0px 5px 5px',
1105
+ borderBottom: '2px solid #eee',
1106
+ borderLeft: '2px solid #eee',
1107
+ borderRight: '2px solid #eee',
1108
+ boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
1109
+ });
1110
+ break;
1111
+ case 'topCenter': case 'center': case 'bottomCenter': case 'inline':
1112
+ this.$bar.css({
1113
+ borderRadius: '5px',
1114
+ border: '1px solid #eee',
1115
+ boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
1116
+ });
1117
+ this.$message.css({fontSize: '13px', textAlign: 'center'});
1118
+ break;
1119
+ case 'topLeft': case 'topRight':
1120
+ case 'bottomLeft': case 'bottomRight':
1121
+ case 'centerLeft': case 'centerRight':
1122
+ this.$bar.css({
1123
+ borderRadius: '5px',
1124
+ border: '1px solid #eee',
1125
+ boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
1126
+ });
1127
+ this.$message.css({fontSize: '13px', textAlign: 'left'});
1128
+ break;
1129
+ case 'bottom':
1130
+ this.$bar.css({
1131
+ borderRadius: '5px 5px 0px 0px',
1132
+ borderTop: '2px solid #eee',
1133
+ borderLeft: '2px solid #eee',
1134
+ borderRight: '2px solid #eee',
1135
+ boxShadow: "0 -2px 4px rgba(0, 0, 0, 0.1)"
1136
+ });
1137
+ break;
1138
+ default:
1139
+ this.$bar.css({
1140
+ border: '2px solid #eee',
1141
+ boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
1142
+ });
1143
+ break;
1144
+ }
1145
+
1146
+ switch (this.options.type) {
1147
+ case 'alert': case 'notification':
1148
+ this.$bar.css({backgroundColor: '#FFF', borderColor: '#CCC', color: '#444'}); break;
1149
+ case 'warning':
1150
+ this.$bar.css({backgroundColor: '#FFEAA8', borderColor: '#FFC237', color: '#826200'});
1151
+ this.$buttons.css({borderTop: '1px solid #FFC237'}); break;
1152
+ case 'error':
1153
+ this.$bar.css({backgroundColor: 'red', borderColor: 'darkred', color: '#FFF'});
1154
+ this.$message.css({fontWeight: 'bold'});
1155
+ this.$buttons.css({borderTop: '1px solid darkred'}); break;
1156
+ case 'information':
1157
+ this.$bar.css({backgroundColor: '#57B7E2', borderColor: '#0B90C4', color: '#FFF'});
1158
+ this.$buttons.css({borderTop: '1px solid #0B90C4'}); break;
1159
+ case 'success':
1160
+ this.$bar.css({backgroundColor: 'lightgreen', borderColor: '#50C24E', color: 'darkgreen'});
1161
+ this.$buttons.css({borderTop: '1px solid #50C24E'});break;
1162
+ default:
1163
+ this.$bar.css({backgroundColor: '#FFF', borderColor: '#CCC', color: '#444'}); break;
1164
+ }
1165
+ },
1166
+ callback: {
1167
+ onShow: function() { $.noty.themes.defaultTheme.helpers.borderFix.apply(this); },
1168
+ onClose: function() { $.noty.themes.defaultTheme.helpers.borderFix.apply(this); }
1169
+ }
1170
+ };
1171
+
1172
+ })(jQuery);