foundation_front_end 0.1.0

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 (38) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +64 -0
  6. data/Rakefile +1 -0
  7. data/bin/console +14 -0
  8. data/bin/setup +7 -0
  9. data/foundation_front_end.gemspec +32 -0
  10. data/lib/foundation_front_end.rb +21 -0
  11. data/lib/foundation_front_end/version.rb +3 -0
  12. data/vendor/assets/javascripts/foundation.min.js +6376 -0
  13. data/vendor/assets/javascripts/foundation/foundation.abide.js +408 -0
  14. data/vendor/assets/javascripts/foundation/foundation.accordion.js +88 -0
  15. data/vendor/assets/javascripts/foundation/foundation.alert.js +43 -0
  16. data/vendor/assets/javascripts/foundation/foundation.clearing.js +586 -0
  17. data/vendor/assets/javascripts/foundation/foundation.dropdown.js +463 -0
  18. data/vendor/assets/javascripts/foundation/foundation.equalizer.js +104 -0
  19. data/vendor/assets/javascripts/foundation/foundation.interchange.js +359 -0
  20. data/vendor/assets/javascripts/foundation/foundation.joyride.js +932 -0
  21. data/vendor/assets/javascripts/foundation/foundation.js +725 -0
  22. data/vendor/assets/javascripts/foundation/foundation.magellan.js +215 -0
  23. data/vendor/assets/javascripts/foundation/foundation.offcanvas.js +152 -0
  24. data/vendor/assets/javascripts/foundation/foundation.orbit.js +476 -0
  25. data/vendor/assets/javascripts/foundation/foundation.reveal.js +498 -0
  26. data/vendor/assets/javascripts/foundation/foundation.slider.js +281 -0
  27. data/vendor/assets/javascripts/foundation/foundation.tab.js +249 -0
  28. data/vendor/assets/javascripts/foundation/foundation.tooltip.js +339 -0
  29. data/vendor/assets/javascripts/foundation/foundation.topbar.js +458 -0
  30. data/vendor/assets/javascripts/vendor/fastclick.js +8 -0
  31. data/vendor/assets/javascripts/vendor/jquery.cookie.js +8 -0
  32. data/vendor/assets/javascripts/vendor/jquery.js +27 -0
  33. data/vendor/assets/javascripts/vendor/modernizr.js +8 -0
  34. data/vendor/assets/javascripts/vendor/placeholder.js +2 -0
  35. data/vendor/assets/stylesheets/foundation.css +6324 -0
  36. data/vendor/assets/stylesheets/foundation.min.css +1 -0
  37. data/vendor/assets/stylesheets/normalize.css +424 -0
  38. metadata +110 -0
