zurb-foundation-5 5.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/.bowerrc +3 -0
  3. data/.editorconfig +9 -0
  4. data/.gitignore +46 -0
  5. data/.travis.yml +34 -0
  6. data/CONTRIBUTING.md +55 -0
  7. data/Gemfile +3 -0
  8. data/Gemfile.lock +16 -0
  9. data/Gruntfile.js +222 -0
  10. data/LICENSE +22 -0
  11. data/README.md +44 -0
  12. data/bower.json +20 -0
  13. data/composer.json +9 -0
  14. data/foundation.gemspec +21 -0
  15. data/humans.txt +8 -0
  16. data/js/foundation/foundation.abide.js +299 -0
  17. data/js/foundation/foundation.accordion.js +54 -0
  18. data/js/foundation/foundation.alert.js +43 -0
  19. data/js/foundation/foundation.clearing.js +531 -0
  20. data/js/foundation/foundation.dropdown.js +306 -0
  21. data/js/foundation/foundation.equalizer.js +68 -0
  22. data/js/foundation/foundation.interchange.js +331 -0
  23. data/js/foundation/foundation.joyride.js +849 -0
  24. data/js/foundation/foundation.js +609 -0
  25. data/js/foundation/foundation.magellan.js +173 -0
  26. data/js/foundation/foundation.offcanvas.js +50 -0
  27. data/js/foundation/foundation.orbit.js +606 -0
  28. data/js/foundation/foundation.reveal.js +427 -0
  29. data/js/foundation/foundation.slider.js +200 -0
  30. data/js/foundation/foundation.tab.js +168 -0
  31. data/js/foundation/foundation.tooltip.js +272 -0
  32. data/js/foundation/foundation.topbar.js +422 -0
  33. data/karma.conf.js +114 -0
  34. data/lib/foundation/engine.rb +20 -0
  35. data/lib/foundation/generators/USAGE +15 -0
  36. data/lib/foundation/generators/install_generator.rb +54 -0
  37. data/lib/foundation/generators/templates/application.html.erb +47 -0
  38. data/lib/foundation/generators/templates/application.html.haml +31 -0
  39. data/lib/foundation/generators/templates/application.html.slim +35 -0
  40. data/lib/foundation/sprockets.rb +4 -0
  41. data/lib/foundation/version.rb +3 -0
  42. data/lib/scss.js +114 -0
  43. data/lib/zurb-foundation.rb +33 -0
  44. data/package.json +48 -0
  45. data/robots.txt +4 -0
  46. data/run-tests.sh +83 -0
  47. data/sache.json +5 -0
  48. data/scss/foundation.scss +45 -0
  49. data/scss/foundation/_functions.scss +101 -0
  50. data/scss/foundation/_settings.scss +1279 -0
  51. data/scss/foundation/components/_accordion.scss +52 -0
  52. data/scss/foundation/components/_alert-boxes.scss +126 -0
  53. data/scss/foundation/components/_block-grid.scss +132 -0
  54. data/scss/foundation/components/_breadcrumbs.scss +127 -0
  55. data/scss/foundation/components/_button-groups.scss +108 -0
  56. data/scss/foundation/components/_buttons.scss +222 -0
  57. data/scss/foundation/components/_clearing.scss +247 -0
  58. data/scss/foundation/components/_dropdown-buttons.scss +129 -0
  59. data/scss/foundation/components/_dropdown.scss +248 -0
  60. data/scss/foundation/components/_flex-video.scss +51 -0
  61. data/scss/foundation/components/_forms.scss +496 -0
  62. data/scss/foundation/components/_global.scss +365 -0
  63. data/scss/foundation/components/_grid.scss +261 -0
  64. data/scss/foundation/components/_inline-lists.scss +56 -0
  65. data/scss/foundation/components/_joyride.scss +220 -0
  66. data/scss/foundation/components/_keystrokes.scss +61 -0
  67. data/scss/foundation/components/_labels.scss +104 -0
  68. data/scss/foundation/components/_magellan.scss +34 -0
  69. data/scss/foundation/components/_offcanvas.scss +381 -0
  70. data/scss/foundation/components/_orbit.scss +415 -0
  71. data/scss/foundation/components/_pagination.scss +150 -0
  72. data/scss/foundation/components/_panels.scss +91 -0
  73. data/scss/foundation/components/_pricing-tables.scss +150 -0
  74. data/scss/foundation/components/_progress-bars.scss +79 -0
  75. data/scss/foundation/components/_range-slider.scss +148 -0
  76. data/scss/foundation/components/_reveal-new.scss +0 -0
  77. data/scss/foundation/components/_reveal.scss +216 -0
  78. data/scss/foundation/components/_side-nav.scss +93 -0
  79. data/scss/foundation/components/_split-buttons.scss +191 -0
  80. data/scss/foundation/components/_sub-nav.scss +125 -0
  81. data/scss/foundation/components/_switch.scss +294 -0
  82. data/scss/foundation/components/_tables.scss +97 -0
  83. data/scss/foundation/components/_tabs.scss +105 -0
  84. data/scss/foundation/components/_thumbs.scss +68 -0
  85. data/scss/foundation/components/_tooltips.scss +140 -0
  86. data/scss/foundation/components/_top-bar.scss +640 -0
  87. data/scss/foundation/components/_type.scss +493 -0
  88. data/scss/foundation/components/_visibility.scss +345 -0
  89. data/scss/foundation/test.html +0 -0
  90. data/scss/normalize.scss +423 -0
  91. data/spec/abide/abide.js +173 -0
  92. data/spec/abide/advanced.html +22 -0
  93. data/spec/abide/basic.html +13 -0
  94. data/spec/accordion/accordion.js +94 -0
  95. data/spec/accordion/basic.html +39 -0
  96. data/spec/accordion/grid.html +44 -0
  97. data/spec/accordion/multiexpand.html +20 -0
  98. data/spec/alert/alert.js +35 -0
  99. data/spec/alert/basic.html +4 -0
  100. data/spec/clearing/222.gif +0 -0
  101. data/spec/clearing/777.gif +0 -0
  102. data/spec/clearing/basic.html +5 -0
  103. data/spec/clearing/ccc.gif +0 -0
  104. data/spec/clearing/clearing.js +55 -0
  105. data/spec/dropdown/basic.html +10 -0
  106. data/spec/dropdown/dropdown.js +65 -0
  107. data/spec/equalizer/basic.html +24 -0
  108. data/spec/equalizer/equalizer.js +30 -0
  109. data/spec/framework/framework.js +14 -0
  110. data/spec/helpers.js +37 -0
  111. data/spec/interchange/basic.html +3 -0
  112. data/spec/interchange/interchange.js +60 -0
  113. data/spec/joyride/joyride.js +14 -0
  114. data/spec/magellan/magellan.js +14 -0
  115. data/spec/offcanvas/offcanvas.js +14 -0
  116. data/spec/orbit/orbit.js +14 -0
  117. data/spec/reveal/reveal.js +14 -0
  118. data/spec/tab/tab.js +14 -0
  119. data/spec/tooltip/tooltip.js +14 -0
  120. data/spec/topbar/multidropdown.html +60 -0
  121. data/spec/topbar/sticky.html +31 -0
  122. data/spec/topbar/topbar.js +96 -0
  123. metadata +238 -0
