xooie 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,7 +26,8 @@
26
26
  * Screen reader users will percieve the carousel as a [list](http://www.w3.org/TR/wai-aria/roles#list) of items.
27
27
  * For most devices, the native scrollbar is hidden in favor of the directional controls and native scrolling.
28
28
  **/
29
- define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'xooie/event_handler'], function($, helpers, Base, EventHandler) {
29
+ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'xooie/event_handler'], function ($, helpers, Base, EventHandler) {
30
+ 'use strict';
30
31
  var Carousel, timers;
31
32
 
32
33
  /**
@@ -41,14 +42,14 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
41
42
  resize: null
42
43
  };
43
44
 
44
- $(window).on('resize', function() {
45
+ $(window).on('resize', function () {
45
46
  if (timers.resize !== null) {
46
47
  clearTimeout(timers.resize);
47
48
  timers.resize = null;
48
49
  }
49
50
  if (Carousel._cache.length > 0) {
50
51
  // TODO: make this delay adjustable
51
- timers.resize = setTimeout(function() {
52
+ timers.resize = setTimeout(function () {
52
53
  Carousel._cache.trigger(Carousel.prototype.resizeEvent());
53
54
  }, 100);
54
55
  }
@@ -66,9 +67,9 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
66
67
  function parseCtrlStr(ctrlStr) {
67
68
  ctrlStr = ctrlStr.toLowerCase();
68
69
 
69
- var ptrnMatch = ctrlStr.match(/^control:(left|right|goto)\s(\d+)(?:st|nd|rd|th)?\s(.*)$/);
70
-
71
- if(ptrnMatch === null) {
70
+ var ptrnMatch = ctrlStr.match(/^control:(left|right|goto)\s(\d+)(?:st|nd|rd|th)?\s([\w\W]*?)$/);
71
+
72
+ if (ptrnMatch === null) {
72
73
  ptrnMatch = ctrlStr.match(/^control:(left|right)()\s(continuous)$/);
73
74
  }
74
75
 
@@ -88,7 +89,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
88
89
  * [[Xooie.Widget@xooie-refresh]] and [[Xooie.Carousel@xooie-carousel-resize]].
89
90
  * Carousel instances are tracked in the [[Xooie.Carousel._cache]] collection.
90
91
  **/
91
- Carousel = Base.extend(function() {
92
+ Carousel = Base.extend(function () {
92
93
  var self = this;
93
94
 
94
95
  /** internal
@@ -121,7 +122,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
121
122
  **/
122
123
  this._positioners = {
123
124
 
124
- item: function(direction, quantity) {
125
+ item: function (direction, quantity) {
125
126
  var items, pos, i;
126
127
 
127
128
  items = this.items();
@@ -133,11 +134,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
133
134
  }
134
135
 
135
136
  if (direction === 'goto' && quantity > 1 && quantity <= items.length) {
136
- pos = Math.round(items.eq(quantity - 1).position().left);
137
-
138
- if (pos === 0) {
139
- return;
140
- }
137
+ pos = Math.round(items.eq(quantity - 1).position().left) - this.contents().position().left;
141
138
  } else {
142
139
  i = this.currentItem(direction === 'right');
143
140
 
@@ -151,11 +148,11 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
151
148
  this.scrollTo(pos);
152
149
  },
153
150
 
154
- items: function() {
151
+ items: function () {
155
152
  return this._positioners.item.apply(this, arguments);
156
153
  },
157
154
 
158
- pixel: function(direction, quantity) {
155
+ pixel: function (direction, quantity) {
159
156
  var pos;
160
157
 
161
158
  quantity = helpers.toInt(quantity);
@@ -175,11 +172,11 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
175
172
  this.scrollTo(pos);
176
173
  },
177
174
 
178
- pixels: function() {
175
+ pixels: function () {
179
176
  return this._positioners.pixel.apply(this, arguments);
180
177
  },
181
178
 
182
- px: function() {
179
+ px: function () {
183
180
  return this._positioners.pixel.apply(this, arguments);
184
181
  }
185
182
  };
@@ -192,7 +189,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
192
189
  function continuousScroll(ctrl, direction) {
193
190
  clearInterval(self._timers.continuous);
194
191
 
195
- self._timers.continuous = setInterval(function(dir) {
192
+ self._timers.continuous = setInterval(function (dir) {
196
193
  if (ctrl.is(':disabled')) {
197
194
  self._timers.continuous = clearInterval(self._timers.continuous);
198
195
  }
@@ -211,22 +208,22 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
211
208
  this._controlEvents = new EventHandler(this.namespace());
212
209
 
213
210
  this._controlEvents.add({
214
- keydown: function(event) {
215
- var ctrl, args;
211
+ keydown: function (event) {
212
+ var ctrl, args;
216
213
 
217
- if ([13,32].indexOf(event.which) !== -1) {
218
- ctrl = $(this);
219
- args = parseCtrlStr(ctrl.attr('data-x-role'));
214
+ if ([13, 32].indexOf(event.which) !== -1) {
215
+ ctrl = $(this);
216
+ args = parseCtrlStr(ctrl.attr('data-x-role'));
220
217
 
221
- if (args[2] === 'continuous' && !ctrl.is(':disabled')) {
222
- continuousScroll(ctrl, args[0]);
218
+ if (args[2] === 'continuous' && !ctrl.is(':disabled')) {
219
+ continuousScroll(ctrl, args[0]);
223
220
 
224
- event.preventDefault();
225
- }
221
+ event.preventDefault();
226
222
  }
223
+ }
227
224
  },
228
225
 
229
- mousedown: function(event) {
226
+ mousedown: function (event) {
230
227
  var ctrl, args;
231
228
 
232
229
  ctrl = $(this);
@@ -239,14 +236,14 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
239
236
  }
240
237
  },
241
238
 
242
- keyup: function(event) {
239
+ keyup: function (event) {
243
240
  self._timers.continuous = clearInterval(self._timers.continuous);
244
241
 
245
242
  if ($(this).is(':disabled')) {
246
243
  return;
247
244
  }
248
245
 
249
- if ([13,32].indexOf(event.which) !== -1) {
246
+ if ([13, 32].indexOf(event.which) !== -1) {
250
247
  var args = parseCtrlStr($(this).attr('data-x-role'));
251
248
 
252
249
  if (helpers.isFunction(self._positioners[args[2]])) {
@@ -257,7 +254,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
257
254
  }
258
255
  },
259
256
 
260
- mouseup: function(event) {
257
+ mouseup: function (event) {
261
258
  self._timers.continuous = clearInterval(self._timers.continuous);
262
259
 
263
260
  if ($(this).is(':disabled')) {
@@ -273,11 +270,11 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
273
270
  event.preventDefault();
274
271
  },
275
272
 
276
- mouseleave: function(event) {
273
+ mouseleave: function () {
277
274
  self._timers.continuous = clearInterval(self._timers.continuous);
278
275
  },
279
276
 
280
- blur: function(event) {
277
+ blur: function () {
281
278
  self._timers.continuous = clearInterval(self._timers.continuous);
282
279
  }
283
280
  });
@@ -296,17 +293,17 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
296
293
  **/
297
294
  this._wrapperEvents = new EventHandler(this.namespace());
298
295
 
299
- this._wrapperEvents.add('scroll', function(event){
296
+ this._wrapperEvents.add('scroll', function () {
300
297
  if (self._timers.scroll) {
301
- self._timers.scroll = clearTimeout(self._timers.scroll);
302
- } else {
303
- self.root().removeClass(self.leftClass() + ' ' + self.rightClass());
304
-
305
- self.controls().prop('disabled', false);
306
- }
298
+ self._timers.scroll = clearTimeout(self._timers.scroll);
299
+ } else {
300
+ self.root().removeClass(self.leftClass() + ' ' + self.rightClass());
307
301
 
308
- // TODO: make this delay adjustable
309
- self._timers.scroll = setTimeout(scrollComplete, 250);
302
+ self.controls().prop('disabled', false);
303
+ }
304
+
305
+ // TODO: make this delay adjustable
306
+ self._timers.scroll = setTimeout(scrollComplete, 250);
310
307
  });
311
308
 
312
309
  this.cropStyle(Carousel.createStyleRule('.' + this.instanceClass() + ' .' + this.cropClass() + ', .' + this.instanceClass() + '.' + this.cropClass()));
@@ -318,9 +315,9 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
318
315
  this.get('initEvent'),
319
316
  this.get('refreshEvent'),
320
317
  this.get('resizeEvent')].join(' '),
321
- function(){
322
- self.updateDimensions();
323
- });
318
+ function () {
319
+ self.updateDimensions();
320
+ });
324
321
 
325
322
  });
326
323
 
@@ -517,9 +514,9 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
517
514
  });
518
515
 
519
516
  Carousel.createStyleRule('ul.' + Carousel.prototype.contentClass(), {
520
- 'list-style': 'none',
521
- 'padding': 0,
522
- 'margin': 0
517
+ 'list-style': 'none',
518
+ 'padding': 0,
519
+ 'margin': 0
523
520
  });
524
521
 
525
522
  Carousel.createStyleRule('.' + Carousel.prototype.contentClass() + ' > *', {
@@ -529,8 +526,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
529
526
  'font-size': '1em'
530
527
  });
531
528
 
532
- Carousel.createStyleRule('.' + Carousel.prototype.leftClass() + '.' + Carousel.prototype.rightClass() + ' [data-x-role^="control:left"]' +
533
- ', .' + Carousel.prototype.leftClass() + '.' + Carousel.prototype.rightClass() + ' [data-x-role^="control:right"]', {
529
+ Carousel.createStyleRule('.' + Carousel.prototype.leftClass() + '.' + Carousel.prototype.rightClass() + ' [data-x-role^="control:left"]' + ', .' + Carousel.prototype.leftClass() + '.' + Carousel.prototype.rightClass() + ' [data-x-role^="control:right"]', {
534
530
  display: 'none'
535
531
  });
536
532
 
@@ -541,41 +537,38 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
541
537
  * Returns the index of the first visible item. The value of [[Xooie.Carousel#visibleThreshold]] determines what
542
538
  * percentage of the item must be showing to be considered visible.
543
539
  **/
544
- Carousel.prototype.currentItem = function(biasRight) {
545
- var content, items,
546
- position, itemWidth,
547
- i;
540
+ Carousel.prototype.currentItem = function (biasRight) {
541
+ var content, items, position, itemWidth, i;
548
542
 
549
- content = this.contents();
550
- items = this.items();
543
+ content = this.contents();
544
+ items = this.items();
551
545
 
552
- if (biasRight) {
553
- position = content.outerWidth(true) + content.position().left;
546
+ if (biasRight) {
547
+ position = content.outerWidth(true) + content.position().left;
554
548
 
555
- for (i = items.length - 1; i > 0; i -= 1) {
556
- itemWidth = items.eq(i).outerWidth(true);
557
- position -= itemWidth;
549
+ for (i = items.length - 1; i > 0; i -= 1) {
550
+ itemWidth = items.eq(i).outerWidth(true);
551
+ position -= itemWidth;
558
552
 
559
- if (i > 0 && position <= this.visibleThreshold() * itemWidth) {
560
- return i;
561
- }
553
+ if (i > 0 && position <= this.visibleThreshold() * itemWidth) {
554
+ return i;
562
555
  }
563
- return 0;
564
- } else {
565
- position = content.position().left;
556
+ }
557
+ return 0;
558
+ }
566
559
 
567
- for (i = 0; i < items.length - 1; i++) {
568
- itemWidth = items.eq(i).outerWidth(true);
560
+ position = content.position().left;
569
561
 
570
- if (position + this.visibleThreshold() * itemWidth >= 0){
571
- return i;
572
- } else {
573
- position += itemWidth;
574
- }
575
- }
562
+ for (i = 0; i < items.length - 1; i += 1) {
563
+ itemWidth = items.eq(i).outerWidth(true);
576
564
 
577
- return items.length - 1;
565
+ if (position + this.visibleThreshold() * itemWidth >= 0) {
566
+ return i;
578
567
  }
568
+ position += itemWidth;
569
+ }
570
+
571
+ return items.length - 1;
579
572
  };
580
573
 
581
574
  /**
@@ -583,7 +576,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
583
576
  *
584
577
  * Indicates if the carousel is scrolled completely to the left.
585
578
  **/
586
- Carousel.prototype.isLeft = function() {
579
+ Carousel.prototype.isLeft = function () {
587
580
  return this.wrappers().scrollLeft() === 0;
588
581
  };
589
582
 
@@ -592,7 +585,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
592
585
  *
593
586
  * Indicates if the carousel is scrolled completely to the right.
594
587
  **/
595
- Carousel.prototype.isRight = function() {
588
+ Carousel.prototype.isRight = function () {
596
589
  var lastItem, position;
597
590
 
598
591
  try {
@@ -616,10 +609,10 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
616
609
  * The new height is applied to the [[Xooie.Carousel#cropStyle]] rule rather than the cropping element
617
610
  * itself. This allows developers to use cascade rules to override the height if they so choose.
618
611
  **/
619
- Carousel.prototype.updateDimensions = function() {
612
+ Carousel.prototype.updateDimensions = function () {
620
613
  var height = 0;
621
614
 
622
- this.items().each(function(){
615
+ this.items().each(function () {
623
616
  height = Math.max(height, $(this).outerHeight(true));
624
617
  });
625
618
 
@@ -638,17 +631,19 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
638
631
  * completely to the left then the [[Xooie.Carousel#rightClass]] is applied to the [[Xooie.Widget#root]] and the
639
632
  * right [[Xooie.Carousel#controls]] is disabled.
640
633
  **/
641
- Carousel.prototype.updateLimits = function() {
642
- var isLeft = this.isLeft(),
643
- isRight = this.isRight();
634
+ Carousel.prototype.updateLimits = function () {
635
+ var isLeft, isRight;
644
636
 
645
- this.root().toggleClass(this.leftClass(), isLeft);
646
- this.controls().filter('[data-x-role^="control:left"]')
647
- .prop('disabled', isLeft);
637
+ isLeft = this.isLeft();
638
+ isRight = this.isRight();
648
639
 
649
- this.root().toggleClass(this.rightClass(), isRight);
650
- this.controls().filter('[data-x-role^="control:right"]')
651
- .prop('disabled', isRight);
640
+ this.root().toggleClass(this.leftClass(), isLeft);
641
+ this.controls().filter('[data-x-role^="control:left"]')
642
+ .prop('disabled', isLeft);
643
+
644
+ this.root().toggleClass(this.rightClass(), isRight);
645
+ this.controls().filter('[data-x-role^="control:right"]')
646
+ .prop('disabled', isRight);
652
647
  };
653
648
 
654
649
  /**
@@ -658,26 +653,25 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
658
653
  *
659
654
  * Uses the jQuery animate functionality to scroll the carousel to the designated position.
660
655
  **/
661
- Carousel.prototype.scrollTo = function(pos, cb) {
656
+ Carousel.prototype.scrollTo = function (pos, cb) {
662
657
  var self = this;
663
658
 
664
659
  pos = Math.floor(pos);
665
660
 
666
661
  if (this.isScrolling) {
667
- this.wrappers().stop(true,true);
662
+ this.wrappers().stop(true, true);
668
663
  }
669
664
 
670
665
  this.isScrolling = true;
671
666
 
672
667
  // TODO: make the scroll timer configurable
673
668
  this.wrappers().animate({ scrollLeft: pos }, 200,
674
- function(){
669
+ function () {
675
670
  self.isScrolling = false;
676
671
  if (helpers.isFunction(cb)) {
677
672
  cb();
678
673
  }
679
- }
680
- );
674
+ });
681
675
  };
682
676
 
683
677
  /** internal
@@ -688,7 +682,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
688
682
  * In addition to applying the [[Xooie.Carousel#contentClass]] the content is also given the
689
683
  * aria role [list](http://www.w3.org/TR/wai-aria/roles#list) if it is neither a `ul` or `ol` element.
690
684
  **/
691
- Carousel.prototype._process_role_content = function(content) {
685
+ Carousel.prototype._process_role_content = function (content) {
692
686
  content.addClass(this.contentClass());
693
687
 
694
688
  if (!content.is('ul,ol')) {
@@ -705,7 +699,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
705
699
  * rendered only if no other [[Xooie.Carousel#wrappers]] is present as a decendant of the root of this
706
700
  * widget.
707
701
  **/
708
- Carousel.prototype._render_role_wrapper = function() {
702
+ Carousel.prototype._render_role_wrapper = function () {
709
703
  var wrapper = $('<div data-x-role="wrapper" />');
710
704
 
711
705
  this.contents().wrap(wrapper);
@@ -721,7 +715,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
721
715
  * The [[Xooie.Carousel#wrapperClass]] is added and the [[Xooie.Carousel#_wrapperEvents]] handlers are
722
716
  * bound. Also, the [[Xooie.Carousel#cropClass]] is added to this element's parent.
723
717
  **/
724
- Carousel.prototype._process_role_wrapper = function(wrapper) {
718
+ Carousel.prototype._process_role_wrapper = function (wrapper) {
725
719
  wrapper.addClass(this.wrapperClass())
726
720
  .on(this._wrapperEvents.handlers)
727
721
  .parent().addClass(this.cropClass());
@@ -734,7 +728,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
734
728
  *
735
729
  * Gets all children of [[Xooie.Carousel#contents]].
736
730
  **/
737
- Carousel.prototype._get_role_item = function() {
731
+ Carousel.prototype._get_role_item = function () {
738
732
  return this.contents().children();
739
733
  };
740
734
 
@@ -743,7 +737,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
743
737
  *
744
738
  * TODO: Test and document
745
739
  **/
746
- Carousel.prototype._get_role_control = function(){
740
+ Carousel.prototype._get_role_control = function () {
747
741
  return this.root().find('[data-x-role^="control"]');
748
742
  };
749
743
 
@@ -751,7 +745,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
751
745
  * Xooie.Carousel#_process_role_control() -> Element
752
746
  *
753
747
  **/
754
- Carousel.prototype._process_role_control = function(controls) {
748
+ Carousel.prototype._process_role_control = function (controls) {
755
749
  controls.on(this._controlEvents.handlers);
756
750
 
757
751
  controls.attr('aria-hidden', true)
@@ -765,7 +759,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
765
759
  *
766
760
  * Adds the [[Xooie.Widget#namespace]] to the `resizeEvent` string.
767
761
  **/
768
- Carousel.prototype._process_resizeEvent = function(resizeEvent) {
762
+ Carousel.prototype._process_resizeEvent = function (resizeEvent) {
769
763
  return this.namespace() === '' ? resizeEvent : resizeEvent + '.' + this.namespace();
770
764
  };
771
765
 
@@ -14,119 +14,118 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- define('xooie/dialog', ['jquery', 'xooie/base'], function($, Base) {
17
+ define('xooie/dialog', ['xooie/base', 'xooie/helpers'], function (Base, helpers) {
18
+ 'use strict';
18
19
 
19
- var Dialog = Base('dialog', function(){
20
- var self = this;
20
+ var Dialog = new Base('dialog', function () {
21
+ var self = this;
21
22
 
22
- this.id = Dialog._counter++;
23
+ this.id = Dialog._counter = Dialog._counter + 1;
23
24
 
24
- Dialog._instances[this.id] = this;
25
+ Dialog._instances[this.id] = this;
25
26
 
26
- this.root.attr('data-dialog-id', this.id);
27
+ this.root.attr('data-dialog-id', this.id);
27
28
 
28
- //add accessibility attributes
29
- this.root.find(this.options.containerSelector).attr('role', 'dialog');
29
+ //add accessibility attributes
30
+ this.root.find(this.options.containerSelector).attr('role', 'dialog');
30
31
 
31
- this.root.addClass('xooie-dialog');
32
+ this.root.addClass('xooie-dialog');
32
33
 
33
- this.handlers = {
34
- mouseup: function(event){
35
- Dialog.close(self.id);
36
- },
34
+ this.handlers = {
35
+ mouseup: function () {
36
+ Dialog.close(self.id);
37
+ },
37
38
 
38
- keyup: function(event){
39
- if([13,32].indexOf(event.which) !== -1){
40
- Dialog.close(self.id);
41
- }
42
- }
43
- };
44
- });
45
-
46
- Dialog.setDefaultOptions({
47
- closeButtonSelector: '[data-role="closeButton"]',
48
- containerSelector: '[data-role="container"]',
49
-
50
- dialogActiveClass: 'is-dialog-active'
51
- });
52
-
53
- Dialog.setCSSRules({
54
- '.xooie-dialog': {
55
- position: 'fixed',
56
- top: 0,
57
- bottom: 0,
58
- left: 0,
59
- right: 0
39
+ keyup: function (event) {
40
+ if ([13, 32].indexOf(event.which) !== -1) {
41
+ Dialog.close(self.id);
60
42
  }
61
- });
43
+ }
44
+ };
45
+ });
62
46
 
63
- Dialog.prototype.activate = function(){
64
- this.root.addClass(this.options.dialogActiveClass);
47
+ Dialog.setDefaultOptions({
48
+ closeButtonSelector: '[data-role="closeButton"]',
49
+ containerSelector: '[data-role="container"]',
65
50
 
66
- if(Dialog._active === this) {
67
- return;
68
- }
51
+ dialogActiveClass: 'is-dialog-active'
52
+ });
69
53
 
70
- if(Dialog._active){
71
- Dialog._active.deactivate();
72
- }
54
+ Dialog.setCSSRules({
55
+ '.xooie-dialog': {
56
+ position: 'fixed',
57
+ top: 0,
58
+ bottom: 0,
59
+ left: 0,
60
+ right: 0
61
+ }
62
+ });
73
63
 
74
- this.root.find(this.options.closeButtonSelector)
75
- .on(this.handlers);
64
+ Dialog.prototype.activate = function () {
65
+ this.root.addClass(this.options.dialogActiveClass);
76
66
 
77
- Dialog._active = this;
67
+ if (Dialog._active === this) {
68
+ return;
69
+ }
78
70
 
79
- this.root.trigger('dialogActive');
80
- };
71
+ if (Dialog._active) {
72
+ Dialog._active.deactivate();
73
+ }
81
74
 
82
- Dialog.prototype.deactivate = function(){
83
- this.root.removeClass(this.options.dialogActiveClass);
75
+ this.root.find(this.options.closeButtonSelector)
76
+ .on(this.handlers);
84
77
 
85
- if (Dialog._active !== this) {
86
- return;
87
- }
78
+ Dialog._active = this;
88
79
 
89
- this.root.find(this.options.closeButtonSelector)
90
- .off(this.handlers);
80
+ this.root.trigger('dialogActive');
81
+ };
91
82
 
92
- Dialog._active = null;
83
+ Dialog.prototype.deactivate = function () {
84
+ this.root.removeClass(this.options.dialogActiveClass);
93
85
 
94
- this.root.trigger('dialogInactive');
95
- };
86
+ if (Dialog._active !== this) {
87
+ return;
88
+ }
89
+
90
+ this.root.find(this.options.closeButtonSelector)
91
+ .off(this.handlers);
96
92
 
97
- Dialog._instances = [];
98
- Dialog._counter = 0;
99
93
  Dialog._active = null;
100
- Dialog._queue = [];
101
94
 
102
- Dialog.open = function(id){
103
- //get dialog instance
104
- var dialog = this._instances[id];
95
+ this.root.trigger('dialogInactive');
96
+ };
105
97
 
106
- if (typeof dialog === 'undefined' || this._active === dialog){
107
- return;
108
- }
98
+ Dialog._instances = [];
99
+ Dialog._counter = 0;
100
+ Dialog._active = null;
101
+ Dialog._queue = [];
109
102
 
110
- if (this._active) {
111
- this._queue.push(dialog);
112
- } else {
113
- dialog.activate();
114
- }
103
+ Dialog.open = function (id) {
104
+ //get dialog instance
105
+ var dialog = this._instances[id];
115
106
 
116
- };
107
+ if (helpers.isUndefined(dialog) || this._active === dialog) {
108
+ return;
109
+ }
117
110
 
118
- Dialog.close = function(){
119
- //get dialog instance
120
- if(!this._active) {
121
- return;
122
- }
111
+ if (this._active) {
112
+ this._queue.push(dialog);
113
+ }
114
+ dialog.activate();
115
+ };
123
116
 
124
- this._active.deactivate();
117
+ Dialog.close = function () {
118
+ //get dialog instance
119
+ if (!this._active) {
120
+ return;
121
+ }
125
122
 
126
- if (this._queue.length > 0) {
127
- this._queue.pop().activate();
128
- }
129
- };
123
+ this._active.deactivate();
124
+
125
+ if (this._queue.length > 0) {
126
+ this._queue.pop().activate();
127
+ }
128
+ };
130
129
 
131
- return Dialog;
130
+ return Dialog;
132
131
  });