foundation-rails 5.0.2.0 → 5.0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/lib/foundation/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/foundation/foundation.abide.js +27 -6
  4. data/vendor/assets/javascripts/foundation/foundation.accordion.js +1 -1
  5. data/vendor/assets/javascripts/foundation/foundation.alert.js +3 -3
  6. data/vendor/assets/javascripts/foundation/foundation.clearing.js +25 -12
  7. data/vendor/assets/javascripts/foundation/foundation.dropdown.js +25 -7
  8. data/vendor/assets/javascripts/foundation/foundation.interchange.js +6 -5
  9. data/vendor/assets/javascripts/foundation/foundation.joyride.js +19 -16
  10. data/vendor/assets/javascripts/foundation/foundation.js +12 -9
  11. data/vendor/assets/javascripts/foundation/foundation.magellan.js +13 -1
  12. data/vendor/assets/javascripts/foundation/foundation.offcanvas.js +2 -2
  13. data/vendor/assets/javascripts/foundation/foundation.orbit.js +42 -20
  14. data/vendor/assets/javascripts/foundation/foundation.reveal.js +80 -36
  15. data/vendor/assets/javascripts/foundation/foundation.tab.js +14 -5
  16. data/vendor/assets/javascripts/foundation/foundation.tooltip.js +9 -8
  17. data/vendor/assets/javascripts/foundation/foundation.topbar.js +5 -4
  18. data/vendor/assets/javascripts/vendor/modernizr.js +1405 -3
  19. data/vendor/assets/stylesheets/foundation.scss +2 -0
  20. data/vendor/assets/stylesheets/foundation/_functions.scss +3 -0
  21. data/vendor/assets/stylesheets/foundation/_settings.scss +244 -50
  22. data/vendor/assets/stylesheets/foundation/components/_accordion.scss +15 -15
  23. data/vendor/assets/stylesheets/foundation/components/_alert-boxes.scss +4 -4
  24. data/vendor/assets/stylesheets/foundation/components/_block-grid.scss +3 -2
  25. data/vendor/assets/stylesheets/foundation/components/_breadcrumbs.scss +3 -3
  26. data/vendor/assets/stylesheets/foundation/components/_button-groups.scss +10 -4
  27. data/vendor/assets/stylesheets/foundation/components/_buttons.scss +8 -6
  28. data/vendor/assets/stylesheets/foundation/components/_clearing.scss +1 -1
  29. data/vendor/assets/stylesheets/foundation/components/_dropdown-buttons.scss +0 -0
  30. data/vendor/assets/stylesheets/foundation/components/_dropdown.scss +5 -5
  31. data/vendor/assets/stylesheets/foundation/components/_flex-video.scss +0 -0
  32. data/vendor/assets/stylesheets/foundation/components/_forms.scss +43 -19
  33. data/vendor/assets/stylesheets/foundation/components/_global.scss +29 -18
  34. data/vendor/assets/stylesheets/foundation/components/_grid.scss +41 -25
  35. data/vendor/assets/stylesheets/foundation/components/_inline-lists.scss +0 -0
  36. data/vendor/assets/stylesheets/foundation/components/_joyride.scss +1 -1
  37. data/vendor/assets/stylesheets/foundation/components/_keystrokes.scss +5 -5
  38. data/vendor/assets/stylesheets/foundation/components/_labels.scss +0 -0
  39. data/vendor/assets/stylesheets/foundation/components/_magellan.scss +0 -0
  40. data/vendor/assets/stylesheets/foundation/components/_offcanvas.scss +110 -98
  41. data/vendor/assets/stylesheets/foundation/components/_orbit.scss +12 -10
  42. data/vendor/assets/stylesheets/foundation/components/_pagination.scss +1 -1
  43. data/vendor/assets/stylesheets/foundation/components/_panels.scss +6 -6
  44. data/vendor/assets/stylesheets/foundation/components/_pricing-tables.scss +0 -0
  45. data/vendor/assets/stylesheets/foundation/components/_progress-bars.scss +1 -1
  46. data/vendor/assets/stylesheets/foundation/components/_reveal.scss +2 -2
  47. data/vendor/assets/stylesheets/foundation/components/_side-nav.scss +4 -4
  48. data/vendor/assets/stylesheets/foundation/components/_split-buttons.scss +0 -0
  49. data/vendor/assets/stylesheets/foundation/components/_sub-nav.scss +9 -9
  50. data/vendor/assets/stylesheets/foundation/components/_switch.scss +30 -28
  51. data/vendor/assets/stylesheets/foundation/components/_tables.scss +2 -2
  52. data/vendor/assets/stylesheets/foundation/components/_tabs.scss +75 -73
  53. data/vendor/assets/stylesheets/foundation/components/_thumbs.scss +1 -2
  54. data/vendor/assets/stylesheets/foundation/components/_tooltips.scss +1 -1
  55. data/vendor/assets/stylesheets/foundation/components/_top-bar.scss +61 -47
  56. data/vendor/assets/stylesheets/foundation/components/_type.scss +13 -14
  57. data/vendor/assets/stylesheets/foundation/components/_visibility.scss +23 -8
  58. data/vendor/assets/stylesheets/normalize.scss +0 -0
  59. metadata +3 -5
  60. data/vendor/_settings.scss +0 -992
  61. data/vendor/assets/stylesheets/foundation/components/_functions.scss +0 -70
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13593db6508c80cb6a91ebb2d5086059ce76856a
4
- data.tar.gz: 8b05290cbacd133cad713261a15dde9a5dce4061
3
+ metadata.gz: 204254d162f542cc0ea659653200263e7e3a4961
4
+ data.tar.gz: 022f8a17b0115806fbf2e5fdae18b8f0ceaec654
5
5
  SHA512:
