foundation-rails 5.0.3.1 → 5.1.0.1

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +6 -2
  4. data/bower.json +7 -0
  5. data/lib/foundation/rails/version.rb +1 -1
  6. data/update-gem.sh +13 -0
  7. data/vendor/assets/javascripts/foundation.js +2 -1
  8. data/vendor/assets/javascripts/foundation/foundation.abide.js +67 -33
  9. data/vendor/assets/javascripts/foundation/foundation.accordion.js +19 -11
  10. data/vendor/assets/javascripts/foundation/foundation.alert.js +8 -5
  11. data/vendor/assets/javascripts/foundation/foundation.clearing.js +74 -52
  12. data/vendor/assets/javascripts/foundation/foundation.dropdown.js +52 -46
  13. data/vendor/assets/javascripts/foundation/foundation.equalizer.js +63 -0
  14. data/vendor/assets/javascripts/foundation/foundation.interchange.js +47 -26
  15. data/vendor/assets/javascripts/foundation/foundation.joyride.js +42 -36
  16. data/vendor/assets/javascripts/foundation/foundation.js +286 -118
  17. data/vendor/assets/javascripts/foundation/foundation.magellan.js +139 -98
  18. data/vendor/assets/javascripts/foundation/foundation.offcanvas.js +8 -6
  19. data/vendor/assets/javascripts/foundation/foundation.orbit.js +29 -21
  20. data/vendor/assets/javascripts/foundation/foundation.reveal.js +58 -50
  21. data/vendor/assets/javascripts/foundation/foundation.tab.js +22 -10
  22. data/vendor/assets/javascripts/foundation/foundation.tooltip.js +38 -26
  23. data/vendor/assets/javascripts/foundation/foundation.topbar.js +79 -73
  24. data/vendor/assets/stylesheets/foundation/_functions.scss +37 -18
  25. data/vendor/assets/stylesheets/foundation/_settings.scss +115 -110
  26. data/vendor/assets/stylesheets/foundation/components/_block-grid.scss +14 -9
  27. data/vendor/assets/stylesheets/foundation/components/_breadcrumbs.scss +2 -2
  28. data/vendor/assets/stylesheets/foundation/components/_button-groups.scss +1 -1
  29. data/vendor/assets/stylesheets/foundation/components/_clearing.scss +13 -1
  30. data/vendor/assets/stylesheets/foundation/components/_dropdown-buttons.scss +1 -1
  31. data/vendor/assets/stylesheets/foundation/components/_flex-video.scss +1 -1
  32. data/vendor/assets/stylesheets/foundation/components/_forms.scss +23 -29
  33. data/vendor/assets/stylesheets/foundation/components/_global.scss +23 -54
  34. data/vendor/assets/stylesheets/foundation/components/_grid.scss +38 -31
  35. data/vendor/assets/stylesheets/foundation/components/_inline-lists.scss +2 -2
  36. data/vendor/assets/stylesheets/foundation/components/_joyride.scss +2 -2
  37. data/vendor/assets/stylesheets/foundation/components/_magellan.scss +2 -2
  38. data/vendor/assets/stylesheets/foundation/components/_offcanvas.scss +96 -96
  39. data/vendor/assets/stylesheets/foundation/components/_orbit.scss +3 -0
  40. data/vendor/assets/stylesheets/foundation/components/_progress-bars.scss +2 -2
  41. data/vendor/assets/stylesheets/foundation/components/_reveal.scss +8 -3
  42. data/vendor/assets/stylesheets/foundation/components/_side-nav.scss +10 -5
  43. data/vendor/assets/stylesheets/foundation/components/_sub-nav.scss +6 -3
  44. data/vendor/assets/stylesheets/foundation/components/_tabs.scss +2 -0
  45. data/vendor/assets/stylesheets/foundation/components/_tooltips.scss +11 -1
  46. data/vendor/assets/stylesheets/foundation/components/_top-bar.scss +20 -7
  47. data/vendor/assets/stylesheets/foundation/components/_type.scss +82 -4
  48. data/vendor/assets/stylesheets/foundation/components/_visibility.scss +2 -2
  49. metadata +5 -2