@@ -0,0 +1,725 @@
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-small-only',
26
+ 'foundation-mq-medium',
27
+ 'foundation-mq-medium-only',
28
+ 'foundation-mq-large',
29
+ 'foundation-mq-large-only',
30
+ 'foundation-mq-xlarge',
31
+ 'foundation-mq-xlarge-only',
32
+ 'foundation-mq-xxlarge',
33
+ 'foundation-data-attribute-namespace']);
34
+
35
+ // Enable FastClick if present
36
+
37
+ $(function () {
38
+ if (typeof FastClick !== 'undefined') {
39
+ // Don't attach to body if undefined
40
+ if (typeof document.body !== 'undefined') {
41
+ FastClick.attach(document.body);
42
+ }
43
+ }
44
+ });
45
+
46
+ // private Fast Selector wrapper,
47
+ // returns jQuery object. Only use where
48
+ // getElementById is not available.
49
+ var S = function (selector, context) {
50
+ if (typeof selector === 'string') {
51
+ if (context) {
52
+ var cont;
53
+ if (context.jquery) {
54
+ cont = context[0];
55
+ if (!cont) {
56
+ return context;
57
+ }
58
+ } else {
59
+ cont = context;
60
+ }
61
+ return $(cont.querySelectorAll(selector));
62
+ }
63
+
64
+ return $(document.querySelectorAll(selector));
65
+ }
66
+
67
+ return $(selector, context);
68
+ };
69
+
70
+ // Namespace functions.
71
+
72
+ var attr_name = function (init) {
73
+ var arr = [];
74
+ if (!init) {
75
+ arr.push('data');
76
+ }
77
+ if (this.namespace.length > 0) {
78
+ arr.push(this.namespace);
79
+ }
80
+ arr.push(this.name);
81
+
82
+ return arr.join('-');
83
+ };
84
+
85
+ var add_namespace = function (str) {
86
+ var parts = str.split('-'),
87
+ i = parts.length,
88
+ arr = [];
89
+
90
+ while (i--) {
91
+ if (i !== 0) {
92
+ arr.push(parts[i]);
93
+ } else {
94
+ if (this.namespace.length > 0) {
95
+ arr.push(this.namespace, parts[i]);
96
+ } else {
97
+ arr.push(parts[i]);
98
+ }
99
+ }
100
+ }
101
+
102
+ return arr.reverse().join('-');
103
+ };
104
+
105
+ // Event binding and data-options updating.
106
+
107
+ var bindings = function (method, options) {
108
+ var self = this,
109
+ bind = function(){
110
+ var $this = S(this),
111
+ should_bind_events = !$this.data(self.attr_name(true) + '-init');
112
+ $this.data(self.attr_name(true) + '-init', $.extend({}, self.settings, (options || method), self.data_options($this)));
113
+
114
+ if (should_bind_events) {
115
+ self.events(this);
116
+ }
117
+ };
118
+
119
+ if (S(this.scope).is('[' + this.attr_name() +']')) {
120
+ bind.call(this.scope);
121
+ } else {
122
+ S('[' + this.attr_name() +']', this.scope).each(bind);
123
+ }
124
+ // # Patch to fix #5043 to move this *after* the if/else clause in order for Backbone and similar frameworks to have improved control over event binding and data-options updating.
125
+ if (typeof method === 'string') {
126
+ return this[method].call(this, options);
127
+ }
128
+
129
+ };
130
+
131
+ var single_image_loaded = function (image, callback) {
132
+ function loaded () {
133
+ callback(image[0]);
134
+ }
135
+
136
+ function bindLoad () {
137
+ this.one('load', loaded);
138
+
139
+ if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
140
+ var src = this.attr( 'src' ),
141
+ param = src.match( /\?/ ) ? '&' : '?';
142
+
143
+ param += 'random=' + (new Date()).getTime();
144
+ this.attr('src', src + param);
145
+ }
146
+ }
147
+
148
+ if (!image.attr('src')) {
149
+ loaded();
150
+ return;
151
+ }
152
+
153
+ if (image[0].complete || image[0].readyState === 4) {
154
+ loaded();
155
+ } else {
156
+ bindLoad.call(image);
157
+ }
158
+ };
159
+
160
+ /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */
161
+
162
+ window.matchMedia || (window.matchMedia = function() {
163
+ "use strict";
164
+
165
+ // For browsers that support matchMedium api such as IE 9 and webkit
166
+ var styleMedia = (window.styleMedia || window.media);
167
+
168
+ // For those that don't support matchMedium
169
+ if (!styleMedia) {
170
+ var style = document.createElement('style'),
171
+ script = document.getElementsByTagName('script')[0],
172
+ info = null;
173
+
174
+ style.type = 'text/css';
175
+ style.id = 'matchmediajs-test';
176
+
177
+ script.parentNode.insertBefore(style, script);
178
+
179
+ // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
180
+ info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle;
181
+
182
+ styleMedia = {
183
+ matchMedium: function(media) {
184
+ var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }';
185
+
186
+ // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
187
+ if (style.styleSheet) {
188
+ style.styleSheet.cssText = text;
189
+ } else {
190
+ style.textContent = text;
191
+ }
192
+
193
+ // Test if media query is true or false
194
+ return info.width === '1px';
195
+ }
196
+ };
197
+ }
198
+
199
+ return function(media) {
200
+ return {
201
+ matches: styleMedia.matchMedium(media || 'all'),
202
+ media: media || 'all'
203
+ };
204
+ };
205
+ }());
206
+
207
+ /*
208
+ * jquery.requestAnimationFrame
209
+ * https://github.com/gnarf37/jquery-requestAnimationFrame
210
+ * Requires jQuery 1.8+
211
+ *
212
+ * Copyright (c) 2012 Corey Frang
213
+ * Licensed under the MIT license.
214
+ */
215
+
216
+ (function(jQuery) {
217
+
218
+
219
+ // requestAnimationFrame polyfill adapted from Erik Möller
220
+ // fixes from Paul Irish and Tino Zijdel
221
+ // http://paulirish.com/2011/requestanimationframe-for-smart-animating/
222
+ // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
223
+
224
+ var animating,
225
+ lastTime = 0,
226
+ vendors = ['webkit', 'moz'],
227
+ requestAnimationFrame = window.requestAnimationFrame,
228
+ cancelAnimationFrame = window.cancelAnimationFrame,
229
+ jqueryFxAvailable = 'undefined' !== typeof jQuery.fx;
230
+
231
+ for (; lastTime < vendors.length && !requestAnimationFrame; lastTime++) {
232
+ requestAnimationFrame = window[ vendors[lastTime] + 'RequestAnimationFrame' ];
233
+ cancelAnimationFrame = cancelAnimationFrame ||
234
+ window[ vendors[lastTime] + 'CancelAnimationFrame' ] ||
235
+ window[ vendors[lastTime] + 'CancelRequestAnimationFrame' ];
236
+ }
237
+
238
+ function raf() {
239
+ if (animating) {
240
+ requestAnimationFrame(raf);
241
+
242
+ if (jqueryFxAvailable) {
243
+ jQuery.fx.tick();
244
+ }
245
+ }
246
+ }
247
+
248
+ if (requestAnimationFrame) {
249
+ // use rAF
250
+ window.requestAnimationFrame = requestAnimationFrame;
251
+ window.cancelAnimationFrame = cancelAnimationFrame;
252
+
253
+ if (jqueryFxAvailable) {
254
+ jQuery.fx.timer = function (timer) {
255
+ if (timer() && jQuery.timers.push(timer) && !animating) {
256
+ animating = true;
257
+ raf();
258
+ }
259
+ };
260
+
261
+ jQuery.fx.stop = function () {
262
+ animating = false;
263
+ };
264
+ }
265
+ } else {
266
+ // polyfill
267
+ window.requestAnimationFrame = function (callback) {
268
+ var currTime = new Date().getTime(),
269
+ timeToCall = Math.max(0, 16 - (currTime - lastTime)),
270
+ id = window.setTimeout(function () {
271
+ callback(currTime + timeToCall);
272
+ }, timeToCall);
273
+ lastTime = currTime + timeToCall;
274
+ return id;
275
+ };
276
+
277
+ window.cancelAnimationFrame = function (id) {
278
+ clearTimeout(id);
279
+ };
280
+
281
+ }
282
+
283
+ }( $ ));
284
+
285
+ function removeQuotes (string) {
286
+ if (typeof string === 'string' || string instanceof String) {
287
+ string = string.replace(/^['\\/"]+|(;\s?})+|['\\/"]+$/g, '');
288
+ }
289
+
290
+ return string;
291
+ }
292
+
293
+ window.Foundation = {
294
+ name : 'Foundation',
295
+
296
+ version : '5.5.2',
297
+
298
+ media_queries : {
299
+ 'small' : S('.foundation-mq-small').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
300
+ 'small-only' : S('.foundation-mq-small-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
301
+ 'medium' : S('.foundation-mq-medium').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
302
+ 'medium-only' : S('.foundation-mq-medium-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
303
+ 'large' : S('.foundation-mq-large').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
304
+ 'large-only' : S('.foundation-mq-large-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
305
+ 'xlarge' : S('.foundation-mq-xlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
306
+ 'xlarge-only' : S('.foundation-mq-xlarge-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
307
+ 'xxlarge' : S('.foundation-mq-xxlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, '')
308
+ },
309
+
310
+ stylesheet : $('<style></style>').appendTo('head')[0].sheet,
311
+
312
+ global : {
313
+ namespace : undefined
314
+ },
315
+
316
+ init : function (scope, libraries, method, options, response) {
317
+ var args = [scope, method, options, response],
318
+ responses = [];
319
+
320
+ // check RTL
321
+ this.rtl = /rtl/i.test(S('html').attr('dir'));
322
+
323
+ // set foundation global scope
324
+ this.scope = scope || this.scope;
325
+
326
+ this.set_namespace();
327
+
328
+ if (libraries && typeof libraries === 'string' && !/reflow/i.test(libraries)) {
329
+ if (this.libs.hasOwnProperty(libraries)) {
330
+ responses.push(this.init_lib(libraries, args));
331
+ }
332
+ } else {
333
+ for (var lib in this.libs) {
334
+ responses.push(this.init_lib(lib, libraries));
335
+ }
336
+ }
337
+
338
+ S(window).load(function () {
339
+ S(window)
340
+ .trigger('resize.fndtn.clearing')
341
+ .trigger('resize.fndtn.dropdown')
342
+ .trigger('resize.fndtn.equalizer')
343
+ .trigger('resize.fndtn.interchange')
344
+ .trigger('resize.fndtn.joyride')
345
+ .trigger('resize.fndtn.magellan')
346
+ .trigger('resize.fndtn.topbar')
347
+ .trigger('resize.fndtn.slider');
348
+ });
349
+
350
+ return scope;
351
+ },
352
+
353
+ init_lib : function (lib, args) {
354
+ if (this.libs.hasOwnProperty(lib)) {
355
+ this.patch(this.libs[lib]);
356
+
357
+ if (args && args.hasOwnProperty(lib)) {
358
+ if (typeof this.libs[lib].settings !== 'undefined') {
359
+ $.extend(true, this.libs[lib].settings, args[lib]);
360
+ } else if (typeof this.libs[lib].defaults !== 'undefined') {
361
+ $.extend(true, this.libs[lib].defaults, args[lib]);
362
+ }
363
+ return this.libs[lib].init.apply(this.libs[lib], [this.scope, args[lib]]);
364
+ }
365
+
366
+ args = args instanceof Array ? args : new Array(args);
367
+ return this.libs[lib].init.apply(this.libs[lib], args);
368
+ }
369
+
370
+ return function () {};
371
+ },
372
+
373
+ patch : function (lib) {
374
+ lib.scope = this.scope;
375
+ lib.namespace = this.global.namespace;
376
+ lib.rtl = this.rtl;
377
+ lib['data_options'] = this.utils.data_options;
378
+ lib['attr_name'] = attr_name;
379
+ lib['add_namespace'] = add_namespace;
380
+ lib['bindings'] = bindings;
381
+ lib['S'] = this.utils.S;
382
+ },
383
+
384
+ inherit : function (scope, methods) {
385
+ var methods_arr = methods.split(' '),
386
+ i = methods_arr.length;
387
+
388
+ while (i--) {
389
+ if (this.utils.hasOwnProperty(methods_arr[i])) {
390
+ scope[methods_arr[i]] = this.utils[methods_arr[i]];
391
+ }
392
+ }
393
+ },
394
+
395
+ set_namespace : function () {
396
+
397
+ // Description:
398
+ // Don't bother reading the namespace out of the meta tag
399
+ // if the namespace has been set globally in javascript
400
+ //
401
+ // Example:
402
+ // Foundation.global.namespace = 'my-namespace';
403
+ // or make it an empty string:
404
+ // Foundation.global.namespace = '';
405
+ //
406
+ //
407
+
408
+ // If the namespace has not been set (is undefined), try to read it out of the meta element.
409
+ // Otherwise use the globally defined namespace, even if it's empty ('')
410
+ var namespace = ( this.global.namespace === undefined ) ? $('.foundation-data-attribute-namespace').css('font-family') : this.global.namespace;
411
+
412
+ // Finally, if the namsepace is either undefined or false, set it to an empty string.
413
+ // Otherwise use the namespace value.
414
+ this.global.namespace = ( namespace === undefined || /false/i.test(namespace) ) ? '' : namespace;
415
+ },
416
+
417
+ libs : {},
418
+
419
+ // methods that can be inherited in libraries
420
+ utils : {
421
+
422
+ // Description:
423
+ // Fast Selector wrapper returns jQuery object. Only use where getElementById
424
+ // is not available.
425
+ //
426
+ // Arguments:
427
+ // Selector (String): CSS selector describing the element(s) to be
428
+ // returned as a jQuery object.
429
+ //
430
+ // Scope (String): CSS selector describing the area to be searched. Default
431
+ // is document.
432
+ //
433
+ // Returns:
434
+ // Element (jQuery Object): jQuery object containing elements matching the
435
+ // selector within the scope.
436
+ S : S,
437
+
438
+ // Description:
439
+ // Executes a function a max of once every n milliseconds
440
+ //
441
+ // Arguments:
442
+ // Func (Function): Function to be throttled.
443
+ //
444
+ // Delay (Integer): Function execution threshold in milliseconds.
445
+ //
446
+ // Returns:
447
+ // Lazy_function (Function): Function with throttling applied.
448
+ throttle : function (func, delay) {
449
+ var timer = null;
450
+
451
+ return function () {
452
+ var context = this, args = arguments;
453
+
454
+ if (timer == null) {
455
+ timer = setTimeout(function () {
456
+ func.apply(context, args);
457
+ timer = null;
458
+ }, delay);
459
+ }
460
+ };
461
+ },
462
+
463
+ // Description:
464
+ // Executes a function when it stops being invoked for n seconds
465
+ // Modified version of _.debounce() http://underscorejs.org
466
+ //
467
+ // Arguments:
468
+ // Func (Function): Function to be debounced.
469
+ //
470
+ // Delay (Integer): Function execution threshold in milliseconds.
471
+ //
472
+ // Immediate (Bool): Whether the function should be called at the beginning
473
+ // of the delay instead of the end. Default is false.
474
+ //
475
+ // Returns:
476
+ // Lazy_function (Function): Function with debouncing applied.
477
+ debounce : function (func, delay, immediate) {
478
+ var timeout, result;
479
+ return function () {
480
+ var context = this, args = arguments;
481
+ var later = function () {
482
+ timeout = null;
483
+ if (!immediate) {
484
+ result = func.apply(context, args);
485
+ }
486
+ };
487
+ var callNow = immediate && !timeout;
488
+ clearTimeout(timeout);
489
+ timeout = setTimeout(later, delay);
490
+ if (callNow) {
491
+ result = func.apply(context, args);
492
+ }
493
+ return result;
494
+ };
495
+ },
496
+
497
+ // Description:
498
+ // Parses data-options attribute
499
+ //
500
+ // Arguments:
501
+ // El (jQuery Object): Element to be parsed.
502
+ //
503
+ // Returns:
504
+ // Options (Javascript Object): Contents of the element's data-options
505
+ // attribute.
506
+ data_options : function (el, data_attr_name) {
507
+ data_attr_name = data_attr_name || 'options';
508
+ var opts = {}, ii, p, opts_arr,
509
+ data_options = function (el) {
510
+ var namespace = Foundation.global.namespace;
511
+
512
+ if (namespace.length > 0) {
513
+ return el.data(namespace + '-' + data_attr_name);
514
+ }
515
+
516
+ return el.data(data_attr_name);
517
+ };
518
+
519
+ var cached_options = data_options(el);
520
+
521
+ if (typeof cached_options === 'object') {
522
+ return cached_options;
523
+ }
524
+
525
+ opts_arr = (cached_options || ':').split(';');
526
+ ii = opts_arr.length;
527
+
528
+ function isNumber (o) {
529
+ return !isNaN (o - 0) && o !== null && o !== '' && o !== false && o !== true;
530
+ }
531
+
532
+ function trim (str) {
533
+ if (typeof str === 'string') {
534
+ return $.trim(str);
535
+ }
536
+ return str;
537
+ }
538
+
539
+ while (ii--) {
540
+ p = opts_arr[ii].split(':');
541
+ p = [p[0], p.slice(1).join(':')];
542
+
543
+ if (/true/i.test(p[1])) {
544
+ p[1] = true;
545
+ }
546
+ if (/false/i.test(p[1])) {
547
+ p[1] = false;
548
+ }
549
+ if (isNumber(p[1])) {
550
+ if (p[1].indexOf('.') === -1) {
551
+ p[1] = parseInt(p[1], 10);
552
+ } else {
553
+ p[1] = parseFloat(p[1]);
554
+ }
555
+ }
556
+
557
+ if (p.length === 2 && p[0].length > 0) {
558
+ opts[trim(p[0])] = trim(p[1]);
559
+ }
560
+ }
561
+
562
+ return opts;
563
+ },
564
+
565
+ // Description:
566
+ // Adds JS-recognizable media queries
567
+ //
568
+ // Arguments:
569
+ // Media (String): Key string for the media query to be stored as in
570
+ // Foundation.media_queries
571
+ //
572
+ // Class (String): Class name for the generated <meta> tag
573
+ register_media : function (media, media_class) {
574
+ if (Foundation.media_queries[media] === undefined) {
575
+ $('head').append('<meta class="' + media_class + '"/>');
576
+ Foundation.media_queries[media] = removeQuotes($('.' + media_class).css('font-family'));
577
+ }
578
+ },
579
+
580
+ // Description:
581
+ // Add custom CSS within a JS-defined media query
582
+ //
583
+ // Arguments:
584
+ // Rule (String): CSS rule to be appended to the document.
585
+ //
586
+ // Media (String): Optional media query string for the CSS rule to be
587
+ // nested under.
588
+ add_custom_rule : function (rule, media) {
589
+ if (media === undefined && Foundation.stylesheet) {
590
+ Foundation.stylesheet.insertRule(rule, Foundation.stylesheet.cssRules.length);
591
+ } else {
592
+ var query = Foundation.media_queries[media];
593
+
594
+ if (query !== undefined) {
595
+ Foundation.stylesheet.insertRule('@media ' +
596
+ Foundation.media_queries[media] + '{ ' + rule + ' }', Foundation.stylesheet.cssRules.length);
597
+ }
598
+ }
599
+ },
600
+
601
+ // Description:
602
+ // Performs a callback function when an image is fully loaded
603
+ //
604
+ // Arguments:
605
+ // Image (jQuery Object): Image(s) to check if loaded.
606
+ //
607
+ // Callback (Function): Function to execute when image is fully loaded.
608
+ image_loaded : function (images, callback) {
609
+ var self = this,
610
+ unloaded = images.length;
611
+
612
+ function pictures_has_height(images) {
613
+ var pictures_number = images.length;
614
+
615
+ for (var i = pictures_number - 1; i >= 0; i--) {
616
+ if(images.attr('height') === undefined) {
617
+ return false;
618
+ };
619
+ };
620
+
621
+ return true;
622
+ }
623
+
624
+ if (unloaded === 0 || pictures_has_height(images)) {
625
+ callback(images);
626
+ }
627
+
628
+ images.each(function () {
629
+ single_image_loaded(self.S(this), function () {
630
+ unloaded -= 1;
631
+ if (unloaded === 0) {
632
+ callback(images);
633
+ }
634
+ });
635
+ });
636
+ },
637
+
638
+ // Description:
639
+ // Returns a random, alphanumeric string
640
+ //
641
+ // Arguments:
642
+ // Length (Integer): Length of string to be generated. Defaults to random
643
+ // integer.
644
+ //
645
+ // Returns:
646
+ // Rand (String): Pseudo-random, alphanumeric string.
647
+ random_str : function () {
648
+ if (!this.fidx) {
649
+ this.fidx = 0;
650
+ }
651
+ this.prefix = this.prefix || [(this.name || 'F'), (+new Date).toString(36)].join('-');
652
+
653
+ return this.prefix + (this.fidx++).toString(36);
654
+ },
655
+
656
+ // Description:
657
+ // Helper for window.matchMedia
658
+ //
659
+ // Arguments:
660
+ // mq (String): Media query
661
+ //
662
+ // Returns:
663
+ // (Boolean): Whether the media query passes or not
664
+ match : function (mq) {
665
+ return window.matchMedia(mq).matches;
666
+ },
667
+
668
+ // Description:
669
+ // Helpers for checking Foundation default media queries with JS
670
+ //
671
+ // Returns:
672
+ // (Boolean): Whether the media query passes or not
673
+
674
+ is_small_up : function () {
675
+ return this.match(Foundation.media_queries.small);
676
+ },
677
+
678
+ is_medium_up : function () {
679
+ return this.match(Foundation.media_queries.medium);
680
+ },
681
+
682
+ is_large_up : function () {
683
+ return this.match(Foundation.media_queries.large);
684
+ },
685
+
686
+ is_xlarge_up : function () {
687
+ return this.match(Foundation.media_queries.xlarge);
688
+ },
689
+
690
+ is_xxlarge_up : function () {
691
+ return this.match(Foundation.media_queries.xxlarge);
692
+ },
693
+
694
+ is_small_only : function () {
695
+ return !this.is_medium_up() && !this.is_large_up() && !this.is_xlarge_up() && !this.is_xxlarge_up();
696
+ },
697
+
698
+ is_medium_only : function () {
699
+ return this.is_medium_up() && !this.is_large_up() && !this.is_xlarge_up() && !this.is_xxlarge_up();
700
+ },
701
+
702
+ is_large_only : function () {
703
+ return this.is_medium_up() && this.is_large_up() && !this.is_xlarge_up() && !this.is_xxlarge_up();
704
+ },
705
+
706
+ is_xlarge_only : function () {
707
+ return this.is_medium_up() && this.is_large_up() && this.is_xlarge_up() && !this.is_xxlarge_up();
708
+ },
709
+
710
+ is_xxlarge_only : function () {
711
+ return this.is_medium_up() && this.is_large_up() && this.is_xlarge_up() && this.is_xxlarge_up();
712
+ }
713
+ }
714
+ };
715
+
716
+ $.fn.foundation = function () {
717
+ var args = Array.prototype.slice.call(arguments, 0);
718
+
719
+ return this.each(function () {
720
+ Foundation.init.apply(Foundation, [this].concat(args));
721
+ return this;
722
+ });
723
+ };
724
+
725
+ }(jQuery, window, window.document));