aml 0.1.3.2 → 0.1.3.3

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