@@ -0,0 +1,609 @@
1
+ /*
2
+ * Foundation Responsive Library
3
+ * http://foundation.zurb.com
4
+ * Copyright 2014, ZURB
5
+ * Free to use under the MIT license.
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ */
8
+
9
+ (function ($, window, document, undefined) {
10
+ 'use strict';
11
+
12
+ var header_helpers = function (class_array) {
13
+ var i = class_array.length;
14
+ var head = $('head');
15
+
16
+ while (i--) {
17
+ if(head.has('.' + class_array[i]).length === 0) {
18
+ head.append('<meta class="' + class_array[i] + '" />');
19
+ }
20
+ }
21
+ };
22
+
23
+ header_helpers([
24
+ 'foundation-mq-small',
25
+ 'foundation-mq-medium',
26
+ 'foundation-mq-large',
27
+ 'foundation-mq-xlarge',
28
+ 'foundation-mq-xxlarge',
29
+ 'foundation-data-attribute-namespace']);
30
+
31
+ // Enable FastClick if present
32
+
33
+ $(function() {
34
+ if (typeof FastClick !== 'undefined') {
35
+ // Don't attach to body if undefined
36
+ if (typeof document.body !== 'undefined') {
37
+ FastClick.attach(document.body);
38
+ }
39
+ }
40
+ });
41
+
42
+ // private Fast Selector wrapper,
43
+ // returns jQuery object. Only use where
44
+ // getElementById is not available.
45
+ var S = function (selector, context) {
46
+ if (typeof selector === 'string') {
47
+ if (context) {
48
+ var cont;
49
+ if (context.jquery) {
50
+ cont = context[0];
51
+ if (!cont) return context;
52
+ } else {
53
+ cont = context;
54
+ }
55
+ return $(cont.querySelectorAll(selector));
56
+ }
57
+
58
+ return $(document.querySelectorAll(selector));
59
+ }
60
+
61
+ return $(selector, context);
62
+ };
63
+
64
+ // Namespace functions.
65
+
66
+ var attr_name = function (init) {
67
+ var arr = [];
68
+ if (!init) arr.push('data');
69
+ if (this.namespace.length > 0) arr.push(this.namespace);
70
+ arr.push(this.name);
71
+
72
+ return arr.join('-');
73
+ };
74
+
75
+ var add_namespace = function (str) {
76
+ var parts = str.split('-'),
77
+ i = parts.length,
78
+ arr = [];
79
+
80
+ while (i--) {
81
+ if (i !== 0) {
82
+ arr.push(parts[i]);
83
+ } else {
84
+ if (this.namespace.length > 0) {
85
+ arr.push(this.namespace, parts[i]);
86
+ } else {
87
+ arr.push(parts[i]);
88
+ }
89
+ }
90
+ }
91
+
92
+ return arr.reverse().join('-');
93
+ };
94
+
95
+ // Event binding and data-options updating.
96
+
97
+ var bindings = function (method, options) {
98
+ var self = this,
99
+ should_bind_events = !S(this).data(this.attr_name(true));
100
+
101
+ if (typeof method === 'string') {
102
+ return this[method].call(this, options);
103
+ }
104
+
105
+ if (S(this.scope).is('[' + this.attr_name() +']')) {
106
+ S(this.scope).data(this.attr_name(true) + '-init', $.extend({}, this.settings, (options || method), this.data_options(S(this.scope))));
107
+
108
+ if (should_bind_events) {
109
+ this.events(this.scope);
110
+ }
111
+
112
+ } else {
113
+ S('[' + this.attr_name() +']', this.scope).each(function () {
114
+ var should_bind_events = !S(this).data(self.attr_name(true) + '-init');
115
+ S(this).data(self.attr_name(true) + '-init', $.extend({}, self.settings, (options || method), self.data_options(S(this))));
116
+
117
+ if (should_bind_events) {
118
+ self.events(this);
119
+ }
120
+ });
121
+ }
122
+ };
123
+
124
+ var single_image_loaded = function (image, callback) {
125
+ function loaded () {
126
+ callback(image[0]);
127
+ }
128
+
129
+ function bindLoad () {
130
+ this.one('load', loaded);
131
+
132
+ if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
133
+ var src = this.attr( 'src' ),
134
+ param = src.match( /\?/ ) ? '&' : '?';
135
+
136
+ param += 'random=' + (new Date()).getTime();
137
+ this.attr('src', src + param);
138
+ }
139
+ }
140
+
141
+ if (!image.attr('src')) {
142
+ loaded();
143
+ return;
144
+ }
145
+
146
+ if (image[0].complete || image[0].readyState === 4) {
147
+ loaded();
148
+ } else {
149
+ bindLoad.call(image);
150
+ }
151
+ };
152
+
153
+ /*
154
+ https://github.com/paulirish/matchMedia.js
155
+ */
156
+
157
+ window.matchMedia = window.matchMedia || (function( doc ) {
158
+
159
+ "use strict";
160
+
161
+ var bool,
162
+ docElem = doc.documentElement,
163
+ refNode = docElem.firstElementChild || docElem.firstChild,
164
+ // fakeBody required for <FF4 when executed in <head>
165
+ fakeBody = doc.createElement( "body" ),
166
+ div = doc.createElement( "div" );
167
+
168
+ div.id = "mq-test-1";
169
+ div.style.cssText = "position:absolute;top:-100em";
170
+ fakeBody.style.background = "none";
171
+ fakeBody.appendChild(div);
172
+
173
+ return function (q) {
174
+
175
+ div.innerHTML = "&shy;<style media=\"" + q + "\"> #mq-test-1 { width: 42px; }</style>";
176
+
177
+ docElem.insertBefore( fakeBody, refNode );
178
+ bool = div.offsetWidth === 42;
179
+ docElem.removeChild( fakeBody );
180
+
181
+ return {
182
+ matches: bool,
183
+ media: q
184
+ };
185
+
186
+ };
187
+
188
+ }( document ));
189
+
190
+ /*
191
+ * jquery.requestAnimationFrame
192
+ * https://github.com/gnarf37/jquery-requestAnimationFrame
193
+ * Requires jQuery 1.8+
194
+ *
195
+ * Copyright (c) 2012 Corey Frang
196
+ * Licensed under the MIT license.
197
+ */
198
+
199
+ (function($) {
200
+
201
+ // requestAnimationFrame polyfill adapted from Erik Möller
202
+ // fixes from Paul Irish and Tino Zijdel
203
+ // http://paulirish.com/2011/requestanimationframe-for-smart-animating/
204
+ // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
205
+
206
+ var animating,
207
+ lastTime = 0,
208
+ vendors = ['webkit', 'moz'],
209
+ requestAnimationFrame = window.requestAnimationFrame,
210
+ cancelAnimationFrame = window.cancelAnimationFrame,
211
+ jqueryFxAvailable = 'undefined' !== typeof jQuery.fx;
212
+
213
+ for (; lastTime < vendors.length && !requestAnimationFrame; lastTime++) {
214
+ requestAnimationFrame = window[ vendors[lastTime] + "RequestAnimationFrame" ];
215
+ cancelAnimationFrame = cancelAnimationFrame ||
216
+ window[ vendors[lastTime] + "CancelAnimationFrame" ] ||
217
+ window[ vendors[lastTime] + "CancelRequestAnimationFrame" ];
218
+ }
219
+
220
+ function raf() {
221
+ if (animating) {
222
+ requestAnimationFrame(raf);
223
+
224
+ if (jqueryFxAvailable) {
225
+ jQuery.fx.tick();
226
+ }
227
+ }
228
+ }
229
+
230
+ if (requestAnimationFrame) {
231
+ // use rAF
232
+ window.requestAnimationFrame = requestAnimationFrame;
233
+ window.cancelAnimationFrame = cancelAnimationFrame;
234
+
235
+ if (jqueryFxAvailable) {
236
+ jQuery.fx.timer = function (timer) {
237
+ if (timer() && jQuery.timers.push(timer) && !animating) {
238
+ animating = true;
239
+ raf();
240
+ }
241
+ };
242
+
243
+ jQuery.fx.stop = function () {
244
+ animating = false;
245
+ };
246
+ }
247
+ } else {
248
+ // polyfill
249
+ window.requestAnimationFrame = function (callback) {
250
+ var currTime = new Date().getTime(),
251
+ timeToCall = Math.max(0, 16 - (currTime - lastTime)),
252
+ id = window.setTimeout(function () {
253
+ callback(currTime + timeToCall);
254
+ }, timeToCall);
255
+ lastTime = currTime + timeToCall;
256
+ return id;
257
+ };
258
+
259
+ window.cancelAnimationFrame = function (id) {
260
+ clearTimeout(id);
261
+ };
262
+
263
+ }
264
+
265
+ }( jQuery ));
266
+
267
+
268
+ function removeQuotes (string) {
269
+ if (typeof string === 'string' || string instanceof String) {
270
+ string = string.replace(/^['\\/"]+|(;\s?})+|['\\/"]+$/g, '');
271
+ }
272
+
273
+ return string;
274
+ }
275
+
276
+ window.Foundation = {
277
+ name : 'Foundation',
278
+
279
+ version : '5.2.2',
280
+
281
+ media_queries : {
282
+ small : S('.foundation-mq-small').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
283
+ medium : S('.foundation-mq-medium').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
284
+ large : S('.foundation-mq-large').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
285
+ xlarge: S('.foundation-mq-xlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
286
+ xxlarge: S('.foundation-mq-xxlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, '')
287
+ },
288
+
289
+ stylesheet : $('<style></style>').appendTo('head')[0].sheet,
290
+
291
+ global: {
292
+ namespace: undefined
293
+ },
294
+
295
+ init : function (scope, libraries, method, options, response) {
296
+ var args = [scope, method, options, response],
297
+ responses = [];
298
+
299
+ // check RTL
300
+ this.rtl = /rtl/i.test(S('html').attr('dir'));
301
+
302
+ // set foundation global scope
303
+ this.scope = scope || this.scope;
304
+
305
+ this.set_namespace();
306
+
307
+ if (libraries && typeof libraries === 'string' && !/reflow/i.test(libraries)) {
308
+ if (this.libs.hasOwnProperty(libraries)) {
309
+ responses.push(this.init_lib(libraries, args));
310
+ }
311
+ } else {
312
+ for (var lib in this.libs) {
313
+ responses.push(this.init_lib(lib, libraries));
314
+ }
315
+ }
316
+
317
+ return scope;
318
+ },
319
+
320
+ init_lib : function (lib, args) {
321
+ if (this.libs.hasOwnProperty(lib)) {
322
+ this.patch(this.libs[lib]);
323
+
324
+ if (args && args.hasOwnProperty(lib)) {
325
+ if (typeof this.libs[lib].settings !== 'undefined') {
326
+ $.extend(true, this.libs[lib].settings, args[lib]);
327
+ }
328
+ else if (typeof this.libs[lib].defaults !== 'undefined') {
329
+ $.extend(true, this.libs[lib].defaults, args[lib]);
330
+ }
331
+ return this.libs[lib].init.apply(this.libs[lib], [this.scope, args[lib]]);
332
+ }
333
+
334
+ args = args instanceof Array ? args : new Array(args); // PATCH: added this line
335
+ return this.libs[lib].init.apply(this.libs[lib], args);
336
+ }
337
+
338
+ return function () {};
339
+ },
340
+
341
+ patch : function (lib) {
342
+ lib.scope = this.scope;
343
+ lib.namespace = this.global.namespace;
344
+ lib.rtl = this.rtl;
345
+ lib['data_options'] = this.utils.data_options;
346
+ lib['attr_name'] = attr_name;
347
+ lib['add_namespace'] = add_namespace;
348
+ lib['bindings'] = bindings;
349
+ lib['S'] = this.utils.S;
350
+ },
351
+
352
+ inherit : function (scope, methods) {
353
+ var methods_arr = methods.split(' '),
354
+ i = methods_arr.length;
355
+
356
+ while (i--) {
357
+ if (this.utils.hasOwnProperty(methods_arr[i])) {
358
+ scope[methods_arr[i]] = this.utils[methods_arr[i]];
359
+ }
360
+ }
361
+ },
362
+
363
+ set_namespace: function () {
364
+
365
+ // Description:
366
+ // Don't bother reading the namespace out of the meta tag
367
+ // if the namespace has been set globally in javascript
368
+ //
369
+ // Example:
370
+ // Foundation.global.namespace = 'my-namespace';
371
+ // or make it an empty string:
372
+ // Foundation.global.namespace = '';
373
+ //
374
+ //
375
+
376
+ // If the namespace has not been set (is undefined), try to read it out of the meta element.
377
+ // Otherwise use the globally defined namespace, even if it's empty ('')
378
+ var namespace = ( this.global.namespace === undefined ) ? $('.foundation-data-attribute-namespace').css('font-family') : this.global.namespace;
379
+
380
+ // Finally, if the namsepace is either undefined or false, set it to an empty string.
381
+ // Otherwise use the namespace value.
382
+ this.global.namespace = ( namespace === undefined || /false/i.test(namespace) ) ? '' : namespace;
383
+ },
384
+
385
+ libs : {},
386
+
387
+ // methods that can be inherited in libraries
388
+ utils : {
389
+
390
+ // Description:
391
+ // Fast Selector wrapper returns jQuery object. Only use where getElementById
392
+ // is not available.
393
+ //
394
+ // Arguments:
395
+ // Selector (String): CSS selector describing the element(s) to be
396
+ // returned as a jQuery object.
397
+ //
398
+ // Scope (String): CSS selector describing the area to be searched. Default
399
+ // is document.
400
+ //
401
+ // Returns:
402
+ // Element (jQuery Object): jQuery object containing elements matching the
403
+ // selector within the scope.
404
+ S : S,
405
+
406
+ // Description:
407
+ // Executes a function a max of once every n milliseconds
408
+ //
409
+ // Arguments:
410
+ // Func (Function): Function to be throttled.
411
+ //
412
+ // Delay (Integer): Function execution threshold in milliseconds.
413
+ //
414
+ // Returns:
415
+ // Lazy_function (Function): Function with throttling applied.
416
+ throttle : function (func, delay) {
417
+ var timer = null;
418
+
419
+ return function () {
420
+ var context = this, args = arguments;
421
+
422
+ if (timer == null) {
423
+ timer = setTimeout(function () {
424
+ func.apply(context, args);
425
+ timer = null;
426
+ }, delay);
427
+ }
428
+ };
429
+ },
430
+
431
+ // Description:
432
+ // Executes a function when it stops being invoked for n seconds
433
+ // Modified version of _.debounce() http://underscorejs.org
434
+ //
435
+ // Arguments:
436
+ // Func (Function): Function to be debounced.
437
+ //
438
+ // Delay (Integer): Function execution threshold in milliseconds.
439
+ //
440
+ // Immediate (Bool): Whether the function should be called at the beginning
441
+ // of the delay instead of the end. Default is false.
442
+ //
443
+ // Returns:
444
+ // Lazy_function (Function): Function with debouncing applied.
445
+ debounce : function (func, delay, immediate) {
446
+ var timeout, result;
447
+ return function () {
448
+ var context = this, args = arguments;
449
+ var later = function () {
450
+ timeout = null;
451
+ if (!immediate) result = func.apply(context, args);
452
+ };
453
+ var callNow = immediate && !timeout;
454
+ clearTimeout(timeout);
455
+ timeout = setTimeout(later, delay);
456
+ if (callNow) result = func.apply(context, args);
457
+ return result;
458
+ };
459
+ },
460
+
461
+ // Description:
462
+ // Parses data-options attribute
463
+ //
464
+ // Arguments:
465
+ // El (jQuery Object): Element to be parsed.
466
+ //
467
+ // Returns:
468
+ // Options (Javascript Object): Contents of the element's data-options
469
+ // attribute.
470
+ data_options : function (el) {
471
+ var opts = {}, ii, p, opts_arr,
472
+ data_options = function (el) {
473
+ var namespace = Foundation.global.namespace;
474
+
475
+ if (namespace.length > 0) {
476
+ return el.data(namespace + '-options');
477
+ }
478
+
479
+ return el.data('options');
480
+ };
481
+
482
+ var cached_options = data_options(el);
483
+
484
+ if (typeof cached_options === 'object') {
485
+ return cached_options;
486
+ }
487
+
488
+ opts_arr = (cached_options || ':').split(';');
489
+ ii = opts_arr.length;
490
+
491
+ function isNumber (o) {
492
+ return ! isNaN (o-0) && o !== null && o !== "" && o !== false && o !== true;
493
+ }
494
+
495
+ function trim (str) {
496
+ if (typeof str === 'string') return $.trim(str);
497
+ return str;
498
+ }
499
+
500
+ while (ii--) {
501
+ p = opts_arr[ii].split(':');
502
+
503
+ if (/true/i.test(p[1])) p[1] = true;
504
+ if (/false/i.test(p[1])) p[1] = false;
505
+ if (isNumber(p[1])) {
506
+ if (p[1].indexOf('.') === -1) {
507
+ p[1] = parseInt(p[1], 10);
508
+ } else {
509
+ p[1] = parseFloat(p[1]);
510
+ }
511
+ }
512
+
513
+ if (p.length === 2 && p[0].length > 0) {
514
+ opts[trim(p[0])] = trim(p[1]);
515
+ }
516
+ }
517
+
518
+ return opts;
519
+ },
520
+
521
+ // Description:
522
+ // Adds JS-recognizable media queries
523
+ //
524
+ // Arguments:
525
+ // Media (String): Key string for the media query to be stored as in
526
+ // Foundation.media_queries
527
+ //
528
+ // Class (String): Class name for the generated <meta> tag
529
+ register_media : function (media, media_class) {
530
+ if(Foundation.media_queries[media] === undefined) {
531
+ $('head').append('<meta class="' + media_class + '">');
532
+ Foundation.media_queries[media] = removeQuotes($('.' + media_class).css('font-family'));
533
+ }
534
+ },
535
+
536
+ // Description:
537
+ // Add custom CSS within a JS-defined media query
538
+ //
539
+ // Arguments:
540
+ // Rule (String): CSS rule to be appended to the document.
541
+ //
542
+ // Media (String): Optional media query string for the CSS rule to be
543
+ // nested under.
544
+ add_custom_rule : function (rule, media) {
545
+ if (media === undefined) {
546
+ Foundation.stylesheet.insertRule(rule, Foundation.stylesheet.cssRules.length);
547
+ } else {
548
+ var query = Foundation.media_queries[media];
549
+
550
+ if (query !== undefined) {
551
+ Foundation.stylesheet.insertRule('@media ' +
552
+ Foundation.media_queries[media] + '{ ' + rule + ' }');
553
+ }
554
+ }
555
+ },
556
+
557
+ // Description:
558
+ // Performs a callback function when an image is fully loaded
559
+ //
560
+ // Arguments:
561
+ // Image (jQuery Object): Image(s) to check if loaded.
562
+ //
563
+ // Callback (Function): Fundation to execute when image is fully loaded.
564
+ image_loaded : function (images, callback) {
565
+ var self = this,
566
+ unloaded = images.length;
567
+
568
+ if (unloaded === 0) {
569
+ callback(images);
570
+ }
571
+
572
+ images.each(function () {
573
+ single_image_loaded(self.S(this), function () {
574
+ unloaded -= 1;
575
+ if (unloaded === 0) {
576
+ callback(images);
577
+ }
578
+ });
579
+ });
580
+ },
581
+
582
+ // Description:
583
+ // Returns a random, alphanumeric string
584
+ //
585
+ // Arguments:
586
+ // Length (Integer): Length of string to be generated. Defaults to random
587
+ // integer.
588
+ //
589
+ // Returns:
590
+ // Rand (String): Pseudo-random, alphanumeric string.
591
+ random_str : function () {
592
+ if (!this.fidx) this.fidx = 0;
593
+ this.prefix = this.prefix || [(this.name || 'F'), (+new Date).toString(36)].join('-');
594
+
595
+ return this.prefix + (this.fidx++).toString(36);
596
+ }
597
+ }
598
+ };
599
+
600
+ $.fn.foundation = function () {
601
+ var args = Array.prototype.slice.call(arguments, 0);
602
+
603
+ return this.each(function () {
604
+ Foundation.init.apply(Foundation, [this].concat(args));
605
+ return this;
606
+ });
607
+ };
608
+
609
+ }(jQuery, this, this.document));