@@ -1,130 +1,171 @@
1
1
  ;(function ($, window, document, undefined) {
2
2
  'use strict';
3
3
 
4
- Foundation.libs.magellan = {
5
- name : 'magellan',
4
+ Foundation.libs['magellan-expedition'] = {
5
+ name : 'magellan-expedition',
6
6
 
7
- version : '5.0.3',
7
+ version : '5.1.0',
8
8
 
9
9
  settings : {
10
10
  active_class: 'active',
11
- threshold: 0
11
+ threshold: 0, // pixels from the top of the expedition for it to become fixes
12
+ destination_threshold: 20, // pixels from the top of destination for it to be considered active
13
+ throttle_delay: 30 // calculation throttling to increase framerate
12
14
  },
13
15
 
14
16
  init : function (scope, method, options) {
15
- this.fixed_magellan = $("[data-magellan-expedition]");
16
- this.magellan_placeholder = $('<div></div>').css({
17
- height: this.fixed_magellan.outerHeight(true)
18
- }).hide().insertAfter(this.fixed_magellan);
19
- this.set_threshold();
20
- this.set_active_class(method);
21
- this.last_destination = $('[data-magellan-destination]').last();
22
- this.events();
17
+ Foundation.inherit(this, 'throttle');
18
+ this.bindings(method, options);
23
19
  },
24
20
 
25
21
  events : function () {
26
- var self = this;
27
-
28
- $(this.scope)
22
+ var self = this,
23
+ S = self.S,
24
+ settings = self.settings;
25
+
26
+ // initialize expedition offset
27
+ self.set_expedition_position();
28
+
29
+
30
+ S(self.scope)
29
31
  .off('.magellan')
30
- .on('arrival.fndtn.magellan', '[data-magellan-arrival]', function (e) {
31
- var $destination = $(this),
32
- $expedition = $destination.closest('[data-magellan-expedition]'),
33
- active_class = $expedition.attr('data-magellan-active-class')
34
- || self.settings.active_class;
35
-
36
- $destination
37
- .closest('[data-magellan-expedition]')
38
- .find('[data-magellan-arrival]')
39
- .not($destination)
40
- .removeClass(active_class);
41
- $destination.addClass(active_class);
42
- });
32
+ .on('click.fndtn.magellan', '[data-magellan-arrival] a[href^="#"]', function (e) {
33
+ e.preventDefault();
34
+ var expedition = $(this).closest('[data-magellan-expedition]'),
35
+ settings = expedition.data('magellan-expedition-init');
36
+
37
+ var hash = this.hash.split('#').join(''),
38
+ target = $('a[name='+hash+']');
39
+ if (target.length === 0) target = $('#'+hash);
40
+
41
+ // Account for expedition height if fixed position
42
+ var scroll_top = target.offset().top;
43
+ if (expedition.css('position') === 'fixed') {
44
+ scroll_top = scroll_top - expedition.outerHeight();
45
+ }
43
46
 
44
- this.fixed_magellan
45
- .off('.magellan')
46
- .on('update-position.fndtn.magellan', function() {
47
- var $el = $(this);
47
+ $('html, body').stop().animate({
48
+ 'scrollTop': scroll_top
49
+ }, 700, 'swing', function () {
50
+ window.location.hash = '#'+hash;
51
+ });
48
52
  })
49
- .trigger('update-position');
53
+ .on('scroll.fndtn.magellan', self.throttle(this.check_for_arrivals.bind(this), settings.throttle_delay))
54
+ .on('resize.fndtn.magellan', self.throttle(this.set_expedition_position.bind(this), settings.throttle_delay));
55
+ },
50
56
 
51
- $(window)
52
- .off('.magellan')
53
- .on('resize.fndtn.magellan', function() {
54
- this.fixed_magellan.trigger('update-position');
55
- }.bind(this))
56
- .on('scroll.fndtn.magellan', function() {
57
- var windowScrollTop = $(window).scrollTop();
58
- self.fixed_magellan.each(function() {
59
- var $expedition = $(this);
60
- if (typeof $expedition.data('magellan-top-offset') === 'undefined') {
61
- $expedition.data('magellan-top-offset', $expedition.offset().top);
62
- }
63
- if (typeof $expedition.data('magellan-fixed-position') === 'undefined') {
64
- $expedition.data('magellan-fixed-position', false);
65
- }
66
- var fixed_position = (windowScrollTop + self.settings.threshold) > $expedition.data("magellan-top-offset");
67
- var attr = $expedition.attr('data-magellan-top-offset');
68
-
69
- if ($expedition.data("magellan-fixed-position") != fixed_position) {
70
- $expedition.data("magellan-fixed-position", fixed_position);
71
- if (fixed_position) {
72
- $expedition.addClass('fixed');
73
- $expedition.css({position:"fixed", top:0});
74
- self.magellan_placeholder.show();
75
- } else {
76
- $expedition.removeClass('fixed');
77
- $expedition.css({position:"", top:""});
78
- self.magellan_placeholder.hide();
79
- }
80
- if (fixed_position && typeof attr != 'undefined' && attr != false) {
81
- $expedition.css({position:"fixed", top:attr + "px"});
82
- }
83
- }
84
- });
85
- });
57
+ check_for_arrivals : function() {
58
+ var self = this;
59
+ self.update_arrivals();
60
+ self.update_expedition_positions();
61
+ },
86
62
 
63
+ set_expedition_position : function() {
64
+ var self = this;
65
+ $('[' + this.attr_name() + '=fixed]', self.scope).each(function(idx, el) {
66
+ var expedition = $(this),
67
+ styles = expedition.attr('styles'), // save styles
68
+ top_offset;
87
69
 
88
- if (this.last_destination.length > 0) {
89
- $(window).on('scroll.fndtn.magellan', function (e) {
90
- var windowScrollTop = $(window).scrollTop(),
91
- scrolltopPlusHeight = windowScrollTop + $(window).height(),
92
- lastDestinationTop = Math.ceil(self.last_destination.offset().top);
70
+ expedition.attr('style', '');
71
+ top_offset = expedition.offset().top;
93
72
 
94
- $('[data-magellan-destination]').each(function () {
95
- var $destination = $(this),
96
- destination_name = $destination.attr('data-magellan-destination'),
97
- topOffset = $destination.offset().top - $destination.outerHeight(true) - windowScrollTop;
98
- if (topOffset <= self.settings.threshold) {
99
- $("[data-magellan-arrival='" + destination_name + "']").trigger('arrival');
100
- }
101
- // In large screens we may hit the bottom of the page and dont reach the top of the last magellan-destination, so lets force it
102
- if (scrolltopPlusHeight >= $(self.scope).height() && lastDestinationTop > windowScrollTop && lastDestinationTop < scrolltopPlusHeight) {
103
- $('[data-magellan-arrival]').last().trigger('arrival');
104
- }
105
- });
73
+ expedition.data(self.data_attr('magellan-top-offset'), top_offset);
74
+ expedition.attr('style', styles);
75
+ });
76
+ },
77
+
78
+ update_expedition_positions : function() {
79
+ var self = this,
80
+ window_top_offset = $(window).scrollTop();
81
+
82
+ $('[' + this.attr_name() + '=fixed]', self.scope).each(function() {
83
+ var expedition = $(this),
84
+ top_offset = expedition.data('magellan-top-offset');
85
+
86
+ if (window_top_offset >= top_offset) {
87
+ // Placeholder allows height calculations to be consistent even when
88
+ // appearing to switch between fixed/non-fixed placement
89
+ var placeholder = expedition.prev('[data-magellan-expedition-clone]');
90
+ if (placeholder.length === 0) {
91
+ placeholder = expedition.clone();
92
+ placeholder.removeAttr('data-magellan-expedition');
93
+ placeholder.attr('data-magellan-expedition-clone','');
94
+ expedition.before(placeholder);
95
+ }
96
+ expedition.css({position:'fixed', top: 0});
97
+ } else {
98
+ expedition.prev('[data-magellan-expedition-clone]').remove();
99
+ expedition.attr('style','');
100
+ }
101
+ });
102
+ },
103
+
104
+ update_arrivals : function() {
105
+ var self = this,
106
+ window_top_offset = $(window).scrollTop();
107
+
108
+ $('[' + this.attr_name() + ']', self.scope).each(function() {
109
+ var expedition = $(this),
110
+ settings = settings = expedition.data(self.attr_name(true) + '-init'),
111
+ offsets = self.offsets(expedition, window_top_offset),
112
+ arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']'),
113
+ active_item = false;
114
+ offsets.each(function(idx, item) {
115
+ if (item.viewport_offset >= item.top_offset) {
116
+ var arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']');
117
+ arrivals.not(item.arrival).removeClass(settings.active_class);
118
+ item.arrival.addClass(settings.active_class);
119
+ active_item = true;
120
+ return true;
121
+ }
106
122
  });
107
- }
123
+
124
+ if (!active_item) arrivals.removeClass(settings.active_class);
125
+ });
108
126
  },
109
127
 
110
- set_threshold : function () {
111
- if (typeof this.settings.threshold !== 'number') {
112
- this.settings.threshold = (this.fixed_magellan.length > 0) ?
113
- this.fixed_magellan.outerHeight(true) : 0;
114
- }
128
+ offsets : function(expedition, window_offset) {
129
+ var self = this,
130
+ settings = expedition.data(self.attr_name(true) + '-init'),
131
+ viewport_offset = (window_offset + settings.destination_threshold);
132
+
133
+ return expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']').map(function(idx, el) {
134
+ var name = $(this).data(self.data_attr('magellan-arrival')),
135
+ dest = $('[' + self.add_namespace('data-magellan-destination') + '=' + name + ']');
136
+ if (dest.length > 0) {
137
+ var top_offset = dest.offset().top;
138
+ return {
139
+ destination : dest,
140
+ arrival : $(this),
141
+ top_offset : top_offset,
142
+ viewport_offset : viewport_offset
143
+ }
144
+ }
145
+ }).sort(function(a, b) {
146
+ if (a.top_offset < b.top_offset) return -1;
147
+ if (a.top_offset > b.top_offset) return 1;
148
+ return 0;
149
+ });
115
150
  },
116
151
 
117
- set_active_class : function (options) {
118
- if (options && options.active_class && typeof options.active_class === 'string') {
119
- this.settings.active_class = options.active_class;
152
+ data_attr: function (str) {
153
+ if (this.namespace.length > 0) {
154
+ return this.namespace + '-' + str;
120
155
  }
156
+
157
+ return str;
121
158
  },
122
159
 
123
160
  off : function () {
124
- $(this.scope).off('.fndtn.magellan');
125
- $(window).off('.fndtn.magellan');
161
+ this.S(this.scope).off('.magellan');
162
+ this.S(window).off('.magellan');
126
163
  },
127
164
 
128
- reflow : function () {}
165
+ reflow : function () {
166
+ var self = this;
167
+ // remove placeholder expeditions used for height calculation purposes
168
+ $('[data-magellan-expedition-clone]', self.scope).remove();
169
+ }
129
170
  };
130
- }(jQuery, this, this.document));
171
+ }(jQuery, this, this.document));
@@ -4,7 +4,7 @@
4
4
  Foundation.libs.offcanvas = {
5
5
  name : 'offcanvas',
6
6
 
7
- version : '5.0.3',
7
+ version : '5.1.0',
8
8
 
9
9
  settings : {},
10
10
 
@@ -13,22 +13,24 @@
13
13
  },
14
14
 
15
15
  events : function () {
16
- $(this.scope).off('.offcanvas')
16
+ var S = this.S;
17
+
18
+ S(this.scope).off('.offcanvas')
17
19
  .on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) {
18
20
  e.preventDefault();
19
- $(this).closest('.off-canvas-wrap').toggleClass('move-right');
21
+ S(this).closest('.off-canvas-wrap').toggleClass('move-right');
20
22
  })
21
23
  .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
22
24
  e.preventDefault();
23
- $(".off-canvas-wrap").removeClass("move-right");
25
+ S(".off-canvas-wrap").removeClass("move-right");
24
26
  })