6
- metadata.gz: 9655cbcb9a922a865820d35780f51333d0c32b1965f6b416caa2a17774756b79326d42d4ed25fa18c86d2891fe558f914e390d402ad8cf27989e0ed6853d4059
7
- data.tar.gz: 90dfdcb3414d97045ebe05fde545790a4d8258d46454b7841bf57c628d0c3566d52e621a7fcc65d2e09e9d2e3308837fa1fc630e4c9e53deeafda3c7aae0e4b1
6
+ metadata.gz: bde8eb4c982a38e52f79b47d97fedde4aaff0a82bf81c9807c162e0b13e92859300133c5fd1b976f7959f2e6fbf7af0e6effb9305fdd2d293a93ba3781f131c7
7
+ data.tar.gz: f1a6aa91c5ac4979ac819a01d5d5b7a73438b8380be8698b0db8a8ecd501a8819439eddbf9a3d26a3145fe02878c79edb2e82168725b6eceb0d24548437a6af0
@@ -1,5 +1,5 @@
1
1
  module Foundation
2
2
  module Rails
3
- VERSION = "5.0.2.0"
3
+ VERSION = "5.0.3.0"
4
4
  end
5
5
  end
@@ -4,10 +4,11 @@
4
4
  Foundation.libs.abide = {
5
5
  name : 'abide',
6
6
 
7
- version : '5.0.0',
7
+ version : '5.0.3',
8
8
 
9
9
  settings : {
10
10
  focus_on_invalid : true,
11
+ error_labels: true, // labels with a for="inputId" will recieve an `error` class
11
12
  timeout : 1000,
12
13
  patterns : {
13
14
  alpha: /[a-zA-Z]+/,
@@ -115,10 +116,6 @@
115
116
  var type = el.getAttribute('type'),
116
117
  required = typeof el.getAttribute('required') === 'string';
117
118
 
118
- if (this.settings.patterns.hasOwnProperty(type)) {
119
- return [el, this.settings.patterns[type], required];
120
- }
121
-
122
119
  var pattern = el.getAttribute('pattern') || '';
123
120
 
124
121
  if (this.settings.patterns.hasOwnProperty(pattern) && pattern.length > 0) {
@@ -126,6 +123,10 @@
126
123
  } else if (pattern.length > 0) {
127
124
  return [el, new RegExp(pattern), required];
128
125
  }
126
+
127
+ if (this.settings.patterns.hasOwnProperty(type)) {
128
+ return [el, this.settings.patterns[type], required];
129
+ }
129
130
 
130
131
  pattern = /.*/;
131
132
 
@@ -142,19 +143,27 @@
142
143
  value = el.value,
143
144
  is_equal = el.getAttribute('data-equalto'),
144
145
  is_radio = el.type === "radio",
146
+ is_checkbox = el.type === "checkbox",
147
+ label = $('label[for="' + el.getAttribute('id') + '"]'),
145
148
  valid_length = (required) ? (el.value.length > 0) : true;
146
149
 
147
150
  if (is_radio && required) {
148
151
  validations.push(this.valid_radio(el, required));
152
+ } else if (is_checkbox && required) {
153
+ validations.push(this.valid_checkbox(el, required));
149
154
  } else if (is_equal && required) {
150
155
  validations.push(this.valid_equal(el, required));
151
156
  } else {
152
157
  if (el_patterns[i][1].test(value) && valid_length ||
153
158
  !required && el.value.length < 1) {
154
159
  $(el).removeAttr('data-invalid').parent().removeClass('error');
160
+ if (label.length > 0 && this.settings.error_labels) label.removeClass('error');
161
+
155
162
  validations.push(true);
156
163
  } else {
157
164
  $(el).attr('data-invalid', '').parent().addClass('error');
165
+ if (label.length > 0 && this.settings.error_labels) label.addClass('error');
166
+
158
167
  validations.push(false);
159
168
  }
160
169
  }
@@ -163,6 +172,18 @@
163
172
  return validations;
164
173
  },
165
174
 
175
+ valid_checkbox : function(el, required) {
176
+ var el = $(el),
177
+ valid = (el.is(':checked') || !required);
178
+ if (valid) {
179
+ el.removeAttr('data-invalid').parent().removeClass('error');
180
+ } else {
181
+ el.attr('data-invalid', '').parent().addClass('error');
182
+ }
183
+
184
+ return valid;
185
+ },
186
+
166
187
  valid_radio : function (el, required) {
167
188
  var name = el.getAttribute('name'),
168
189
  group = document.getElementsByName(name),
@@ -198,4 +219,4 @@
198
219
  return valid;
199
220
  }
200
221
  };
201
- }(jQuery, this, this.document));
222
+ }(jQuery, this, this.document));
@@ -4,7 +4,7 @@
4
4
  Foundation.libs.accordion = {
5
5
  name : 'accordion',
6
6
 
7
- version : '5.0.1',
7
+ version : '5.0.3',
8
8
 
9
9
  settings : {
10
10
  active_class: 'active',
@@ -4,7 +4,7 @@
4
4
  Foundation.libs.alert = {
5
5
  name : 'alert',
6
6
 
7
- version : '5.0.0',
7
+ version : '5.0.3',
8
8
 
9
9
  settings : {
10
10
  animation: 'fadeOut',
@@ -19,7 +19,7 @@
19
19
  events : function () {
20
20
  $(this.scope).off('.alert').on('click.fndtn.alert', '[data-alert] a.close', function (e) {
21
21
  var alertBox = $(this).closest("[data-alert]"),
22
- settings = alertBox.data('alert-init');
22
+ settings = alertBox.data('alert-init') || Foundation.libs.alert.settings;
23
23
 
24
24
  e.preventDefault();
25
25
  alertBox[settings.animation](settings.speed, function () {
@@ -31,4 +31,4 @@
31
31
 
32
32
  reflow : function () {}
33
33
  };
34
- }(jQuery, this, this.document));
34
+ }(jQuery, this, this.document));
@@ -4,12 +4,12 @@
4
4
  Foundation.libs.clearing = {
5
5
  name : 'clearing',
6
6
 
7
- version: '5.0.0',
7
+ version: '5.0.3',
8
8
 
9
9
  settings : {
10
10
  templates : {
11
11
  viewing : '<a href="#" class="clearing-close">&times;</a>' +
12
- '<div class="visible-img" style="display: none"><img src="//:0">' +
12
+ '<div class="visible-img" style="display: none"><img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D" alt="" />' +
13
13
  '<p class="clearing-caption"></p><a href="#" class="clearing-main-prev"><span></span></a>' +
14
14
  '<a href="#" class="clearing-main-next"><span></span></a></div>'
15
15
  },
@@ -212,11 +212,14 @@
212
212
  },
213
213
 
214
214
  keydown : function (e) {
215
- var clearing = $('ul[data-clearing]', '.clearing-blackout');
216
-
217
- if (e.which === 39) this.go(clearing, 'next');
218
- if (e.which === 37) this.go(clearing, 'prev');
219
- if (e.which === 27) $('a.clearing-close').trigger('click');
215
+ var clearing = $('ul[data-clearing]', '.clearing-blackout'),
216
+ NEXT_KEY = this.rtl ? 37 : 39,
217
+ PREV_KEY = this.rtl ? 39 : 37,
218
+ ESC_KEY = 27;
219
+
220
+ if (e.which === NEXT_KEY) this.go(clearing, 'next');
221
+ if (e.which === PREV_KEY) this.go(clearing, 'prev');
222
+ if (e.which === ESC_KEY) $('a.clearing-close').trigger('click');
220
223
  },
221
224
 
222
225
  nav : function (e, direction) {
@@ -284,7 +287,9 @@
284
287
  } else {
285
288
  target.css({
286
289
  marginRight : -(target.outerWidth() / 2),
287
- marginTop : -(target.outerHeight() / 2)
290
+ marginTop : -(target.outerHeight() / 2),
291
+ left: 'auto',
292
+ right: '50%'
288
293
  });
289
294
  }
290
295
  return this;
@@ -358,19 +363,25 @@
358
363
  var clearing = target.parent(),
359
364
  old_index = this.settings.prev_index || target.index(),
360
365
  direction = this.direction(clearing, current, target),
366
+ dir = this.rtl ? 'right' : 'left',
361
367
  left = parseInt(clearing.css('left'), 10),
362
368
  width = target.outerWidth(),
363
369
  skip_shift;
364
370
 
371
+ var dir_obj = {};
372
+
365
373
  // we use jQuery animate instead of CSS transitions because we
366
374
  // need a callback to unlock the next animation
375
+ // needs support for RTL **
367
376
  if (target.index() !== old_index && !/skip/.test(direction)){
368
377
  if (/left/.test(direction)) {
369
378
  this.lock();
370
- clearing.animate({left : left + width}, 300, this.unlock());
379
+ dir_obj[dir] = left + width;
380
+ clearing.animate(dir_obj, 300, this.unlock());
371
381
  } else if (/right/.test(direction)) {
372
382
  this.lock();
373
- clearing.animate({left : left - width}, 300, this.unlock());
383
+ dir_obj[dir] = left - width;
384
+ clearing.animate(dir_obj, 300, this.unlock());
374
385
  }
375
386
  } else if (/skip/.test(direction)) {
376
387
  // the target image is not adjacent to the current image, so
@@ -379,9 +390,11 @@
379
390
  this.lock();
380
391
 
381
392
  if (skip_shift > 0) {
382
- clearing.animate({left : -(skip_shift * width)}, 300, this.unlock());
393
+ dir_obj[dir] = -(skip_shift * width);
394
+ clearing.animate(dir_obj, 300, this.unlock());
383
395
  } else {
384
- clearing.animate({left : 0}, 300, this.unlock());
396
+ dir_obj[dir] = 0;
397
+ clearing.animate(dir_obj, 300, this.unlock());
385
398
  }
386
399
  }
387
400
 
@@ -4,7 +4,7 @@
4
4
  Foundation.libs.dropdown = {
5
5
  name : 'dropdown',
6
6
 
7
- version : '5.0.0',
7
+ version : '5.0.3',
8
8
 
9
9
  settings : {
10
10
  active_class: 'open',
@@ -25,9 +25,11 @@
25
25
  $(this.scope)
26
26
  .off('.dropdown')
27
27
  .on('click.fndtn.dropdown', '[data-dropdown]', function (e) {
28
- var settings = $(this).data('dropdown-init');
28
+ var settings = $(this).data('dropdown-init') || self.settings;
29
29
  e.preventDefault();
30
30
 
31
+ self.closeall.call(self);
32
+
31
33
  if (!settings.is_hover || Modernizr.touch) self.toggle($(this));
32
34
  })
33
35
  .on('mouseenter.fndtn.dropdown', '[data-dropdown], [data-dropdown-content]', function (e) {
@@ -42,18 +44,23 @@
42
44
  target = $("[data-dropdown='" + dropdown.attr('id') + "']");
43
45
  }
44
46
 
45
- var settings = target.data('dropdown-init');
47
+ var settings = target.data('dropdown-init') || self.settings;
48
+
49
+ if($(e.target).data('dropdown') && settings.is_hover) {
50
+ self.closeall.call(self);
51
+ }
52
+
46
53
  if (settings.is_hover) self.open.apply(self, [dropdown, target]);
47
54
  })
48
55
  .on('mouseleave.fndtn.dropdown', '[data-dropdown], [data-dropdown-content]', function (e) {
49
56
  var $this = $(this);
50
57
  self.timeout = setTimeout(function () {
51
58
  if ($this.data('dropdown')) {
52
- var settings = $this.data('dropdown-init');
59
+ var settings = $this.data('dropdown-init') || self.settings;
53
60
  if (settings.is_hover) self.close.call(self, $('#' + $this.data('dropdown')));
54
61
  } else {
55
62
  var target = $('[data-dropdown="' + $(this).attr('id') + '"]'),
56
- settings = target.data('dropdown-init');
63
+ settings = target.data('dropdown-init') || self.settings;
57
64
  if (settings.is_hover) self.close.call(self, $this);
58
65
  }
59
66
  }.bind(this), 150);
@@ -73,8 +80,12 @@
73
80
 
74
81
  self.close.call(self, $('[data-dropdown-content]'));
75
82
  })
76
- .on('opened.fndtn.dropdown', '[data-dropdown-content]', this.settings.opened)
77
- .on('closed.fndtn.dropdown', '[data-dropdown-content]', this.settings.closed);
83
+ .on('opened.fndtn.dropdown', '[data-dropdown-content]', function () {
84
+ self.settings.opened.call(this);
85
+ })
86
+ .on('closed.fndtn.dropdown', '[data-dropdown-content]', function () {
87
+ self.settings.closed.call(this);
88
+ });
78
89
 
79
90
  $(window)
80
91
  .off('.dropdown')
@@ -95,6 +106,13 @@
95
106
  });
96
107
  },
97
108
 
109
+ closeall: function() {
110
+ var self = this;
111
+ $.each($('[data-dropdown-content]'), function() {
112
+ self.close.call(self, $(this))
113
+ });
114
+ },
115
+
98
116
  open: function (dropdown, target) {
99
117
  this
100
118
  .css(dropdown
@@ -4,7 +4,7 @@
4
4
  Foundation.libs.interchange = {
5
5
  name : 'interchange',
6
6
 
7
- version : '5.0.0',
7
+ version : '5.0.3',
8
8
 
9
9
  cache : {},
10
10
 
@@ -15,7 +15,7 @@
15
15
  load_attr : 'interchange',
16
16
 
17
17
  named_queries : {
18
- 'default' : Foundation.media_queries.small,
18
+ 'default' : 'only screen',
19
19
  small : Foundation.media_queries.small,
20
20
  medium : Foundation.media_queries.medium,
21
21
  large : Foundation.media_queries.large,
@@ -71,6 +71,7 @@
71
71
  Foundation.inherit(this, 'throttle');
72
72
 
73
73
  this.data_attr = 'data-' + this.settings.load_attr;
74
+ $.extend(true, this.settings, method, options);
74
75
 
75
76
  this.bindings(method, options);
76
77
  this.load('images');
@@ -178,7 +179,7 @@
178
179
  },
179
180
 
180
181
  update_nodes : function () {
181
- var nodes = this.S('[' + this.data_attr + ']:not(img)'),
182
+ var nodes = this.S('[' + this.data_attr + ']').not('img'),
182
183
  count = nodes.length,
183
184
  loaded_count = 0,
184
185
  data_attr = this.data_attr;
@@ -266,7 +267,7 @@
266
267
  var uuid = this.uuid(),
267
268
  current_uuid = el.data('uuid');
268
269
 
269
- if (current_uuid) return this.cache[current_uuid];
270
+ if (this.cache[current_uuid]) return this.cache[current_uuid];
270
271
 
271
272
  el.attr('data-uuid', uuid);
272
273
 
@@ -301,4 +302,4 @@
301
302
 
302
303
  };
303
304
 
304
- }(jQuery, this, this.document));
305
+ }(jQuery, this, this.document));
@@ -6,7 +6,7 @@
6
6
  Foundation.libs.joyride = {
7
7
  name : 'joyride',
8
8
 
9
- version : '5.0.0',
9
+ version : '5.0.3',
10
10
 
11
11
  defaults : {
12
12
  expose : false, // turn on or off the expose feature
@@ -136,7 +136,7 @@
136
136
  }
137
137
 
138
138
  // generate the tips and insert into dom.
139
- if (!this.settings.cookie_monster || this.settings.cookie_monster && $.cookie(this.settings.cookie_name) === null) {
139
+ if (!this.settings.cookie_monster || this.settings.cookie_monster && !$.cookie(this.settings.cookie_name)) {
140
140
  this.settings.$tip_content.each(function (index) {
141
141
  var $this = $(this);
142
142
  this.settings = $.extend({}, self.defaults, self.data_options($this))
@@ -390,7 +390,7 @@
390
390
  window_half = $(window).height() / 2;
391
391
  tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight());
392
392
 
393
- if (tipOffset > 0) {
393
+ if (tipOffset != 0) {
394
394
  $('html, body').animate({
395
395
  scrollTop: tipOffset
396
396
  }, this.settings.scroll_speed, 'swing');
@@ -426,26 +426,29 @@
426
426
  }
427
427
 
428
428
  if (!/body/i.test(this.settings.$target.selector)) {
429
-
430
429
  if (this.bottom()) {
431
- var leftOffset = this.settings.$target.offset().left;
432
- if (Foundation.rtl) {
433
- leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset;
430
+ if (this.rtl) {
431
+ this.settings.$next_tip.css({
432
+ top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight()),
433
+ left: this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth()});
434
+ } else {
435
+ this.settings.$next_tip.css({
436
+ top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight()),
437
+ left: this.settings.$target.offset().left});
434
438
  }
435
- this.settings.$next_tip.css({
436
- top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight()),
437
- left: leftOffset});
438
439
 
439
440
  this.nub_position($nub, this.settings.tip_settings.nub_position, 'top');
440
441
 
441
442
  } else if (this.top()) {
442
- var leftOffset = this.settings.$target.offset().left;
443
- if (Foundation.rtl) {
444
- leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset;
443
+ if (this.rtl) {
444
+ this.settings.$next_tip.css({
445
+ top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height),
446
+ left: this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth()});
447
+ } else {
448
+ this.settings.$next_tip.css({
449
+ top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height),
450
+ left: this.settings.$target.offset().left});
445
451
  }
446
- this.settings.$next_tip.css({
447
- top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height),
448
- left: leftOffset});
449
452
 
450
453
  this.nub_position($nub, this.settings.tip_settings.nub_position, 'bottom');
451
454
 
@@ -30,14 +30,16 @@
30
30
  $('head').append('<meta class="foundation-mq-xxlarge">');
31
31
  }
32
32
 
33
- // Embed FastClick (this should be removed later)
34
- function FastClick(layer){'use strict';var oldOnClick,self=this;this.trackingClick=false;this.trackingClickStart=0;this.targetElement=null;this.touchStartX=0;this.touchStartY=0;this.lastTouchIdentifier=0;this.touchBoundary=10;this.layer=layer;if(!layer||!layer.nodeType){throw new TypeError('Layer must be a document node');}this.onClick=function(){return FastClick.prototype.onClick.apply(self,arguments)};this.onMouse=function(){return FastClick.prototype.onMouse.apply(self,arguments)};this.onTouchStart=function(){return FastClick.prototype.onTouchStart.apply(self,arguments)};this.onTouchMove=function(){return FastClick.prototype.onTouchMove.apply(self,arguments)};this.onTouchEnd=function(){return FastClick.prototype.onTouchEnd.apply(self,arguments)};this.onTouchCancel=function(){return FastClick.prototype.onTouchCancel.apply(self,arguments)};if(FastClick.notNeeded(layer)){return}if(this.deviceIsAndroid){layer.addEventListener('mouseover',this.onMouse,true);layer.addEventListener('mousedown',this.onMouse,true);layer.addEventListener('mouseup',this.onMouse,true)}layer.addEventListener('click',this.onClick,true);layer.addEventListener('touchstart',this.onTouchStart,false);layer.addEventListener('touchmove',this.onTouchMove,false);layer.addEventListener('touchend',this.onTouchEnd,false);layer.addEventListener('touchcancel',this.onTouchCancel,false);if(!Event.prototype.stopImmediatePropagation){layer.removeEventListener=function(type,callback,capture){var rmv=Node.prototype.removeEventListener;if(type==='click'){rmv.call(layer,type,callback.hijacked||callback,capture)}else{rmv.call(layer,type,callback,capture)}};layer.addEventListener=function(type,callback,capture){var adv=Node.prototype.addEventListener;if(type==='click'){adv.call(layer,type,callback.hijacked||(callback.hijacked=function(event){if(!event.propagationStopped){callback(event)}}),capture)}else{adv.call(layer,type,callback,capture)}}}if(typeof layer.onclick==='function'){oldOnClick=layer.onclick;layer.addEventListener('click',function(event){oldOnClick(event)},false);layer.onclick=null}}FastClick.prototype.deviceIsAndroid=navigator.userAgent.indexOf('Android')>0;FastClick.prototype.deviceIsIOS=/iP(ad|hone|od)/.test(navigator.userAgent);FastClick.prototype.deviceIsIOS4=FastClick.prototype.deviceIsIOS&&(/OS 4_\d(_\d)?/).test(navigator.userAgent);FastClick.prototype.deviceIsIOSWithBadTarget=FastClick.prototype.deviceIsIOS&&(/OS ([6-9]|\d{2})_\d/).test(navigator.userAgent);FastClick.prototype.needsClick=function(target){'use strict';switch(target.nodeName.toLowerCase()){case'button':case'select':case'textarea':if(target.disabled){return true}break;case'input':if((this.deviceIsIOS&&target.type==='file')||target.disabled){return true}break;case'label':case'video':return true}return(/\bneedsclick\b/).test(target.className)};FastClick.prototype.needsFocus=function(target){'use strict';switch(target.nodeName.toLowerCase()){case'textarea':case'select':return true;case'input':switch(target.type){case'button':case'checkbox':case'file':case'image':case'radio':case'submit':return false}return!target.disabled&&!target.readOnly;default:return(/\bneedsfocus\b/).test(target.className)}};FastClick.prototype.sendClick=function(targetElement,event){'use strict';var clickEvent,touch;if(document.activeElement&&document.activeElement!==targetElement){document.activeElement.blur()}touch=event.changedTouches[0];clickEvent=document.createEvent('MouseEvents');clickEvent.initMouseEvent('click',true,true,window,1,touch.screenX,touch.screenY,touch.clientX,touch.clientY,false,false,false,false,0,null);clickEvent.forwardedTouchEvent=true;targetElement.dispatchEvent(clickEvent)};FastClick.prototype.focus=function(targetElement){'use strict';var length;if(this.deviceIsIOS&&targetElement.setSelectionRange){length=targetElement.value.length;targetElement.setSelectionRange(length,length)}else{targetElement.focus()}};FastClick.prototype.updateScrollParent=function(targetElement){'use strict';var scrollParent,parentElement;scrollParent=targetElement.fastClickScrollParent;if(!scrollParent||!scrollParent.contains(targetElement)){parentElement=targetElement;do{if(parentElement.scrollHeight>parentElement.offsetHeight){scrollParent=parentElement;targetElement.fastClickScrollParent=parentElement;break}parentElement=parentElement.parentElement}while(parentElement)}if(scrollParent){scrollParent.fastClickLastScrollTop=scrollParent.scrollTop}};FastClick.prototype.getTargetElementFromEventTarget=function(eventTarget){'use strict';if(eventTarget.nodeType===Node.TEXT_NODE){return eventTarget.parentNode}return eventTarget};FastClick.prototype.onTouchStart=function(event){'use strict';var targetElement,touch,selection;if(event.targetTouches.length>1){return true}targetElement=this.getTargetElementFromEventTarget(event.target);touch=event.targetTouches[0];if(this.deviceIsIOS){selection=window.getSelection();if(selection.rangeCount&&!selection.isCollapsed){return true}if(!this.deviceIsIOS4){if(touch.identifier===this.lastTouchIdentifier){event.preventDefault();return false}this.lastTouchIdentifier=touch.identifier;this.updateScrollParent(targetElement)}}this.trackingClick=true;this.trackingClickStart=event.timeStamp;this.targetElement=targetElement;this.touchStartX=touch.pageX;this.touchStartY=touch.pageY;if((event.timeStamp-this.lastClickTime)<200){event.preventDefault()}return true};FastClick.prototype.touchHasMoved=function(event){'use strict';var touch=event.changedTouches[0],boundary=this.touchBoundary;if(Math.abs(touch.pageX-this.touchStartX)>boundary||Math.abs(touch.pageY-this.touchStartY)>boundary){return true}return false};FastClick.prototype.onTouchMove=function(event){'use strict';if(!this.trackingClick){return true}if(this.targetElement!==this.getTargetElementFromEventTarget(event.target)||this.touchHasMoved(event)){this.trackingClick=false;this.targetElement=null}return true};FastClick.prototype.findControl=function(labelElement){'use strict';if(labelElement.control!==undefined){return labelElement.control}if(labelElement.htmlFor){return document.getElementById(labelElement.htmlFor)}return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea')};FastClick.prototype.onTouchEnd=function(event){'use strict';var forElement,trackingClickStart,targetTagName,scrollParent,touch,targetElement=this.targetElement;if(!this.trackingClick){return true}if((event.timeStamp-this.lastClickTime)<200){this.cancelNextClick=true;return true}this.lastClickTime=event.timeStamp;trackingClickStart=this.trackingClickStart;this.trackingClick=false;this.trackingClickStart=0;if(this.deviceIsIOSWithBadTarget){touch=event.changedTouches[0];targetElement=document.elementFromPoint(touch.pageX-window.pageXOffset,touch.pageY-window.pageYOffset)||targetElement;targetElement.fastClickScrollParent=this.targetElement.fastClickScrollParent}targetTagName=targetElement.tagName.toLowerCase();if(targetTagName==='label'){forElement=this.findControl(targetElement);if(forElement){this.focus(targetElement);if(this.deviceIsAndroid){return false}targetElement=forElement}}else if(this.needsFocus(targetElement)){if((event.timeStamp-trackingClickStart)>100||(this.deviceIsIOS&&window.top!==window&&targetTagName==='input')){this.targetElement=null;return false}this.focus(targetElement);if(!this.deviceIsIOS4||targetTagName!=='select'){this.targetElement=null;event.preventDefault()}return false}if(this.deviceIsIOS&&!this.deviceIsIOS4){scrollParent=targetElement.fastClickScrollParent;if(scrollParent&&scrollParent.fastClickLastScrollTop!==scrollParent.scrollTop){return true}}if(!this.needsClick(targetElement)){event.preventDefault();this.sendClick(targetElement,event)}return false};FastClick.prototype.onTouchCancel=function(){'use strict';this.trackingClick=false;this.targetElement=null};FastClick.prototype.onMouse=function(event){'use strict';if(!this.targetElement){return true}if(event.forwardedTouchEvent){return true}if(!event.cancelable){return true}if(!this.needsClick(this.targetElement)||this.cancelNextClick){if(event.stopImmediatePropagation){event.stopImmediatePropagation()}else{event.propagationStopped=true}event.stopPropagation();event.preventDefault();return false}return true};FastClick.prototype.onClick=function(event){'use strict';var permitted;if(this.trackingClick){this.targetElement=null;this.trackingClick=false;return true}if(event.target.type==='submit'&&event.detail===0){return true}permitted=this.onMouse(event);if(!permitted){this.targetElement=null}return permitted};FastClick.prototype.destroy=function(){'use strict';var layer=this.layer;if(this.deviceIsAndroid){layer.removeEventListener('mouseover',this.onMouse,true);layer.removeEventListener('mousedown',this.onMouse,true);layer.removeEventListener('mouseup',this.onMouse,true)}layer.removeEventListener('click',this.onClick,true);layer.removeEventListener('touchstart',this.onTouchStart,false);layer.removeEventListener('touchmove',this.onTouchMove,false);layer.removeEventListener('touchend',this.onTouchEnd,false);layer.removeEventListener('touchcancel',this.onTouchCancel,false)};FastClick.notNeeded=function(layer){'use strict';var metaViewport;if(typeof window.ontouchstart==='undefined'){return true}if((/Chrome\/[0-9]+/).test(navigator.userAgent)){if(FastClick.prototype.deviceIsAndroid){metaViewport=document.querySelector('meta[name=viewport]');if(metaViewport&&metaViewport.content.indexOf('user-scalable=no')!==-1){return true}}else{return true}}if(layer.style.msTouchAction==='none'){return true}return false};FastClick.attach=function(layer){'use strict';return new FastClick(layer)};if(typeof define!=='undefined'&&define.amd){define(function(){'use strict';return FastClick})}else if(typeof module!=='undefined'&&module.exports){module.exports=FastClick.attach;module.exports.FastClick=FastClick}else{window.FastClick=FastClick}
33
+ // Enable FastClick if present
35
34
 
36
-
37
- // Enable FastClick
38
- if(typeof FastClick !== 'undefined') {
39
- FastClick.attach(document.body);
40
- }
35
+ $(function() {
36
+ if(typeof FastClick !== 'undefined') {
37
+ // Don't attach to body if undefined
38
+ if (typeof document.body !== 'undefined') {
39
+ FastClick.attach(document.body);
40
+ }
41
+ }
42
+ });
41
43
 
42
44
  // private Fast Selector wrapper,
43
45
  // returns jQuery object. Only use where
@@ -174,7 +176,7 @@
174
176
  window.Foundation = {
175
177
  name : 'Foundation',
176
178
 
177
- version : '5.0.0',
179
+ version : '5.0.3',
178
180
 
179
181
  media_queries : {
180
182
  small : S('.foundation-mq-small').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
@@ -218,6 +220,7 @@
218
220
  return this.libs[lib].init.apply(this.libs[lib], [this.scope, args[lib]]);
219
221
  }
220
222
 
223
+ args = args instanceof Array ? args : Array(args); // PATCH: added this line
221
224
  return this.libs[lib].init.apply(this.libs[lib], args);
222
225
  }
223
226
 
@@ -379,7 +382,7 @@
379
382
  should_bind_events = !S(this).data(this.name + '-init');
380
383
 
381
384
  if (typeof method === 'string') {
382
- return this[method].call(this);
385
+ return this[method].call(this, options);
383
386
  }
384
387
 
385
388
  if (S(this.scope).is('[data-' + this.name +']')) {