25
27
  .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) {
26
28
  e.preventDefault();
27
- $(this).closest(".off-canvas-wrap").toggleClass("move-left");
29
+ S(this).closest(".off-canvas-wrap").toggleClass("move-left");
28
30
  })
29
31
  .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
30
32
  e.preventDefault();
31
- $(".off-canvas-wrap").removeClass("move-left");
33
+ S(".off-canvas-wrap").removeClass("move-left");
32
34
  });
33
35
  },
34
36
 
@@ -21,12 +21,17 @@
21
21
  locked = false,
22
22
  adjust_height_after = false;
23
23
 
24
- slides_container.children().first().addClass(settings.active_slide_class);
24
+
25
+ self.slides = function() {
26
+ return slides_container.children(settings.slide_selector);
27
+ };
28
+
29
+ self.slides().first().addClass(settings.active_slide_class);
25
30
 
26
31
  self.update_slide_number = function(index) {
27
32
  if (settings.slide_number) {
28
33
  number_container.find('span:first').text(parseInt(index)+1);
29
- number_container.find('span:last').text(slides_container.children().length);
34
+ number_container.find('span:last').text(self.slides().length);
30
35
  }
31
36
  if (settings.bullets) {
32
37
  bullets_container.children().removeClass(settings.bullets_active_class);
@@ -35,7 +40,7 @@
35
40
  };
36
41
 
37
42
  self.update_active_link = function(index) {
38
- var link = $('a[data-orbit-link="'+slides_container.children().eq(index).attr('data-orbit-slide')+'"]');
43
+ var link = $('a[data-orbit-link="'+self.slides().eq(index).attr('data-orbit-slide')+'"]');
39
44
  link.siblings().removeClass(settings.bullets_active_class);
40
45
  link.addClass(settings.bullets_active_class);
41
46
  };
@@ -68,7 +73,7 @@
68
73
  bullets_container = $('<ol>').addClass(settings.bullets_container_class);
69
74
  container.append(bullets_container);
70
75
  bullets_container.wrap('<div class="orbit-bullets-container"></div>');
71
- slides_container.children().each(function(idx, el) {
76
+ self.slides().each(function(idx, el) {
72
77
  var bullet = $('<li>').attr('data-orbit-slide', idx);
73
78
  bullets_container.append(bullet);
74
79
  });
@@ -77,16 +82,13 @@
77
82
  if (settings.stack_on_small) {
78
83
  container.addClass(settings.stack_on_small_class);
79
84
  }
80
-
81
- self.update_slide_number(0);
82
- self.update_active_link(0);
83
85
  };
84
86
 
85
87
  self._goto = function(next_idx, start_timer) {
86
88
  // if (locked) {return false;}
87
89
  if (next_idx === idx) {return false;}
88
90
  if (typeof timer === 'object') {timer.restart();}
89
- var slides = slides_container.children();
91
+ var slides = self.slides();
90
92
 
91
93
  var dir = 'next';
92
94
  locked = true;
@@ -182,10 +184,10 @@
182
184
  }
183
185
 
184
186
  self.compute_dimensions = function() {
185
- var current = $(slides_container.children().get(idx));
187
+ var current = $(self.slides().get(idx));
186
188
  var h = current.height();
187
189
  if (!settings.variable_height) {
188
- slides_container.children().each(function(){
190
+ self.slides().each(function(){
189
191
  if ($(this).height() > h) { h = $(this).height(); }
190
192
  });
191
193
  }
@@ -218,7 +220,10 @@
218
220
 
219
221
  self.init = function() {
220
222
  self.build_markup();
221
- if (settings.timer) {timer = self.create_timer(); timer.start();}
223
+ if (settings.timer) {
224
+ timer = self.create_timer();
225
+ Foundation.utils.image_loaded(this.slides().children('img'), timer.start);
226
+ }
222
227
  animate = new FadeAnimation(settings, slides_container);
223
228
  if (settings.animation === 'slide')
224
229
  animate = new SlideAnimation(settings, slides_container);
@@ -278,11 +283,13 @@
278
283
 
279
284
  $(document).on('click', '[data-orbit-link]', self.link_custom);
280
285
  $(window).on('resize', self.compute_dimensions);
281
- $(window).on('load', self.compute_dimensions);
282
- $(window).on('load', function(){
286
+ Foundation.utils.image_loaded(this.slides().children('img'), self.compute_dimensions);
287
+ Foundation.utils.image_loaded(this.slides().children('img'), function() {
283
288
  container.prev('.preloader').css('display', 'none');
289
+ self.update_slide_number(0);
290
+ self.update_active_link(0);
291
+ slides_container.trigger('ready.fndtn.orbit');
284
292
  });
285
- slides_container.trigger('ready.fndtn.orbit');
286
293
  };
287
294
 
288
295
  self.init();
@@ -389,7 +396,7 @@
389
396
  Foundation.libs.orbit = {
390
397
  name: 'orbit',
391
398
 
392
- version: '5.0.3',
399
+ version: '5.1.0',
393
400
 
394
401
  settings: {
395
402
  animation: 'slide',
@@ -409,6 +416,7 @@
409
416
  timer_paused_class: 'paused',
410
417
  timer_progress_class: 'orbit-progress',
411
418
  slides_container_class: 'orbit-slides-container',
419
+ slide_selector: '*',
412
420
  bullets_container_class: 'orbit-bullets',
413
421
  bullets_active_class: 'active',
414
422
  slide_number_class: 'orbit-slide-number',
@@ -430,20 +438,20 @@
430
438
  },
431
439
 
432
440
  events : function (instance) {
433
- var orbit_instance = new Orbit($(instance), $(instance).data('orbit-init'));
434
- $(instance).data(self.name + '-instance', orbit_instance);
441
+ var orbit_instance = new Orbit(this.S(instance), this.S(instance).data('orbit-init'));
442
+ this.S(instance).data(self.name + '-instance', orbit_instance);
435
443
  },
436
444
 
437
445
  reflow : function () {
438
446
  var self = this;
439
447
 
440
- if ($(self.scope).is('[data-orbit]')) {
441
- var $el = $(self.scope);
448
+ if (self.S(self.scope).is('[data-orbit]')) {
449
+ var $el = self.S(self.scope);
442
450
  var instance = $el.data(self.name + '-instance');
443
451
  instance.compute_dimensions();
444
452
  } else {
445
- $('[data-orbit]', self.scope).each(function(idx, el) {
446
- var $el = $(el);
453
+ self.S('[data-orbit]', self.scope).each(function(idx, el) {
454
+ var $el = self.S(el);
447
455
  var opts = self.data_options($el);
448
456
  var instance = $el.data(self.name + '-instance');
449
457
  instance.compute_dimensions();
@@ -4,7 +4,7 @@
4
4
  Foundation.libs.reveal = {
5
5
  name : 'reveal',
6
6
 
7
- version : '5.0.3',
7
+ version : '5.1.0',
8
8
 
9
9
  locked : false,
10
10
 
@@ -35,22 +35,22 @@
35
35
  },
36
36
 
37
37
  init : function (scope, method, options) {
38
- Foundation.inherit(this, 'delay');
39
38
  $.extend(true, this.settings, method, options);
40
39
  this.bindings(method, options);
41
40
  },
42
41
 
43
42
  events : function (scope) {
44
- var self = this;
43
+ var self = this,
44
+ S = self.S;
45
45
 
46
- $('[data-reveal-id]', this.scope)
46
+ S(this.scope)
47
47
  .off('.reveal')
48
- .on('click.fndtn.reveal', function (e) {
48
+ .on('click.fndtn.reveal', '[' + this.add_namespace('data-reveal-id') + ']', function (e) {
49
49
  e.preventDefault();
50
50
 
51
51
  if (!self.locked) {
52
- var element = $(this),
53
- ajax = element.data('reveal-ajax');
52
+ var element = S(this),
53
+ ajax = element.data(self.data_attr('reveal-ajax'));
54
54
 
55
55
  self.locked = true;
56
56
 
@@ -64,29 +64,26 @@
64
64
  }
65
65
  });
66
66
 
67
- $(this.scope)
68
- .off('.reveal');
69
-
70
- $(document)
67
+ S(document)
71
68
  .on('click.fndtn.reveal', this.close_targets(), function (e) {
72
69
 
73
70
  e.preventDefault();
74
71
 
75
72
  if (!self.locked) {
76
- var settings = $('[data-reveal].open').data('reveal-init'),
77
- bg_clicked = $(e.target)[0] === $('.' + settings.bg_class)[0];
73
+ var settings = S('[' + self.attr_name() + '].open').data(self.attr_name(true) + '-init'),
74
+ bg_clicked = S(e.target)[0] === S('.' + settings.bg_class)[0];
78
75
 
79
76
  if (bg_clicked && !settings.close_on_background_click) {
80
77
  return;
81
78
  }
82
79
 
83
80
  self.locked = true;
84
- self.close.call(self, bg_clicked ? $('[data-reveal].open') : $(this).closest('[data-reveal]'));
81
+ self.close.call(self, bg_clicked ? S('[' + self.attr_name() + '].open') : S(this).closest('[' + self.attr_name() + ']'));
85
82
  }
86
83
  });
87
84
 
88
- if($('[data-reveal]', this.scope).length > 0) {
89
- $(this.scope)
85
+ if(S('[' + self.attr_name() + ']', this.scope).length > 0) {
86
+ S(this.scope)
90
87
  // .off('.reveal')
91
88
  .on('open.fndtn.reveal', this.settings.open)
92
89
  .on('opened.fndtn.reveal', this.settings.opened)
@@ -95,14 +92,14 @@
95
92
  .on('closed.fndtn.reveal', this.settings.closed)
96
93
  .on('closed.fndtn.reveal', this.close_video);
97
94
  } else {
98
- $(this.scope)
95
+ S(this.scope)
99
96
  // .off('.reveal')
100
- .on('open.fndtn.reveal', '[data-reveal]', this.settings.open)
101
- .on('opened.fndtn.reveal', '[data-reveal]', this.settings.opened)
102
- .on('opened.fndtn.reveal', '[data-reveal]', this.open_video)
103
- .on('close.fndtn.reveal', '[data-reveal]', this.settings.close)
104
- .on('closed.fndtn.reveal', '[data-reveal]', this.settings.closed)
105
- .on('closed.fndtn.reveal', '[data-reveal]', this.close_video);
97
+ .on('open.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.open)
98
+ .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.opened)
99
+ .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.open_video)
100
+ .on('close.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.close)
101
+ .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.closed)
102
+ .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.close_video);
106
103
  }
107
104
 
108
105
  return true;
@@ -113,9 +110,9 @@
113
110
  var self = this;
114
111
 
115
112
  // PATCH #1: fixing multiple keyup event trigger from single key press
116
- $('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function ( event ) {
117
- var open_modal = $('[data-reveal].open'),
118
- settings = open_modal.data('reveal-init');
113
+ self.S('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function ( event ) {
114
+ var open_modal = self.S('[' + self.attr_name() + '].open'),
115
+ settings = open_modal.data(self.attr_name(true) + '-init');
119
116
  // PATCH #2: making sure that the close event can be called only while unlocked,
120
117
  // so that multiple keyup.fndtn.reveal events don't prevent clean closing of the reveal window.
121
118
  if ( settings && event.which === 27 && settings.close_on_esc && !self.locked) { // 27 is the keycode for the Escape key
@@ -128,7 +125,7 @@
128
125
 
129
126
  // PATCH #3: turning on key up capture only when a reveal window is open
130
127
  key_up_off : function (scope) {
131
- $('body').off('keyup.fndtn.reveal');
128
+ this.S('body').off('keyup.fndtn.reveal');
132
129
  return true;
133
130
  },
134
131
 
@@ -136,20 +133,20 @@
136
133
  var self = this;
137
134
  if (target) {
138
135
  if (typeof target.selector !== 'undefined') {
139
- var modal = $('#' + target.data('reveal-id'));
136
+ var modal = self.S('#' + target.data(self.data_attr('reveal-id')));
140
137
  } else {
141
- var modal = $(this.scope);
138
+ var modal = self.S(this.scope);
142
139
 
143
140
  ajax_settings = target;
144
141
  }
145
142
  } else {
146
- var modal = $(this.scope);
143
+ var modal = self.S(this.scope);
147
144
  }
148
145
 
149
- var settings = modal.data('reveal-init');
146
+ var settings = modal.data(self.attr_name(true) + '-init');
150
147
 
151
148
  if (!modal.hasClass('open')) {
152
- var open_modal = $('[data-reveal].open');
149
+ var open_modal = self.S('[' + self.attr_name() + '].open');
153
150
 
154
151
  if (typeof modal.data('css-top') === 'undefined') {
155
152
  modal.data('css-top', parseInt(modal.css('top'), 10))
@@ -171,7 +168,7 @@
171
168
 
172
169
  if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
173
170
  if (open_modal.length > 0) {
174
- var open_modal_settings = open_modal.data('reveal-init');
171
+ var open_modal_settings = open_modal.data(self.attr_name(true) + '-init');
175
172
  this.hide(open_modal, open_modal_settings.css.close);
176
173
  }
177
174
 
@@ -186,10 +183,10 @@
186
183
  }
187
184
 
188
185
  modal.html(data);
189
- $(modal).foundation('section', 'reflow');
186
+ self.S(modal).foundation('section', 'reflow');
190
187
 
191
188
  if (open_modal.length > 0) {
192
- var open_modal_settings = open_modal.data('reveal-init');
189
+ var open_modal_settings = open_modal.data(self.attr_name(true));
193
190
  self.hide(open_modal, open_modal_settings.css.close);
194
191
  }
195
192
  self.show(modal, settings.css.open);
@@ -202,9 +199,9 @@
202
199
  },
203
200
 
204
201
  close : function (modal) {
205
- var modal = modal && modal.length ? modal : $(this.scope),
206
- open_modals = $('[data-reveal].open'),
207
- settings = modal.data('reveal-init');
202
+ var modal = modal && modal.length ? modal : this.S(this.scope),
203
+ open_modals = this.S('[' + this.attr_name() + '].open'),
204
+ settings = modal.data(this.attr_name(true) + '-init');
208
205
 
209
206
  if (open_modals.length > 0) {
210
207
  this.locked = true;
@@ -226,9 +223,9 @@
226
223
  },
227
224
 
228
225
  toggle_bg : function (modal) {
229
- var settings = modal.data('reveal-init');
226
+ var settings = modal.data(this.attr_name(true));
230
227
 
231
- if ($('.' + this.settings.bg_class).length === 0) {
228
+ if (this.S('.' + this.settings.bg_class).length === 0) {
232
229
  this.settings.bg = $('<div />', {'class': this.settings.bg_class})
233
230
  .appendTo('body');
234
231
  }
@@ -243,10 +240,11 @@
243
240
  show : function (el, css) {
244
241
  // is modal
245
242
  if (css) {
246
- var settings = el.data('reveal-init');
243
+ var settings = el.data(this.attr_name(true) + '-init');
247
244
  if (el.parent('body').length === 0) {
248
245
  var placeholder = el.wrap('<div style="display: none;" />').parent(),
249
- rootElement = this.settings.rootElement || 'body';;
246
+ rootElement = this.settings.rootElement || 'body';
247
+
250
248
  el.on('closed.fndtn.reveal.wrapped', function() {
251
249
  el.detach().appendTo(placeholder);
252
250
  el.unwrap().unbind('closed.fndtn.reveal.wrapped');
@@ -262,7 +260,7 @@
262
260
  opacity: 1
263
261
  };
264
262
 
265
- return this.delay(function () {
263
+ return setTimeout(function () {
266
264
  return el
267
265
  .css(css)
268
266
  .animate(end_css, settings.animation_speed, 'linear', function () {
@@ -276,7 +274,7 @@
276
274
  if (/fade/i.test(settings.animation)) {
277
275
  var end_css = {opacity: 1};
278
276
 
279
- return this.delay(function () {
277
+ return setTimeout(function () {
280
278
  return el
281
279
  .css(css)
282
280
  .animate(end_css, settings.animation_speed, 'linear', function () {
@@ -297,20 +295,22 @@
297
295
  return el.fadeIn(settings.animation_speed / 2);
298
296
  }
299
297
 
298
+ this.locked = false;
299
+
300
300
  return el.show();
301
301
  },
302
302
 
303
303
  hide : function (el, css) {
304
304
  // is modal
305
305
  if (css) {
306
- var settings = el.data('reveal-init');
306
+ var settings = el.data(this.attr_name(true) + '-init');
307
307
  if (/pop/i.test(settings.animation)) {
308
308
  var end_css = {
309
309
  top: - $(window).scrollTop() - el.data('offset') + 'px',
310
310
  opacity: 0
311
311
  };
312
312
 
313
- return this.delay(function () {
313
+ return setTimeout(function () {
314
314
  return el
315
315
  .animate(end_css, settings.animation_speed, 'linear', function () {
316
316
  this.locked = false;
@@ -323,7 +323,7 @@
323
323
  if (/fade/i.test(settings.animation)) {
324
324
  var end_css = {opacity: 0};
325
325
 
326
- return this.delay(function () {
326
+ return setTimeout(function () {
327
327
  return el
328
328
  .animate(end_css, settings.animation_speed, 'linear', function () {
329
329
  this.locked = false;
@@ -347,8 +347,8 @@
347
347
  },
348
348
 
349
349
  close_video : function (e) {
350
- var video = $(this).find('.flex-video'),
351
- iframe = video.find('iframe');
350
+ var video = $('.flex-video', e.target),
351
+ iframe = $('iframe', video);
352
352
 
353
353
  if (iframe.length > 0) {
354
354
  iframe.attr('data-src', iframe[0].src);
@@ -358,7 +358,7 @@
358
358
  },
359
359
 
360
360
  open_video : function (e) {
361
- var video = $(this).find('.flex-video'),
361
+ var video = $('.flex-video', e.target),
362
362
  iframe = video.find('iframe');
363
363
 
364
364
  if (iframe.length > 0) {
@@ -374,6 +374,14 @@
374
374
  }
375
375
  },
376
376
 
377
+ data_attr: function (str) {
378
+ if (this.namespace.length > 0) {
379
+ return this.namespace + '-' + str;
380
+ }
381
+
382
+ return str;
383
+ },
384
+
377
385
  cache_offset : function (modal) {
378
386
  var offset = modal.show().height() + parseInt(modal.css('top'), 10);
379
387