que-web 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/Gemfile +3 -0
  4. data/LICENSE.txt +28 -0
  5. data/README.md +40 -0
  6. data/Rakefile +7 -0
  7. data/doc/queweb.png +0 -0
  8. data/examples/rack/Gemfile +5 -0
  9. data/examples/rack/Gemfile.lock +29 -0
  10. data/examples/rack/boot.rb +34 -0
  11. data/examples/rack/config.ru +39 -0
  12. data/lib/que/web/version.rb +0 -0
  13. data/lib/que/web/viewmodels/dashboard.rb +21 -0
  14. data/lib/que/web/viewmodels/job.rb +14 -0
  15. data/lib/que/web/viewmodels/job_list.rb +29 -0
  16. data/lib/que/web/viewmodels.rb +3 -0
  17. data/lib/que/web.rb +48 -0
  18. data/que-web.gemspec +26 -0
  19. data/spec/spec_helper.rb +17 -0
  20. data/spec/viewmodels/dashboard_spec.rb +25 -0
  21. data/spec/viewmodels/job_list_spec.rb +49 -0
  22. data/spec/viewmodels/job_spec.rb +19 -0
  23. data/web/public/fonts/FontAwesome.otf +0 -0
  24. data/web/public/fonts/fontawesome-webfont.eot +0 -0
  25. data/web/public/fonts/fontawesome-webfont.svg +520 -0
  26. data/web/public/fonts/fontawesome-webfont.ttf +0 -0
  27. data/web/public/fonts/fontawesome-webfont.woff +0 -0
  28. data/web/public/js/foundation.min.js +3651 -0
  29. data/web/public/js/vendor/fastclick.js +9 -0
  30. data/web/public/js/vendor/jquery.cookie.js +8 -0
  31. data/web/public/js/vendor/jquery.js +26 -0
  32. data/web/public/js/vendor/modernizr.js +8 -0
  33. data/web/public/js/vendor/placeholder.js +2 -0
  34. data/web/public/styles/application.css +55 -0
  35. data/web/public/styles/font-awesome.min.css +4 -0
  36. data/web/public/styles/foundation.min.css +1 -0
  37. data/web/public/styles/normalize.css +427 -0
  38. data/web/views/_footer.erb +10 -0
  39. data/web/views/_navbar.erb +14 -0
  40. data/web/views/failing.erb +41 -0
  41. data/web/views/index.erb +37 -0
  42. data/web/views/layout.erb +14 -0
  43. metadata +145 -0
@@ -0,0 +1,3651 @@
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.4.7',
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
+ S(window).load(function(){
320
+ S(window)
321
+ .trigger('resize.fndtn.clearing')
322
+ .trigger('resize.fndtn.dropdown')
323
+ .trigger('resize.fndtn.equalizer')
324
+ .trigger('resize.fndtn.interchange')
325
+ .trigger('resize.fndtn.joyride')
326
+ .trigger('resize.fndtn.magellan')
327
+ .trigger('resize.fndtn.topbar')
328
+ .trigger('resize.fndtn.slider');
329
+ });
330
+
331
+ return scope;
332
+ },
333
+
334
+ init_lib : function (lib, args) {
335
+ if (this.libs.hasOwnProperty(lib)) {
336
+ this.patch(this.libs[lib]);
337
+
338
+ if (args && args.hasOwnProperty(lib)) {
339
+ if (typeof this.libs[lib].settings !== 'undefined') {
340
+ $.extend(true, this.libs[lib].settings, args[lib]);
341
+ }
342
+ else if (typeof this.libs[lib].defaults !== 'undefined') {
343
+ $.extend(true, this.libs[lib].defaults, args[lib]);
344
+ }
345
+ return this.libs[lib].init.apply(this.libs[lib], [this.scope, args[lib]]);
346
+ }
347
+
348
+ args = args instanceof Array ? args : new Array(args); // PATCH: added this line
349
+ return this.libs[lib].init.apply(this.libs[lib], args);
350
+ }
351
+
352
+ return function () {};
353
+ },
354
+
355
+ patch : function (lib) {
356
+ lib.scope = this.scope;
357
+ lib.namespace = this.global.namespace;
358
+ lib.rtl = this.rtl;
359
+ lib['data_options'] = this.utils.data_options;
360
+ lib['attr_name'] = attr_name;
361
+ lib['add_namespace'] = add_namespace;
362
+ lib['bindings'] = bindings;
363
+ lib['S'] = this.utils.S;
364
+ },
365
+
366
+ inherit : function (scope, methods) {
367
+ var methods_arr = methods.split(' '),
368
+ i = methods_arr.length;
369
+
370
+ while (i--) {
371
+ if (this.utils.hasOwnProperty(methods_arr[i])) {
372
+ scope[methods_arr[i]] = this.utils[methods_arr[i]];
373
+ }
374
+ }
375
+ },
376
+
377
+ set_namespace: function () {
378
+
379
+ // Description:
380
+ // Don't bother reading the namespace out of the meta tag
381
+ // if the namespace has been set globally in javascript
382
+ //
383
+ // Example:
384
+ // Foundation.global.namespace = 'my-namespace';
385
+ // or make it an empty string:
386
+ // Foundation.global.namespace = '';
387
+ //
388
+ //
389
+
390
+ // If the namespace has not been set (is undefined), try to read it out of the meta element.
391
+ // Otherwise use the globally defined namespace, even if it's empty ('')
392
+ var namespace = ( this.global.namespace === undefined ) ? $('.foundation-data-attribute-namespace').css('font-family') : this.global.namespace;
393
+
394
+ // Finally, if the namsepace is either undefined or false, set it to an empty string.
395
+ // Otherwise use the namespace value.
396
+ this.global.namespace = ( namespace === undefined || /false/i.test(namespace) ) ? '' : namespace;
397
+ },
398
+
399
+ libs : {},
400
+
401
+ // methods that can be inherited in libraries
402
+ utils : {
403
+
404
+ // Description:
405
+ // Fast Selector wrapper returns jQuery object. Only use where getElementById
406
+ // is not available.
407
+ //
408
+ // Arguments:
409
+ // Selector (String): CSS selector describing the element(s) to be
410
+ // returned as a jQuery object.
411
+ //
412
+ // Scope (String): CSS selector describing the area to be searched. Default
413
+ // is document.
414
+ //
415
+ // Returns:
416
+ // Element (jQuery Object): jQuery object containing elements matching the
417
+ // selector within the scope.
418
+ S : S,
419
+
420
+ // Description:
421
+ // Executes a function a max of once every n milliseconds
422
+ //
423
+ // Arguments:
424
+ // Func (Function): Function to be throttled.
425
+ //
426
+ // Delay (Integer): Function execution threshold in milliseconds.
427
+ //
428
+ // Returns:
429
+ // Lazy_function (Function): Function with throttling applied.
430
+ throttle : function (func, delay) {
431
+ var timer = null;
432
+
433
+ return function () {
434
+ var context = this, args = arguments;
435
+
436
+ if (timer == null) {
437
+ timer = setTimeout(function () {
438
+ func.apply(context, args);
439
+ timer = null;
440
+ }, delay);
441
+ }
442
+ };
443
+ },
444
+
445
+ // Description:
446
+ // Executes a function when it stops being invoked for n seconds
447
+ // Modified version of _.debounce() http://underscorejs.org
448
+ //
449
+ // Arguments:
450
+ // Func (Function): Function to be debounced.
451
+ //
452
+ // Delay (Integer): Function execution threshold in milliseconds.
453
+ //
454
+ // Immediate (Bool): Whether the function should be called at the beginning
455
+ // of the delay instead of the end. Default is false.
456
+ //
457
+ // Returns:
458
+ // Lazy_function (Function): Function with debouncing applied.
459
+ debounce : function (func, delay, immediate) {
460
+ var timeout, result;
461
+ return function () {
462
+ var context = this, args = arguments;
463
+ var later = function () {
464
+ timeout = null;
465
+ if (!immediate) result = func.apply(context, args);
466
+ };
467
+ var callNow = immediate && !timeout;
468
+ clearTimeout(timeout);
469
+ timeout = setTimeout(later, delay);
470
+ if (callNow) result = func.apply(context, args);
471
+ return result;
472
+ };
473
+ },
474
+
475
+ // Description:
476
+ // Parses data-options attribute
477
+ //
478
+ // Arguments:
479
+ // El (jQuery Object): Element to be parsed.
480
+ //
481
+ // Returns:
482
+ // Options (Javascript Object): Contents of the element's data-options
483
+ // attribute.
484
+ data_options : function (el, data_attr_name) {
485
+ data_attr_name = data_attr_name || 'options';
486
+ var opts = {}, ii, p, opts_arr,
487
+ data_options = function (el) {
488
+ var namespace = Foundation.global.namespace;
489
+
490
+ if (namespace.length > 0) {
491
+ return el.data(namespace + '-' + data_attr_name);
492
+ }
493
+
494
+ return el.data(data_attr_name);
495
+ };
496
+
497
+ var cached_options = data_options(el);
498
+
499
+ if (typeof cached_options === 'object') {
500
+ return cached_options;
501
+ }
502
+
503
+ opts_arr = (cached_options || ':').split(';');
504
+ ii = opts_arr.length;
505
+
506
+ function isNumber (o) {
507
+ return ! isNaN (o-0) && o !== null && o !== "" && o !== false && o !== true;
508
+ }
509
+
510
+ function trim (str) {
511
+ if (typeof str === 'string') return $.trim(str);
512
+ return str;
513
+ }
514
+
515
+ while (ii--) {
516
+ p = opts_arr[ii].split(':');
517
+ p = [p[0], p.slice(1).join(':')];
518
+
519
+ if (/true/i.test(p[1])) p[1] = true;
520
+ if (/false/i.test(p[1])) p[1] = false;
521
+ if (isNumber(p[1])) {
522
+ if (p[1].indexOf('.') === -1) {
523
+ p[1] = parseInt(p[1], 10);
524
+ } else {
525
+ p[1] = parseFloat(p[1]);
526
+ }
527
+ }
528
+
529
+ if (p.length === 2 && p[0].length > 0) {
530
+ opts[trim(p[0])] = trim(p[1]);
531
+ }
532
+ }
533
+
534
+ return opts;
535
+ },
536
+
537
+ // Description:
538
+ // Adds JS-recognizable media queries
539
+ //
540
+ // Arguments:
541
+ // Media (String): Key string for the media query to be stored as in
542
+ // Foundation.media_queries
543
+ //
544
+ // Class (String): Class name for the generated <meta> tag
545
+ register_media : function (media, media_class) {
546
+ if(Foundation.media_queries[media] === undefined) {
547
+ $('head').append('<meta class="' + media_class + '"/>');
548
+ Foundation.media_queries[media] = removeQuotes($('.' + media_class).css('font-family'));
549
+ }
550
+ },
551
+
552
+ // Description:
553
+ // Add custom CSS within a JS-defined media query
554
+ //
555
+ // Arguments:
556
+ // Rule (String): CSS rule to be appended to the document.
557
+ //
558
+ // Media (String): Optional media query string for the CSS rule to be
559
+ // nested under.
560
+ add_custom_rule : function (rule, media) {
561
+ if (media === undefined && Foundation.stylesheet) {
562
+ Foundation.stylesheet.insertRule(rule, Foundation.stylesheet.cssRules.length);
563
+ } else {
564
+ var query = Foundation.media_queries[media];
565
+
566
+ if (query !== undefined) {
567
+ Foundation.stylesheet.insertRule('@media ' +
568
+ Foundation.media_queries[media] + '{ ' + rule + ' }');
569
+ }
570
+ }
571
+ },
572
+
573
+ // Description:
574
+ // Performs a callback function when an image is fully loaded
575
+ //
576
+ // Arguments:
577
+ // Image (jQuery Object): Image(s) to check if loaded.
578
+ //
579
+ // Callback (Function): Function to execute when image is fully loaded.
580
+ image_loaded : function (images, callback) {
581
+ var self = this,
582
+ unloaded = images.length;
583
+
584
+ if (unloaded === 0) {
585
+ callback(images);
586
+ }
587
+
588
+ images.each(function () {
589
+ single_image_loaded(self.S(this), function () {
590
+ unloaded -= 1;
591
+ if (unloaded === 0) {
592
+ callback(images);
593
+ }
594
+ });
595
+ });
596
+ },
597
+
598
+ // Description:
599
+ // Returns a random, alphanumeric string
600
+ //
601
+ // Arguments:
602
+ // Length (Integer): Length of string to be generated. Defaults to random
603
+ // integer.
604
+ //
605
+ // Returns:
606
+ // Rand (String): Pseudo-random, alphanumeric string.
607
+ random_str : function () {
608
+ if (!this.fidx) this.fidx = 0;
609
+ this.prefix = this.prefix || [(this.name || 'F'), (+new Date).toString(36)].join('-');
610
+
611
+ return this.prefix + (this.fidx++).toString(36);
612
+ }
613
+ }
614
+ };
615
+
616
+ $.fn.foundation = function () {
617
+ var args = Array.prototype.slice.call(arguments, 0);
618
+
619
+ return this.each(function () {
620
+ Foundation.init.apply(Foundation, [this].concat(args));
621
+ return this;
622
+ });
623
+ };
624
+
625
+ }(jQuery, window, window.document));
626
+ ;(function ($, window, document, undefined) {
627
+ 'use strict';
628
+
629
+ Foundation.libs.abide = {
630
+ name : 'abide',
631
+
632
+ version : '5.4.7',
633
+
634
+ settings : {
635
+ live_validate : true,
636
+ focus_on_invalid : true,
637
+ error_labels: true, // labels with a for="inputId" will recieve an `error` class
638
+ error_class: 'error',
639
+ timeout : 1000,
640
+ patterns : {
641
+ alpha: /^[a-zA-Z]+$/,
642
+ alpha_numeric : /^[a-zA-Z0-9]+$/,
643
+ integer: /^[-+]?\d+$/,
644
+ number: /^[-+]?\d*(?:[\.\,]\d+)?$/,
645
+
646
+ // amex, visa, diners
647
+ card : /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,
648
+ cvv : /^([0-9]){3,4}$/,
649
+
650
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address
651
+ email : /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/,
652
+
653
+ url: /^(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/,
654
+ // abc.de
655
+ domain: /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/,
656
+
657
+ datetime: /^([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))$/,
658
+ // YYYY-MM-DD
659
+ date: /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))$/,
660
+ // HH:MM:SS
661
+ time : /^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/,
662
+ dateISO: /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/,
663
+ // MM/DD/YYYY
664
+ month_day_year : /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/,
665
+ // DD/MM/YYYY
666
+ day_month_year : /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/,
667
+
668
+ // #FFF or #FFFFFF
669
+ color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/
670
+ },
671
+ validators : {
672
+ equalTo: function(el, required, parent) {
673
+ var from = document.getElementById(el.getAttribute(this.add_namespace('data-equalto'))).value,
674
+ to = el.value,
675
+ valid = (from === to);
676
+
677
+ return valid;
678
+ }
679
+ }
680
+ },
681
+
682
+ timer : null,
683
+
684
+ init : function (scope, method, options) {
685
+ this.bindings(method, options);
686
+ },
687
+
688
+ events : function (scope) {
689
+ var self = this,
690
+ form = self.S(scope).attr('novalidate', 'novalidate'),
691
+ settings = form.data(this.attr_name(true) + '-init') || {};
692
+
693
+ this.invalid_attr = this.add_namespace('data-invalid');
694
+
695
+ form
696
+ .off('.abide')
697
+ .on('submit.fndtn.abide validate.fndtn.abide', function (e) {
698
+ var is_ajax = /ajax/i.test(self.S(this).attr(self.attr_name()));
699
+ return self.validate(self.S(this).find('input, textarea, select').get(), e, is_ajax);
700
+ })
701
+ .on('reset', function() {
702
+ return self.reset($(this));
703
+ })
704
+ .find('input, textarea, select')
705
+ .off('.abide')
706
+ .on('blur.fndtn.abide change.fndtn.abide', function (e) {
707
+ self.validate([this], e);
708
+ })
709
+ .on('keydown.fndtn.abide', function (e) {
710
+ if (settings.live_validate === true) {
711
+ clearTimeout(self.timer);
712
+ self.timer = setTimeout(function () {
713
+ self.validate([this], e);
714
+ }.bind(this), settings.timeout);
715
+ }
716
+ });
717
+ },
718
+
719
+ reset : function (form) {
720
+ form.removeAttr(this.invalid_attr);
721
+ $(this.invalid_attr, form).removeAttr(this.invalid_attr);
722
+ $('.' + this.settings.error_class, form).not('small').removeClass(this.settings.error_class);
723
+ },
724
+
725
+ validate : function (els, e, is_ajax) {
726
+ var validations = this.parse_patterns(els),
727
+ validation_count = validations.length,
728
+ form = this.S(els[0]).closest('form'),
729
+ submit_event = /submit/.test(e.type);
730
+
731
+ // Has to count up to make sure the focus gets applied to the top error
732
+ for (var i=0; i < validation_count; i++) {
733
+ if (!validations[i] && (submit_event || is_ajax)) {
734
+ if (this.settings.focus_on_invalid) els[i].focus();
735
+ form.trigger('invalid');
736
+ this.S(els[i]).closest('form').attr(this.invalid_attr, '');
737
+ return false;
738
+ }
739
+ }
740
+
741
+ if (submit_event || is_ajax) {
742
+ form.trigger('valid');
743
+ }
744
+
745
+ form.removeAttr(this.invalid_attr);
746
+
747
+ if (is_ajax) return false;
748
+
749
+ return true;
750
+ },
751
+
752
+ parse_patterns : function (els) {
753
+ var i = els.length,
754
+ el_patterns = [];
755
+
756
+ while (i--) {
757
+ el_patterns.push(this.pattern(els[i]));
758
+ }
759
+
760
+ return this.check_validation_and_apply_styles(el_patterns);
761
+ },
762
+
763
+ pattern : function (el) {
764
+ var type = el.getAttribute('type'),
765
+ required = typeof el.getAttribute('required') === 'string';
766
+
767
+ var pattern = el.getAttribute('pattern') || '';
768
+
769
+ if (this.settings.patterns.hasOwnProperty(pattern) && pattern.length > 0) {
770
+ return [el, this.settings.patterns[pattern], required];
771
+ } else if (pattern.length > 0) {
772
+ return [el, new RegExp(pattern), required];
773
+ }
774
+
775
+ if (this.settings.patterns.hasOwnProperty(type)) {
776
+ return [el, this.settings.patterns[type], required];
777
+ }
778
+
779
+ pattern = /.*/;
780
+
781
+ return [el, pattern, required];
782
+ },
783
+
784
+ check_validation_and_apply_styles : function (el_patterns) {
785
+ var i = el_patterns.length,
786
+ validations = [],
787
+ form = this.S(el_patterns[0][0]).closest('[data-' + this.attr_name(true) + ']'),
788
+ settings = form.data(this.attr_name(true) + '-init') || {};
789
+ while (i--) {
790
+ var el = el_patterns[i][0],
791
+ required = el_patterns[i][2],
792
+ value = el.value.trim(),
793
+ direct_parent = this.S(el).parent(),
794
+ validator = el.getAttribute(this.add_namespace('data-abide-validator')),
795
+ is_radio = el.type === "radio",
796
+ is_checkbox = el.type === "checkbox",
797
+ label = this.S('label[for="' + el.getAttribute('id') + '"]'),
798
+ valid_length = (required) ? (el.value.length > 0) : true,
799
+ el_validations = [];
800
+
801
+ var parent, valid;
802
+
803
+ // support old way to do equalTo validations
804
+ if(el.getAttribute(this.add_namespace('data-equalto'))) { validator = "equalTo" }
805
+
806
+ if (!direct_parent.is('label')) {
807
+ parent = direct_parent;
808
+ } else {
809
+ parent = direct_parent.parent();
810
+ }
811
+
812
+ if (validator) {
813
+ valid = this.settings.validators[validator].apply(this, [el, required, parent]);
814
+ el_validations.push(valid);
815
+ }
816
+
817
+ if (is_radio && required) {
818
+ el_validations.push(this.valid_radio(el, required));
819
+ } else if (is_checkbox && required) {
820
+ el_validations.push(this.valid_checkbox(el, required));
821
+ } else {
822
+
823
+ if (el_patterns[i][1].test(value) && valid_length ||
824
+ !required && el.value.length < 1 || $(el).attr('disabled')) {
825
+ el_validations.push(true);
826
+ } else {
827
+ el_validations.push(false);
828
+ }
829
+
830
+ el_validations = [el_validations.every(function(valid){return valid;})];
831
+
832
+ if(el_validations[0]){
833
+ this.S(el).removeAttr(this.invalid_attr);
834
+ el.setAttribute('aria-invalid', 'false');
835
+ el.removeAttribute('aria-describedby');
836
+ parent.removeClass(this.settings.error_class);
837
+ if (label.length > 0 && this.settings.error_labels) {
838
+ label.removeClass(this.settings.error_class).removeAttr('role');
839
+ }
840
+ $(el).triggerHandler('valid');
841
+ } else {
842
+ this.S(el).attr(this.invalid_attr, '');
843
+ el.setAttribute('aria-invalid', 'true');
844
+
845
+ // Try to find the error associated with the input
846
+ var errorElem = parent.find('small.'+this.settings.error_class, 'span.'+this.settings.error_class);
847
+ var errorID = errorElem.length > 0 ? errorElem[0].id : "";
848
+ if (errorID.length > 0) el.setAttribute('aria-describedby', errorID);
849
+
850
+ // el.setAttribute('aria-describedby', $(el).find('.error')[0].id);
851
+ parent.addClass(this.settings.error_class);
852
+ if (label.length > 0 && this.settings.error_labels) {
853
+ label.addClass(this.settings.error_class).attr('role', 'alert');
854
+ }
855
+ $(el).triggerHandler('invalid');
856
+ }
857
+ }
858
+ validations.push(el_validations[0]);
859
+ }
860
+ validations = [validations.every(function(valid){return valid;})];
861
+ return validations;
862
+ },
863
+
864
+ valid_checkbox : function(el, required) {
865
+ var el = this.S(el),
866
+ valid = (el.is(':checked') || !required);
867
+
868
+ if (valid) {
869
+ el.removeAttr(this.invalid_attr).parent().removeClass(this.settings.error_class);
870
+ } else {
871
+ el.attr(this.invalid_attr, '').parent().addClass(this.settings.error_class);
872
+ }
873
+
874
+ return valid;
875
+ },
876
+
877
+ valid_radio : function (el, required) {
878
+ var name = el.getAttribute('name'),
879
+ group = this.S(el).closest('[data-' + this.attr_name(true) + ']').find("[name='"+name+"']"),
880
+ count = group.length,
881
+ valid = false;
882
+
883
+ // Has to count up to make sure the focus gets applied to the top error
884
+ for (var i=0; i < count; i++) {
885
+ if (group[i].checked) valid = true;
886
+ }
887
+
888
+ // Has to count up to make sure the focus gets applied to the top error
889
+ for (var i=0; i < count; i++) {
890
+ if (valid) {
891
+ this.S(group[i]).removeAttr(this.invalid_attr).parent().removeClass(this.settings.error_class);
892
+ } else {
893
+ this.S(group[i]).attr(this.invalid_attr, '').parent().addClass(this.settings.error_class);
894
+ }
895
+ }
896
+
897
+ return valid;
898
+ },
899
+
900
+ valid_equal: function(el, required, parent) {
901
+ var from = document.getElementById(el.getAttribute(this.add_namespace('data-equalto'))).value,
902
+ to = el.value,
903
+ valid = (from === to);
904
+
905
+ if (valid) {
906
+ this.S(el).removeAttr(this.invalid_attr);
907
+ parent.removeClass(this.settings.error_class);
908
+ if (label.length > 0 && settings.error_labels) label.removeClass(this.settings.error_class);
909
+ } else {
910
+ this.S(el).attr(this.invalid_attr, '');
911
+ parent.addClass(this.settings.error_class);
912
+ if (label.length > 0 && settings.error_labels) label.addClass(this.settings.error_class);
913
+ }
914
+
915
+ return valid;
916
+ },
917
+
918
+ valid_oneof: function(el, required, parent, doNotValidateOthers) {
919
+ var el = this.S(el),
920
+ others = this.S('[' + this.add_namespace('data-oneof') + ']'),
921
+ valid = others.filter(':checked').length > 0;
922
+
923
+ if (valid) {
924
+ el.removeAttr(this.invalid_attr).parent().removeClass(this.settings.error_class);
925
+ } else {
926
+ el.attr(this.invalid_attr, '').parent().addClass(this.settings.error_class);
927
+ }
928
+
929
+ if (!doNotValidateOthers) {
930
+ var _this = this;
931
+ others.each(function() {
932
+ _this.valid_oneof.call(_this, this, null, null, true);
933
+ });
934
+ }
935
+
936
+ return valid;
937
+ }
938
+ };
939
+ }(jQuery, window, window.document));
940
+ ;(function ($, window, document, undefined) {
941
+ 'use strict';
942
+
943
+ Foundation.libs.equalizer = {
944
+ name : 'equalizer',
945
+
946
+ version : '5.4.7',
947
+
948
+ settings : {
949
+ use_tallest: true,
950
+ before_height_change: $.noop,
951
+ after_height_change: $.noop,
952
+ equalize_on_stack: false
953
+ },
954
+
955
+ init : function (scope, method, options) {
956
+ Foundation.inherit(this, 'image_loaded');
957
+ this.bindings(method, options);
958
+ this.reflow();
959
+ },
960
+
961
+ events : function () {
962
+ this.S(window).off('.equalizer').on('resize.fndtn.equalizer', function(e){
963
+ this.reflow();
964
+ }.bind(this));
965
+ },
966
+
967
+ equalize: function(equalizer) {
968
+ var isStacked = false,
969
+ vals = equalizer.find('[' + this.attr_name() + '-watch]:visible'),
970
+ settings = equalizer.data(this.attr_name(true)+'-init');
971
+
972
+ if (vals.length === 0) return;
973
+ var firstTopOffset = vals.first().offset().top;
974
+ settings.before_height_change();
975
+ equalizer.trigger('before-height-change').trigger('before-height-change.fndth.equalizer');
976
+ vals.height('inherit');
977
+ vals.each(function(){
978
+ var el = $(this);
979
+ if (el.offset().top !== firstTopOffset) {
980
+ isStacked = true;
981
+ }
982
+ });
983
+
984
+ if (settings.equalize_on_stack === false) {
985
+ if (isStacked) return;
986
+ };
987
+
988
+ var heights = vals.map(function(){ return $(this).outerHeight(false) }).get();
989
+
990
+ if (settings.use_tallest) {
991
+ var max = Math.max.apply(null, heights);
992
+ vals.css('height', max);
993
+ } else {
994
+ var min = Math.min.apply(null, heights);
995
+ vals.css('height', min);
996
+ }
997
+ settings.after_height_change();
998
+ equalizer.trigger('after-height-change').trigger('after-height-change.fndtn.equalizer');
999
+ },
1000
+
1001
+ reflow : function () {
1002
+ var self = this;
1003
+
1004
+ this.S('[' + this.attr_name() + ']', this.scope).each(function(){
1005
+ var $eq_target = $(this);
1006
+ self.image_loaded(self.S('img', this), function(){
1007
+ self.equalize($eq_target)
1008
+ });
1009
+ });
1010
+ }
1011
+ };
1012
+ })(jQuery, window, window.document);
1013
+
1014
+ ;(function ($, window, document, undefined) {
1015
+ 'use strict';
1016
+
1017
+ Foundation.libs.dropdown = {
1018
+ name : 'dropdown',
1019
+
1020
+ version : '5.4.7',
1021
+
1022
+ settings : {
1023
+ active_class: 'open',
1024
+ disabled_class: 'disabled',
1025
+ mega_class: 'mega',
1026
+ align: 'bottom',
1027
+ is_hover: false,
1028
+ opened: function(){},
1029
+ closed: function(){}
1030
+ },
1031
+
1032
+ init : function (scope, method, options) {
1033
+ Foundation.inherit(this, 'throttle');
1034
+
1035
+ this.bindings(method, options);
1036
+ },
1037
+
1038
+ events : function (scope) {
1039
+ var self = this,
1040
+ S = self.S;
1041
+
1042
+ S(this.scope)
1043
+ .off('.dropdown')
1044
+ .on('click.fndtn.dropdown', '[' + this.attr_name() + ']', function (e) {
1045
+ var settings = S(this).data(self.attr_name(true) + '-init') || self.settings;
1046
+ if (!settings.is_hover || Modernizr.touch) {
1047
+ e.preventDefault();
1048
+ self.toggle($(this));
1049
+ }
1050
+ })
1051
+ .on('mouseenter.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
1052
+ var $this = S(this),
1053
+ dropdown,
1054
+ target;
1055
+
1056
+ clearTimeout(self.timeout);
1057
+
1058
+ if ($this.data(self.data_attr())) {
1059
+ dropdown = S('#' + $this.data(self.data_attr()));
1060
+ target = $this;
1061
+ } else {
1062
+ dropdown = $this;
1063
+ target = S("[" + self.attr_name() + "='" + dropdown.attr('id') + "']");
1064
+ }
1065
+
1066
+ var settings = target.data(self.attr_name(true) + '-init') || self.settings;
1067
+
1068
+ if(S(e.target).data(self.data_attr()) && settings.is_hover) {
1069
+ self.closeall.call(self);
1070
+ }
1071
+
1072
+ if (settings.is_hover) self.open.apply(self, [dropdown, target]);
1073
+ })
1074
+ .on('mouseleave.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
1075
+ var $this = S(this);
1076
+ self.timeout = setTimeout(function () {
1077
+ if ($this.data(self.data_attr())) {
1078
+ var settings = $this.data(self.data_attr(true) + '-init') || self.settings;
1079
+ if (settings.is_hover) self.close.call(self, S('#' + $this.data(self.data_attr())));
1080
+ } else {
1081
+ var target = S('[' + self.attr_name() + '="' + S(this).attr('id') + '"]'),
1082
+ settings = target.data(self.attr_name(true) + '-init') || self.settings;
1083
+ if (settings.is_hover) self.close.call(self, $this);
1084
+ }
1085
+ }.bind(this), 150);
1086
+ })
1087
+ .on('click.fndtn.dropdown', function (e) {
1088
+ var parent = S(e.target).closest('[' + self.attr_name() + '-content]');
1089
+
1090
+ if (S(e.target).closest('[' + self.attr_name() + ']').length > 0) {
1091
+ return;
1092
+ }
1093
+ if (!(S(e.target).data('revealId')) &&
1094
+ (parent.length > 0 && (S(e.target).is('[' + self.attr_name() + '-content]') ||
1095
+ $.contains(parent.first()[0], e.target)))) {
1096
+ e.stopPropagation();
1097
+ return;
1098
+ }
1099
+
1100
+ self.close.call(self, S('[' + self.attr_name() + '-content]'));
1101
+ })
1102
+ .on('opened.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () {
1103
+ self.settings.opened.call(this);
1104
+ })
1105
+ .on('closed.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () {
1106
+ self.settings.closed.call(this);
1107
+ });
1108
+
1109
+ S(window)
1110
+ .off('.dropdown')
1111
+ .on('resize.fndtn.dropdown', self.throttle(function () {
1112
+ self.resize.call(self);
1113
+ }, 50));
1114
+
1115
+ this.resize();
1116
+ },
1117
+
1118
+ close: function (dropdown) {
1119
+ var self = this;
1120
+ dropdown.each(function () {
1121
+ var original_target = $('[' + self.attr_name() + '=' + dropdown[0].id + ']') || $('aria-controls=' + dropdown[0].id+ ']');
1122
+ original_target.attr('aria-expanded', "false");
1123
+ if (self.S(this).hasClass(self.settings.active_class)) {
1124
+ self.S(this)
1125
+ .css(Foundation.rtl ? 'right':'left', '-99999px')
1126
+ .attr('aria-hidden', "true")
1127
+ .removeClass(self.settings.active_class)
1128
+ .prev('[' + self.attr_name() + ']')
1129
+ .removeClass(self.settings.active_class)
1130
+ .removeData('target');
1131
+
1132
+ self.S(this).trigger('closed').trigger('closed.fndtn.dropdown', [dropdown]);
1133
+ }
1134
+ });
1135
+ },
1136
+
1137
+ closeall: function() {
1138
+ var self = this;
1139
+ $.each(self.S('[' + this.attr_name() + '-content]'), function() {
1140
+ self.close.call(self, self.S(this));
1141
+ });
1142
+ },
1143
+
1144
+ open: function (dropdown, target) {
1145
+ this
1146
+ .css(dropdown
1147
+ .addClass(this.settings.active_class), target);
1148
+ dropdown.prev('[' + this.attr_name() + ']').addClass(this.settings.active_class);
1149
+ dropdown.data('target', target.get(0)).trigger('opened').trigger('opened.fndtn.dropdown', [dropdown, target]);
1150
+ dropdown.attr('aria-hidden', 'false');
1151
+ target.attr('aria-expanded', 'true');
1152
+ dropdown.focus();
1153
+ },
1154
+
1155
+ data_attr: function () {
1156
+ if (this.namespace.length > 0) {
1157
+ return this.namespace + '-' + this.name;
1158
+ }
1159
+
1160
+ return this.name;
1161
+ },
1162
+
1163
+ toggle : function (target) {
1164
+ if (target.hasClass(this.settings.disabled_class)) {
1165
+ return;
1166
+ }
1167
+ var dropdown = this.S('#' + target.data(this.data_attr()));
1168
+ if (dropdown.length === 0) {
1169
+ // No dropdown found, not continuing
1170
+ return;
1171
+ }
1172
+
1173
+ this.close.call(this, this.S('[' + this.attr_name() + '-content]').not(dropdown));
1174
+
1175
+ if (dropdown.hasClass(this.settings.active_class)) {
1176
+ this.close.call(this, dropdown);
1177
+ if (dropdown.data('target') !== target.get(0))
1178
+ this.open.call(this, dropdown, target);
1179
+ } else {
1180
+ this.open.call(this, dropdown, target);
1181
+ }
1182
+ },
1183
+
1184
+ resize : function () {
1185
+ var dropdown = this.S('[' + this.attr_name() + '-content].open'),
1186
+ target = this.S("[" + this.attr_name() + "='" + dropdown.attr('id') + "']");
1187
+
1188
+ if (dropdown.length && target.length) {
1189
+ this.css(dropdown, target);
1190
+ }
1191
+ },
1192
+
1193
+ css : function (dropdown, target) {
1194
+ var left_offset = Math.max((target.width() - dropdown.width()) / 2, 8),
1195
+ settings = target.data(this.attr_name(true) + '-init') || this.settings;
1196
+
1197
+ this.clear_idx();
1198
+
1199
+ if (this.small()) {
1200
+ var p = this.dirs.bottom.call(dropdown, target, settings);
1201
+
1202
+ dropdown.attr('style', '').removeClass('drop-left drop-right drop-top').css({
1203
+ position : 'absolute',
1204
+ width: '95%',
1205
+ 'max-width': 'none',
1206
+ top: p.top
1207
+ });
1208
+
1209
+ dropdown.css(Foundation.rtl ? 'right':'left', left_offset);
1210
+ } else {
1211
+
1212
+ this.style(dropdown, target, settings);
1213
+ }
1214
+
1215
+ return dropdown;
1216
+ },
1217
+
1218
+ style : function (dropdown, target, settings) {
1219
+ var css = $.extend({position: 'absolute'},
1220
+ this.dirs[settings.align].call(dropdown, target, settings));
1221
+
1222
+ dropdown.attr('style', '').css(css);
1223
+ },
1224
+
1225
+ // return CSS property object
1226
+ // `this` is the dropdown
1227
+ dirs : {
1228
+ // Calculate target offset
1229
+ _base : function (t) {
1230
+ var o_p = this.offsetParent(),
1231
+ o = o_p.offset(),
1232
+ p = t.offset();
1233
+
1234
+ p.top -= o.top;
1235
+ p.left -= o.left;
1236
+
1237
+ return p;
1238
+ },
1239
+ top: function (t, s) {
1240
+ var self = Foundation.libs.dropdown,
1241
+ p = self.dirs._base.call(this, t);
1242
+
1243
+ this.addClass('drop-top');
1244
+
1245
+ if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
1246
+ self.adjust_pip(this,t,s,p);
1247
+ }
1248
+
1249
+ if (Foundation.rtl) {
1250
+ return {left: p.left - this.outerWidth() + t.outerWidth(),
1251
+ top: p.top - this.outerHeight()};
1252
+ }
1253
+
1254
+ return {left: p.left, top: p.top - this.outerHeight()};
1255
+ },
1256
+ bottom: function (t,s) {
1257
+ var self = Foundation.libs.dropdown,
1258
+ p = self.dirs._base.call(this, t);
1259
+
1260
+ if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
1261
+ self.adjust_pip(this,t,s,p);
1262
+ }
1263
+
1264
+ if (self.rtl) {
1265
+ return {left: p.left - this.outerWidth() + t.outerWidth(), top: p.top + t.outerHeight()};
1266
+ }
1267
+
1268
+ return {left: p.left, top: p.top + t.outerHeight()};
1269
+ },
1270
+ left: function (t, s) {
1271
+ var p = Foundation.libs.dropdown.dirs._base.call(this, t);
1272
+
1273
+ this.addClass('drop-left');
1274
+
1275
+ return {left: p.left - this.outerWidth(), top: p.top};
1276
+ },
1277
+ right: function (t, s) {
1278
+ var p = Foundation.libs.dropdown.dirs._base.call(this, t);
1279
+
1280
+ this.addClass('drop-right');
1281
+
1282
+ return {left: p.left + t.outerWidth(), top: p.top};
1283
+ }
1284
+ },
1285
+
1286
+ // Insert rule to style psuedo elements
1287
+ adjust_pip : function (dropdown,target,settings,position) {
1288
+ var sheet = Foundation.stylesheet,
1289
+ pip_offset_base = 8;
1290
+
1291
+ if (dropdown.hasClass(settings.mega_class)) {
1292
+ pip_offset_base = position.left + (target.outerWidth()/2) - 8;
1293
+ }
1294
+ else if (this.small()) {
1295
+ pip_offset_base += position.left - 8;
1296
+ }
1297
+
1298
+ this.rule_idx = sheet.cssRules.length;
1299
+
1300
+ var sel_before = '.f-dropdown.open:before',
1301
+ sel_after = '.f-dropdown.open:after',
1302
+ css_before = 'left: ' + pip_offset_base + 'px;',
1303
+ css_after = 'left: ' + (pip_offset_base - 1) + 'px;';
1304
+
1305
+ if (sheet.insertRule) {
1306
+ sheet.insertRule([sel_before, '{', css_before, '}'].join(' '), this.rule_idx);
1307
+ sheet.insertRule([sel_after, '{', css_after, '}'].join(' '), this.rule_idx + 1);
1308
+ } else {
1309
+ sheet.addRule(sel_before, css_before, this.rule_idx);
1310
+ sheet.addRule(sel_after, css_after, this.rule_idx + 1);
1311
+ }
1312
+ },
1313
+
1314
+ // Remove old dropdown rule index
1315
+ clear_idx : function () {
1316
+ var sheet = Foundation.stylesheet;
1317
+
1318
+ if (typeof this.rule_idx !== 'undefined') {
1319
+ sheet.deleteRule(this.rule_idx);
1320
+ sheet.deleteRule(this.rule_idx);
1321
+ delete this.rule_idx;
1322
+ }
1323
+ },
1324
+
1325
+ small : function () {
1326
+ return matchMedia(Foundation.media_queries.small).matches &&
1327
+ !matchMedia(Foundation.media_queries.medium).matches;
1328
+ },
1329
+
1330
+ off: function () {
1331
+ this.S(this.scope).off('.fndtn.dropdown');
1332
+ this.S('html, body').off('.fndtn.dropdown');
1333
+ this.S(window).off('.fndtn.dropdown');
1334
+ this.S('[data-dropdown-content]').off('.fndtn.dropdown');
1335
+ },
1336
+
1337
+ reflow : function () {}
1338
+ };
1339
+ }(jQuery, window, window.document));
1340
+ ;(function ($, window, document, undefined) {
1341
+ 'use strict';
1342
+
1343
+ Foundation.libs.accordion = {
1344
+ name : 'accordion',
1345
+
1346
+ version : '5.4.7',
1347
+
1348
+ settings : {
1349
+ content_class: 'content',
1350
+ active_class: 'active',
1351
+ multi_expand: false,
1352
+ toggleable: true,
1353
+ callback : function () {}
1354
+ },
1355
+
1356
+ init : function (scope, method, options) {
1357
+ this.bindings(method, options);
1358
+ },
1359
+
1360
+ events : function () {
1361
+ var self = this;
1362
+ var S = this.S;
1363
+ S(this.scope)
1364
+ .off('.fndtn.accordion')
1365
+ .on('click.fndtn.accordion', '[' + this.attr_name() + '] > dd > a', function (e) {
1366
+ var accordion = S(this).closest('[' + self.attr_name() + ']'),
1367
+ groupSelector = self.attr_name() + '=' + accordion.attr(self.attr_name()),
1368
+ settings = accordion.data(self.attr_name(true) + '-init'),
1369
+ target = S('#' + this.href.split('#')[1]),
1370
+ aunts = $('> dd', accordion),
1371
+ siblings = aunts.children('.'+settings.content_class),
1372
+ active_content = siblings.filter('.' + settings.active_class);
1373
+ e.preventDefault();
1374
+
1375
+ if (accordion.attr(self.attr_name())) {
1376
+ siblings = siblings.add('[' + groupSelector + '] dd > .'+settings.content_class);
1377
+ aunts = aunts.add('[' + groupSelector + '] dd');
1378
+ }
1379
+
1380
+ if (settings.toggleable && target.is(active_content)) {
1381
+ target.parent('dd').toggleClass(settings.active_class, false);
1382
+ target.toggleClass(settings.active_class, false);
1383
+ settings.callback(target);
1384
+ target.triggerHandler('toggled', [accordion]);
1385
+ accordion.triggerHandler('toggled', [target]);
1386
+ return;
1387
+ }
1388
+
1389
+ if (!settings.multi_expand) {
1390
+ siblings.removeClass(settings.active_class);
1391
+ aunts.removeClass(settings.active_class);
1392
+ }
1393
+
1394
+ target.addClass(settings.active_class).parent().addClass(settings.active_class);
1395
+ settings.callback(target);
1396
+ target.triggerHandler('toggled', [accordion]);
1397
+ accordion.triggerHandler('toggled', [target]);
1398
+ });
1399
+ },
1400
+
1401
+ off : function () {},
1402
+
1403
+ reflow : function () {}
1404
+ };
1405
+ }(jQuery, window, window.document));
1406
+ ;(function ($, window, document, undefined) {
1407
+ 'use strict';
1408
+
1409
+ Foundation.libs.alert = {
1410
+ name : 'alert',
1411
+
1412
+ version : '5.4.7',
1413
+
1414
+ settings : {
1415
+ callback: function (){}
1416
+ },
1417
+
1418
+ init : function (scope, method, options) {
1419
+ this.bindings(method, options);
1420
+ },
1421
+
1422
+ events : function () {
1423
+ var self = this,
1424
+ S = this.S;
1425
+
1426
+ $(this.scope).off('.alert').on('click.fndtn.alert', '[' + this.attr_name() + '] .close', function (e) {
1427
+ var alertBox = S(this).closest('[' + self.attr_name() + ']'),
1428
+ settings = alertBox.data(self.attr_name(true) + '-init') || self.settings;
1429
+
1430
+ e.preventDefault();
1431
+ if (Modernizr.csstransitions) {
1432
+ alertBox.addClass("alert-close");
1433
+ alertBox.on('transitionend webkitTransitionEnd oTransitionEnd', function(e) {
1434
+ S(this).trigger('close').trigger('close.fndtn.alert').remove();
1435
+ settings.callback();
1436
+ });
1437
+ } else {
1438
+ alertBox.fadeOut(300, function () {
1439
+ S(this).trigger('close').trigger('close.fndtn.alert').remove();
1440
+ settings.callback();
1441
+ });
1442
+ }
1443
+ });
1444
+ },
1445
+
1446
+ reflow : function () {}
1447
+ };
1448
+ }(jQuery, window, window.document));
1449
+ ;(function ($, window, document, undefined) {
1450
+ 'use strict';
1451
+
1452
+ Foundation.libs.clearing = {
1453
+ name : 'clearing',
1454
+
1455
+ version: '5.4.7',
1456
+
1457
+ settings : {
1458
+ templates : {
1459
+ viewing : '<a href="#" class="clearing-close">&times;</a>' +
1460
+ '<div class="visible-img" style="display: none"><div class="clearing-touch-label"></div><img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D" alt="" />' +
1461
+ '<p class="clearing-caption"></p><a href="#" class="clearing-main-prev"><span></span></a>' +
1462
+ '<a href="#" class="clearing-main-next"><span></span></a></div>'
1463
+ },
1464
+
1465
+ // comma delimited list of selectors that, on click, will close clearing,
1466
+ // add 'div.clearing-blackout, div.visible-img' to close on background click
1467
+ close_selectors : '.clearing-close, div.clearing-blackout',
1468
+
1469
+ // Default to the entire li element.
1470
+ open_selectors : '',
1471
+
1472
+ // Image will be skipped in carousel.
1473
+ skip_selector : '',
1474
+
1475
+ touch_label : '',
1476
+
1477
+ // event initializers and locks
1478
+ init : false,
1479
+ locked : false
1480
+ },
1481
+
1482
+ init : function (scope, method, options) {
1483
+ var self = this;
1484
+ Foundation.inherit(this, 'throttle image_loaded');
1485
+
1486
+ this.bindings(method, options);
1487
+
1488
+ if (self.S(this.scope).is('[' + this.attr_name() + ']')) {
1489
+ this.assemble(self.S('li', this.scope));
1490
+ } else {
1491
+ self.S('[' + this.attr_name() + ']', this.scope).each(function () {
1492
+ self.assemble(self.S('li', this));
1493
+ });
1494
+ }
1495
+ },
1496
+
1497
+ events : function (scope) {
1498
+ var self = this,
1499
+ S = self.S,
1500
+ $scroll_container = $('.scroll-container');
1501
+
1502
+ if ($scroll_container.length > 0) {
1503
+ this.scope = $scroll_container;
1504
+ }
1505
+
1506
+ S(this.scope)
1507
+ .off('.clearing')
1508
+ .on('click.fndtn.clearing', 'ul[' + this.attr_name() + '] li ' + this.settings.open_selectors,
1509
+ function (e, current, target) {
1510
+ var current = current || S(this),
1511
+ target = target || current,
1512
+ next = current.next('li'),
1513
+ settings = current.closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init'),
1514
+ image = S(e.target);
1515
+
1516
+ e.preventDefault();
1517
+
1518
+ if (!settings) {
1519
+ self.init();
1520
+ settings = current.closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
1521
+ }
1522
+
1523
+ // if clearing is open and the current image is
1524
+ // clicked, go to the next image in sequence
1525
+ if (target.hasClass('visible') &&
1526
+ current[0] === target[0] &&
1527
+ next.length > 0 && self.is_open(current)) {
1528
+ target = next;
1529
+ image = S('img', target);
1530
+ }
1531
+
1532
+ // set current and target to the clicked li if not otherwise defined.
1533
+ self.open(image, current, target);
1534
+ self.update_paddles(target);
1535
+ })
1536
+
1537
+ .on('click.fndtn.clearing', '.clearing-main-next',
1538
+ function (e) { self.nav(e, 'next') })
1539
+ .on('click.fndtn.clearing', '.clearing-main-prev',
1540
+ function (e) { self.nav(e, 'prev') })
1541
+ .on('click.fndtn.clearing', this.settings.close_selectors,
1542
+ function (e) { Foundation.libs.clearing.close(e, this) });
1543
+
1544
+ $(document).on('keydown.fndtn.clearing',
1545
+ function (e) { self.keydown(e) });
1546
+
1547
+ S(window).off('.clearing').on('resize.fndtn.clearing',
1548
+ function () { self.resize() });
1549
+
1550
+ this.swipe_events(scope);
1551
+ },
1552
+
1553
+ swipe_events : function (scope) {
1554
+ var self = this,
1555
+ S = self.S;
1556
+
1557
+ S(this.scope)
1558
+ .on('touchstart.fndtn.clearing', '.visible-img', function(e) {
1559
+ if (!e.touches) { e = e.originalEvent; }
1560
+ var data = {
1561
+ start_page_x: e.touches[0].pageX,
1562
+ start_page_y: e.touches[0].pageY,
1563
+ start_time: (new Date()).getTime(),
1564
+ delta_x: 0,
1565
+ is_scrolling: undefined
1566
+ };
1567
+
1568
+ S(this).data('swipe-transition', data);
1569
+ e.stopPropagation();
1570
+ })
1571
+ .on('touchmove.fndtn.clearing', '.visible-img', function(e) {
1572
+ if (!e.touches) { e = e.originalEvent; }
1573
+ // Ignore pinch/zoom events
1574
+ if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
1575
+
1576
+ var data = S(this).data('swipe-transition');
1577
+
1578
+ if (typeof data === 'undefined') {
1579
+ data = {};
1580
+ }
1581
+
1582
+ data.delta_x = e.touches[0].pageX - data.start_page_x;
1583
+
1584
+ if (Foundation.rtl) {
1585
+ data.delta_x = -data.delta_x;
1586
+ }
1587
+
1588
+ if (typeof data.is_scrolling === 'undefined') {
1589
+ data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
1590
+ }
1591
+
1592
+ if (!data.is_scrolling && !data.active) {
1593
+ e.preventDefault();
1594
+ var direction = (data.delta_x < 0) ? 'next' : 'prev';
1595
+ data.active = true;
1596
+ self.nav(e, direction);
1597
+ }
1598
+ })
1599
+ .on('touchend.fndtn.clearing', '.visible-img', function(e) {
1600
+ S(this).data('swipe-transition', {});
1601
+ e.stopPropagation();
1602
+ });
1603
+ },
1604
+
1605
+ assemble : function ($li) {
1606
+ var $el = $li.parent();
1607
+
1608
+ if ($el.parent().hasClass('carousel')) {
1609
+ return;
1610
+ }
1611
+
1612
+ $el.after('<div id="foundationClearingHolder"></div>');
1613
+
1614
+ var grid = $el.detach(),
1615
+ grid_outerHTML = '';
1616
+
1617
+ if (grid[0] == null) {
1618
+ return;
1619
+ } else {
1620
+ grid_outerHTML = grid[0].outerHTML;
1621
+ }
1622
+
1623
+ var holder = this.S('#foundationClearingHolder'),
1624
+ settings = $el.data(this.attr_name(true) + '-init'),
1625
+ data = {
1626
+ grid: '<div class="carousel">' + grid_outerHTML + '</div>',
1627
+ viewing: settings.templates.viewing
1628
+ },
1629
+ wrapper = '<div class="clearing-assembled"><div>' + data.viewing +
1630
+ data.grid + '</div></div>',
1631
+ touch_label = this.settings.touch_label;
1632
+
1633
+ if (Modernizr.touch) {
1634
+ wrapper = $(wrapper).find('.clearing-touch-label').html(touch_label).end();
1635
+ }
1636
+
1637
+ holder.after(wrapper).remove();
1638
+ },
1639
+
1640
+ open : function ($image, current, target) {
1641
+ var self = this,
1642
+ body = $(document.body),
1643
+ root = target.closest('.clearing-assembled'),
1644
+ container = self.S('div', root).first(),
1645
+ visible_image = self.S('.visible-img', container),
1646
+ image = self.S('img', visible_image).not($image),
1647
+ label = self.S('.clearing-touch-label', container),
1648
+ error = false;
1649
+
1650
+ // Event to disable scrolling on touch devices when Clearing is activated
1651
+ $('body').on('touchmove',function(e){
1652
+ e.preventDefault();
1653
+ });
1654
+
1655
+ image.error(function () {
1656
+ error = true;
1657
+ });
1658
+
1659
+ function startLoad() {
1660
+ setTimeout(function () {
1661
+ this.image_loaded(image, function () {
1662
+ if (image.outerWidth() === 1 && !error) {
1663
+ startLoad.call(this);
1664
+ } else {
1665
+ cb.call(this, image);
1666
+ }
1667
+ }.bind(this));
1668
+ }.bind(this), 100);
1669
+ }
1670
+
1671
+ function cb (image) {
1672
+ var $image = $(image);
1673
+ $image.css('visibility', 'visible');
1674
+ // toggle the gallery
1675
+ body.css('overflow', 'hidden');
1676
+ root.addClass('clearing-blackout');
1677
+ container.addClass('clearing-container');
1678
+ visible_image.show();
1679
+ this.fix_height(target)
1680
+ .caption(self.S('.clearing-caption', visible_image), self.S('img', target))
1681
+ .center_and_label(image, label)
1682
+ .shift(current, target, function () {
1683
+ target.closest('li').siblings().removeClass('visible');
1684
+ target.closest('li').addClass('visible');
1685
+ });
1686
+ visible_image.trigger('opened.fndtn.clearing')
1687
+ }
1688
+
1689
+ if (!this.locked()) {
1690
+ visible_image.trigger('open.fndtn.clearing');
1691
+ // set the image to the selected thumbnail
1692
+ image
1693
+ .attr('src', this.load($image))
1694
+ .css('visibility', 'hidden');
1695
+
1696
+ startLoad.call(this);
1697
+ }
1698
+ },
1699
+
1700
+ close : function (e, el) {
1701
+ e.preventDefault();
1702
+
1703
+ var root = (function (target) {
1704
+ if (/blackout/.test(target.selector)) {
1705
+ return target;
1706
+ } else {
1707
+ return target.closest('.clearing-blackout');
1708
+ }
1709
+ }($(el))),
1710
+ body = $(document.body), container, visible_image;
1711
+
1712
+ if (el === e.target && root) {
1713
+ body.css('overflow', '');
1714
+ container = $('div', root).first();
1715
+ visible_image = $('.visible-img', container);
1716
+ visible_image.trigger('close.fndtn.clearing');
1717
+ this.settings.prev_index = 0;
1718
+ $('ul[' + this.attr_name() + ']', root)
1719
+ .attr('style', '').closest('.clearing-blackout')
1720
+ .removeClass('clearing-blackout');
1721
+ container.removeClass('clearing-container');
1722
+ visible_image.hide();
1723
+ visible_image.trigger('closed.fndtn.clearing');
1724
+ }
1725
+
1726
+ // Event to re-enable scrolling on touch devices
1727
+ $('body').off('touchmove');
1728
+
1729
+ return false;
1730
+ },
1731
+
1732
+ is_open : function (current) {
1733
+ return current.parent().prop('style').length > 0;
1734
+ },
1735
+
1736
+ keydown : function (e) {
1737
+ var clearing = $('.clearing-blackout ul[' + this.attr_name() + ']'),
1738
+ NEXT_KEY = this.rtl ? 37 : 39,
1739
+ PREV_KEY = this.rtl ? 39 : 37,
1740
+ ESC_KEY = 27;
1741
+
1742
+ if (e.which === NEXT_KEY) this.go(clearing, 'next');
1743
+ if (e.which === PREV_KEY) this.go(clearing, 'prev');
1744
+ if (e.which === ESC_KEY) this.S('a.clearing-close').trigger('click').trigger('click.fndtn.clearing');
1745
+ },
1746
+
1747
+ nav : function (e, direction) {
1748
+ var clearing = $('ul[' + this.attr_name() + ']', '.clearing-blackout');
1749
+
1750
+ e.preventDefault();
1751
+ this.go(clearing, direction);
1752
+ },
1753
+
1754
+ resize : function () {
1755
+ var image = $('img', '.clearing-blackout .visible-img'),
1756
+ label = $('.clearing-touch-label', '.clearing-blackout');
1757
+
1758
+ if (image.length) {
1759
+ this.center_and_label(image, label);
1760
+ image.trigger('resized.fndtn.clearing')
1761
+ }
1762
+ },
1763
+
1764
+ // visual adjustments
1765
+ fix_height : function (target) {
1766
+ var lis = target.parent().children(),
1767
+ self = this;
1768
+
1769
+ lis.each(function () {
1770
+ var li = self.S(this),
1771
+ image = li.find('img');
1772
+
1773
+ if (li.height() > image.outerHeight()) {
1774
+ li.addClass('fix-height');
1775
+ }
1776
+ })
1777
+ .closest('ul')
1778
+ .width(lis.length * 100 + '%');
1779
+
1780
+ return this;
1781
+ },
1782
+
1783
+ update_paddles : function (target) {
1784
+ target = target.closest('li');
1785
+ var visible_image = target
1786
+ .closest('.carousel')
1787
+ .siblings('.visible-img');
1788
+
1789
+ if (target.next().length > 0) {
1790
+ this.S('.clearing-main-next', visible_image).removeClass('disabled');
1791
+ } else {
1792
+ this.S('.clearing-main-next', visible_image).addClass('disabled');
1793
+ }
1794
+
1795
+ if (target.prev().length > 0) {
1796
+ this.S('.clearing-main-prev', visible_image).removeClass('disabled');
1797
+ } else {
1798
+ this.S('.clearing-main-prev', visible_image).addClass('disabled');
1799
+ }
1800
+ },
1801
+
1802
+ center_and_label : function (target, label) {
1803
+ if (!this.rtl) {
1804
+ target.css({
1805
+ marginLeft : -(target.outerWidth() / 2),
1806
+ marginTop : -(target.outerHeight() / 2)
1807
+ });
1808
+
1809
+ if (label.length > 0) {
1810
+ label.css({
1811
+ marginLeft : -(label.outerWidth() / 2),
1812
+ marginTop : -(target.outerHeight() / 2)-label.outerHeight()-10
1813
+ });
1814
+ }
1815
+ } else {
1816
+ target.css({
1817
+ marginRight : -(target.outerWidth() / 2),
1818
+ marginTop : -(target.outerHeight() / 2),
1819
+ left: 'auto',
1820
+ right: '50%'
1821
+ });
1822
+
1823
+ if (label.length > 0) {
1824
+ label.css({
1825
+ marginRight : -(label.outerWidth() / 2),
1826
+ marginTop : -(target.outerHeight() / 2)-label.outerHeight()-10,
1827
+ left: 'auto',
1828
+ right: '50%'
1829
+ });
1830
+ }
1831
+ }
1832
+ return this;
1833
+ },
1834
+
1835
+ // image loading and preloading
1836
+
1837
+ load : function ($image) {
1838
+ var href;
1839
+
1840
+ if ($image[0].nodeName === "A") {
1841
+ href = $image.attr('href');
1842
+ } else {
1843
+ href = $image.parent().attr('href');
1844
+ }
1845
+
1846
+ this.preload($image);
1847
+
1848
+ if (href) return href;
1849
+ return $image.attr('src');
1850
+ },
1851
+
1852
+ preload : function ($image) {
1853
+ this
1854
+ .img($image.closest('li').next())
1855
+ .img($image.closest('li').prev());
1856
+ },
1857
+
1858
+ img : function (img) {
1859
+ if (img.length) {
1860
+ var new_img = new Image(),
1861
+ new_a = this.S('a', img);
1862
+
1863
+ if (new_a.length) {
1864
+ new_img.src = new_a.attr('href');
1865
+ } else {
1866
+ new_img.src = this.S('img', img).attr('src');
1867
+ }
1868
+ }
1869
+ return this;
1870
+ },
1871
+
1872
+ // image caption
1873
+
1874
+ caption : function (container, $image) {
1875
+ var caption = $image.attr('data-caption');
1876
+
1877
+ if (caption) {
1878
+ container
1879
+ .html(caption)
1880
+ .show();
1881
+ } else {
1882
+ container
1883
+ .text('')
1884
+ .hide();
1885
+ }
1886
+ return this;
1887
+ },
1888
+
1889
+ // directional methods
1890
+
1891
+ go : function ($ul, direction) {
1892
+ var current = this.S('.visible', $ul),
1893
+ target = current[direction]();
1894
+
1895
+ // Check for skip selector.
1896
+ if (this.settings.skip_selector && target.find(this.settings.skip_selector).length != 0) {
1897
+ target = target[direction]();
1898
+ }
1899
+
1900
+ if (target.length) {
1901
+ this.S('img', target)
1902
+ .trigger('click', [current, target]).trigger('click.fndtn.clearing', [current, target])
1903
+ .trigger('change.fndtn.clearing');
1904
+ }
1905
+ },
1906
+
1907
+ shift : function (current, target, callback) {
1908
+ var clearing = target.parent(),
1909
+ old_index = this.settings.prev_index || target.index(),
1910
+ direction = this.direction(clearing, current, target),
1911
+ dir = this.rtl ? 'right' : 'left',
1912
+ left = parseInt(clearing.css('left'), 10),
1913
+ width = target.outerWidth(),
1914
+ skip_shift;
1915
+
1916
+ var dir_obj = {};
1917
+
1918
+ // we use jQuery animate instead of CSS transitions because we
1919
+ // need a callback to unlock the next animation
1920
+ // needs support for RTL **
1921
+ if (target.index() !== old_index && !/skip/.test(direction)){
1922
+ if (/left/.test(direction)) {
1923
+ this.lock();
1924
+ dir_obj[dir] = left + width;
1925
+ clearing.animate(dir_obj, 300, this.unlock());
1926
+ } else if (/right/.test(direction)) {
1927
+ this.lock();
1928
+ dir_obj[dir] = left - width;
1929
+ clearing.animate(dir_obj, 300, this.unlock());
1930
+ }
1931
+ } else if (/skip/.test(direction)) {
1932
+ // the target image is not adjacent to the current image, so
1933
+ // do we scroll right or not
1934
+ skip_shift = target.index() - this.settings.up_count;
1935
+ this.lock();
1936
+
1937
+ if (skip_shift > 0) {
1938
+ dir_obj[dir] = -(skip_shift * width);
1939
+ clearing.animate(dir_obj, 300, this.unlock());
1940
+ } else {
1941
+ dir_obj[dir] = 0;
1942
+ clearing.animate(dir_obj, 300, this.unlock());
1943
+ }
1944
+ }
1945
+
1946
+ callback();
1947
+ },
1948
+
1949
+ direction : function ($el, current, target) {
1950
+ var lis = this.S('li', $el),
1951
+ li_width = lis.outerWidth() + (lis.outerWidth() / 4),
1952
+ up_count = Math.floor(this.S('.clearing-container').outerWidth() / li_width) - 1,
1953
+ target_index = lis.index(target),
1954
+ response;
1955
+
1956
+ this.settings.up_count = up_count;
1957
+
1958
+ if (this.adjacent(this.settings.prev_index, target_index)) {
1959
+ if ((target_index > up_count) && target_index > this.settings.prev_index) {
1960
+ response = 'right';
1961
+ } else if ((target_index > up_count - 1) && target_index <= this.settings.prev_index) {
1962
+ response = 'left';
1963
+ } else {
1964
+ response = false;
1965
+ }
1966
+ } else {
1967
+ response = 'skip';
1968
+ }
1969
+
1970
+ this.settings.prev_index = target_index;
1971
+
1972
+ return response;
1973
+ },
1974
+
1975
+ adjacent : function (current_index, target_index) {
1976
+ for (var i = target_index + 1; i >= target_index - 1; i--) {
1977
+ if (i === current_index) return true;
1978
+ }
1979
+ return false;
1980
+ },
1981
+
1982
+ // lock management
1983
+
1984
+ lock : function () {
1985
+ this.settings.locked = true;
1986
+ },
1987
+
1988
+ unlock : function () {
1989
+ this.settings.locked = false;
1990
+ },
1991
+
1992
+ locked : function () {
1993
+ return this.settings.locked;
1994
+ },
1995
+
1996
+ off : function () {
1997
+ this.S(this.scope).off('.fndtn.clearing');
1998
+ this.S(window).off('.fndtn.clearing');
1999
+ },
2000
+
2001
+ reflow : function () {
2002
+ this.init();
2003
+ }
2004
+ };
2005
+
2006
+ }(jQuery, window, window.document));
2007
+ ;(function ($, window, document, undefined) {
2008
+ 'use strict';
2009
+
2010
+ Foundation.libs.reveal = {
2011
+ name : 'reveal',
2012
+
2013
+ version : '5.4.7',
2014
+
2015
+ locked : false,
2016
+
2017
+ settings : {
2018
+ animation: 'fadeAndPop',
2019
+ animation_speed: 250,
2020
+ close_on_background_click: true,
2021
+ close_on_esc: true,
2022
+ dismiss_modal_class: 'close-reveal-modal',
2023
+ bg_class: 'reveal-modal-bg',
2024
+ root_element: 'body',
2025
+ open: function(){},
2026
+ opened: function(){},
2027
+ close: function(){},
2028
+ closed: function(){},
2029
+ bg : $('.reveal-modal-bg'),
2030
+ css : {
2031
+ open : {
2032
+ 'opacity': 0,
2033
+ 'visibility': 'visible',
2034
+ 'display' : 'block'
2035
+ },
2036
+ close : {
2037
+ 'opacity': 1,
2038
+ 'visibility': 'hidden',
2039
+ 'display': 'none'
2040
+ }
2041
+ }
2042
+ },
2043
+
2044
+ init : function (scope, method, options) {
2045
+ $.extend(true, this.settings, method, options);
2046
+ this.bindings(method, options);
2047
+ },
2048
+
2049
+ events : function (scope) {
2050
+ var self = this,
2051
+ S = self.S;
2052
+
2053
+ S(this.scope)
2054
+ .off('.reveal')
2055
+ .on('click.fndtn.reveal', '[' + this.add_namespace('data-reveal-id') + ']:not([disabled])', function (e) {
2056
+ e.preventDefault();
2057
+
2058
+ if (!self.locked) {
2059
+ var element = S(this),
2060
+ ajax = element.data(self.data_attr('reveal-ajax'));
2061
+
2062
+ self.locked = true;
2063
+
2064
+ if (typeof ajax === 'undefined') {
2065
+ self.open.call(self, element);
2066
+ } else {
2067
+ var url = ajax === true ? element.attr('href') : ajax;
2068
+
2069
+ self.open.call(self, element, {url: url});
2070
+ }
2071
+ }
2072
+ });
2073
+
2074
+ S(document)
2075
+ .on('click.fndtn.reveal', this.close_targets(), function (e) {
2076
+
2077
+ e.preventDefault();
2078
+
2079
+ if (!self.locked) {
2080
+ var settings = S('[' + self.attr_name() + '].open').data(self.attr_name(true) + '-init') || self.settings,
2081
+ bg_clicked = S(e.target)[0] === S('.' + settings.bg_class)[0];
2082
+
2083
+ if (bg_clicked) {
2084
+ if (settings.close_on_background_click) {
2085
+ e.stopPropagation();
2086
+ } else {
2087
+ return;
2088
+ }
2089
+ }
2090
+
2091
+ self.locked = true;
2092
+ self.close.call(self, bg_clicked ? S('[' + self.attr_name() + '].open') : S(this).closest('[' + self.attr_name() + ']'));
2093
+ }
2094
+ });
2095
+
2096
+ if(S('[' + self.attr_name() + ']', this.scope).length > 0) {
2097
+ S(this.scope)
2098
+ // .off('.reveal')
2099
+ .on('open.fndtn.reveal', this.settings.open)
2100
+ .on('opened.fndtn.reveal', this.settings.opened)
2101
+ .on('opened.fndtn.reveal', this.open_video)
2102
+ .on('close.fndtn.reveal', this.settings.close)
2103
+ .on('closed.fndtn.reveal', this.settings.closed)
2104
+ .on('closed.fndtn.reveal', this.close_video);
2105
+ } else {
2106
+ S(this.scope)
2107
+ // .off('.reveal')
2108
+ .on('open.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.open)
2109
+ .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.opened)
2110
+ .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.open_video)
2111
+ .on('close.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.close)
2112
+ .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.closed)
2113
+ .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.close_video);
2114
+ }
2115
+
2116
+ return true;
2117
+ },
2118
+
2119
+ // PATCH #3: turning on key up capture only when a reveal window is open
2120
+ key_up_on : function (scope) {
2121
+ var self = this;
2122
+
2123
+ // PATCH #1: fixing multiple keyup event trigger from single key press
2124
+ self.S('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function ( event ) {
2125
+ var open_modal = self.S('[' + self.attr_name() + '].open'),
2126
+ settings = open_modal.data(self.attr_name(true) + '-init') || self.settings ;
2127
+ // PATCH #2: making sure that the close event can be called only while unlocked,
2128
+ // so that multiple keyup.fndtn.reveal events don't prevent clean closing of the reveal window.
2129
+ if ( settings && event.which === 27 && settings.close_on_esc && !self.locked) { // 27 is the keycode for the Escape key
2130
+ self.close.call(self, open_modal);
2131
+ }
2132
+ });
2133
+
2134
+ return true;
2135
+ },
2136
+
2137
+ // PATCH #3: turning on key up capture only when a reveal window is open
2138
+ key_up_off : function (scope) {
2139
+ this.S('body').off('keyup.fndtn.reveal');
2140
+ return true;
2141
+ },
2142
+
2143
+
2144
+ open : function (target, ajax_settings) {
2145
+ var self = this,
2146
+ modal;
2147
+
2148
+ if (target) {
2149
+ if (typeof target.selector !== 'undefined') {
2150
+ // Find the named node; only use the first one found, since the rest of the code assumes there's only one node
2151
+ modal = self.S('#' + target.data(self.data_attr('reveal-id'))).first();
2152
+ } else {
2153
+ modal = self.S(this.scope);
2154
+
2155
+ ajax_settings = target;
2156
+ }
2157
+ } else {
2158
+ modal = self.S(this.scope);
2159
+ }
2160
+
2161
+ var settings = modal.data(self.attr_name(true) + '-init');
2162
+ settings = settings || this.settings;
2163
+
2164
+
2165
+ if (modal.hasClass('open') && target.attr('data-reveal-id') == modal.attr('id')) {
2166
+ return self.close(modal);
2167
+ }
2168
+
2169
+ if (!modal.hasClass('open')) {
2170
+ var open_modal = self.S('[' + self.attr_name() + '].open');
2171
+
2172
+ if (typeof modal.data('css-top') === 'undefined') {
2173
+ modal.data('css-top', parseInt(modal.css('top'), 10))
2174
+ .data('offset', this.cache_offset(modal));
2175
+ }
2176
+
2177
+ this.key_up_on(modal); // PATCH #3: turning on key up capture only when a reveal window is open
2178
+ modal.trigger('open').trigger('open.fndtn.reveal');
2179
+
2180
+ if (open_modal.length < 1) {
2181
+ this.toggle_bg(modal, true);
2182
+ }
2183
+
2184
+ if (typeof ajax_settings === 'string') {
2185
+ ajax_settings = {
2186
+ url: ajax_settings
2187
+ };
2188
+ }
2189
+
2190
+ if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
2191
+ if (open_modal.length > 0) {
2192
+ this.hide(open_modal, settings.css.close);
2193
+ }
2194
+
2195
+ this.show(modal, settings.css.open);
2196
+ } else {
2197
+ var old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
2198
+
2199
+ $.extend(ajax_settings, {
2200
+ success: function (data, textStatus, jqXHR) {
2201
+ if ( $.isFunction(old_success) ) {
2202
+ old_success(data, textStatus, jqXHR);
2203
+ }
2204
+
2205
+ modal.html(data);
2206
+ self.S(modal).foundation('section', 'reflow');
2207
+ self.S(modal).children().foundation();
2208
+
2209
+ if (open_modal.length > 0) {
2210
+ self.hide(open_modal, settings.css.close);
2211
+ }
2212
+ self.show(modal, settings.css.open);
2213
+ }
2214
+ });
2215
+
2216
+ $.ajax(ajax_settings);
2217
+ }
2218
+ }
2219
+ self.S(window).trigger('resize');
2220
+ },
2221
+
2222
+ close : function (modal) {
2223
+ var modal = modal && modal.length ? modal : this.S(this.scope),
2224
+ open_modals = this.S('[' + this.attr_name() + '].open'),
2225
+ settings = modal.data(this.attr_name(true) + '-init') || this.settings;
2226
+
2227
+ if (open_modals.length > 0) {
2228
+ this.locked = true;
2229
+ this.key_up_off(modal); // PATCH #3: turning on key up capture only when a reveal window is open
2230
+ modal.trigger('close').trigger('close.fndtn.reveal');
2231
+ this.toggle_bg(modal, false);
2232
+ this.hide(open_modals, settings.css.close, settings);
2233
+ }
2234
+ },
2235
+
2236
+ close_targets : function () {
2237
+ var base = '.' + this.settings.dismiss_modal_class;
2238
+
2239
+ if (this.settings.close_on_background_click) {
2240
+ return base + ', .' + this.settings.bg_class;
2241
+ }
2242
+
2243
+ return base;
2244
+ },
2245
+
2246
+ toggle_bg : function (modal, state) {
2247
+ if (this.S('.' + this.settings.bg_class).length === 0) {
2248
+ this.settings.bg = $('<div />', {'class': this.settings.bg_class})
2249
+ .appendTo('body').hide();
2250
+ }
2251
+
2252
+ var visible = this.settings.bg.filter(':visible').length > 0;
2253
+ if ( state != visible ) {
2254
+ if ( state == undefined ? visible : !state ) {
2255
+ this.hide(this.settings.bg);
2256
+ } else {
2257
+ this.show(this.settings.bg);
2258
+ }
2259
+ }
2260
+ },
2261
+
2262
+ show : function (el, css) {
2263
+ // is modal
2264
+ if (css) {
2265
+ var settings = el.data(this.attr_name(true) + '-init') || this.settings,
2266
+ root_element = settings.root_element;
2267
+
2268
+ if (el.parent(root_element).length === 0) {
2269
+ var placeholder = el.wrap('<div style="display: none;" />').parent();
2270
+
2271
+ el.on('closed.fndtn.reveal.wrapped', function() {
2272
+ el.detach().appendTo(placeholder);
2273
+ el.unwrap().unbind('closed.fndtn.reveal.wrapped');
2274
+ });
2275
+
2276
+ el.detach().appendTo(root_element);
2277
+ }
2278
+
2279
+ var animData = getAnimationData(settings.animation);
2280
+ if (!animData.animate) {
2281
+ this.locked = false;
2282
+ }
2283
+ if (animData.pop) {
2284
+ css.top = $(window).scrollTop() - el.data('offset') + 'px';
2285
+ var end_css = {
2286
+ top: $(window).scrollTop() + el.data('css-top') + 'px',
2287
+ opacity: 1
2288
+ };
2289
+
2290
+ return setTimeout(function () {
2291
+ return el
2292
+ .css(css)
2293
+ .animate(end_css, settings.animation_speed, 'linear', function () {
2294
+ this.locked = false;
2295
+ el.trigger('opened').trigger('opened.fndtn.reveal');
2296
+ }.bind(this))
2297
+ .addClass('open');
2298
+ }.bind(this), settings.animation_speed / 2);
2299
+ }
2300
+
2301
+ if (animData.fade) {
2302
+ css.top = $(window).scrollTop() + el.data('css-top') + 'px';
2303
+ var end_css = {opacity: 1};
2304
+
2305
+ return setTimeout(function () {
2306
+ return el
2307
+ .css(css)
2308
+ .animate(end_css, settings.animation_speed, 'linear', function () {
2309
+ this.locked = false;
2310
+ el.trigger('opened').trigger('opened.fndtn.reveal');
2311
+ }.bind(this))
2312
+ .addClass('open');
2313
+ }.bind(this), settings.animation_speed / 2);
2314
+ }
2315
+
2316
+ return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened').trigger('opened.fndtn.reveal');
2317
+ }
2318
+
2319
+ var settings = this.settings;
2320
+
2321
+ // should we animate the background?
2322
+ if (getAnimationData(settings.animation).fade) {
2323
+ return el.fadeIn(settings.animation_speed / 2);
2324
+ }
2325
+
2326
+ this.locked = false;
2327
+
2328
+ return el.show();
2329
+ },
2330
+
2331
+ hide : function (el, css) {
2332
+ // is modal
2333
+ if (css) {
2334
+ var settings = el.data(this.attr_name(true) + '-init');
2335
+ settings = settings || this.settings;
2336
+
2337
+ var animData = getAnimationData(settings.animation);
2338
+ if (!animData.animate) {
2339
+ this.locked = false;
2340
+ }
2341
+ if (animData.pop) {
2342
+ var end_css = {
2343
+ top: - $(window).scrollTop() - el.data('offset') + 'px',
2344
+ opacity: 0
2345
+ };
2346
+
2347
+ return setTimeout(function () {
2348
+ return el
2349
+ .animate(end_css, settings.animation_speed, 'linear', function () {
2350
+ this.locked = false;
2351
+ el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
2352
+ }.bind(this))
2353
+ .removeClass('open');
2354
+ }.bind(this), settings.animation_speed / 2);
2355
+ }
2356
+
2357
+ if (animData.fade) {
2358
+ var end_css = {opacity: 0};
2359
+
2360
+ return setTimeout(function () {
2361
+ return el
2362
+ .animate(end_css, settings.animation_speed, 'linear', function () {
2363
+ this.locked = false;
2364
+ el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
2365
+ }.bind(this))
2366
+ .removeClass('open');
2367
+ }.bind(this), settings.animation_speed / 2);
2368
+ }
2369
+
2370
+ return el.hide().css(css).removeClass('open').trigger('closed').trigger('closed.fndtn.reveal');
2371
+ }
2372
+
2373
+ var settings = this.settings;
2374
+
2375
+ // should we animate the background?
2376
+ if (getAnimationData(settings.animation).fade) {
2377
+ return el.fadeOut(settings.animation_speed / 2);
2378
+ }
2379
+
2380
+ return el.hide();
2381
+ },
2382
+
2383
+ close_video : function (e) {
2384
+ var video = $('.flex-video', e.target),
2385
+ iframe = $('iframe', video);
2386
+
2387
+ if (iframe.length > 0) {
2388
+ iframe.attr('data-src', iframe[0].src);
2389
+ iframe.attr('src', iframe.attr('src'));
2390
+ video.hide();
2391
+ }
2392
+ },
2393
+
2394
+ open_video : function (e) {
2395
+ var video = $('.flex-video', e.target),
2396
+ iframe = video.find('iframe');
2397
+
2398
+ if (iframe.length > 0) {
2399
+ var data_src = iframe.attr('data-src');
2400
+ if (typeof data_src === 'string') {
2401
+ iframe[0].src = iframe.attr('data-src');
2402
+ } else {
2403
+ var src = iframe[0].src;
2404
+ iframe[0].src = undefined;
2405
+ iframe[0].src = src;
2406
+ }
2407
+ video.show();
2408
+ }
2409
+ },
2410
+
2411
+ data_attr: function (str) {
2412
+ if (this.namespace.length > 0) {
2413
+ return this.namespace + '-' + str;
2414
+ }
2415
+
2416
+ return str;
2417
+ },
2418
+
2419
+ cache_offset : function (modal) {
2420
+ var offset = modal.show().height() + parseInt(modal.css('top'), 10);
2421
+
2422
+ modal.hide();
2423
+
2424
+ return offset;
2425
+ },
2426
+
2427
+ off : function () {
2428
+ $(this.scope).off('.fndtn.reveal');
2429
+ },
2430
+
2431
+ reflow : function () {}
2432
+ };
2433
+
2434
+ /*
2435
+ * getAnimationData('popAndFade') // {animate: true, pop: true, fade: true}
2436
+ * getAnimationData('fade') // {animate: true, pop: false, fade: true}
2437
+ * getAnimationData('pop') // {animate: true, pop: true, fade: false}
2438
+ * getAnimationData('foo') // {animate: false, pop: false, fade: false}
2439
+ * getAnimationData(null) // {animate: false, pop: false, fade: false}
2440
+ */
2441
+ function getAnimationData(str) {
2442
+ var fade = /fade/i.test(str);
2443
+ var pop = /pop/i.test(str);
2444
+ return {
2445
+ animate: fade || pop,
2446
+ pop: pop,
2447
+ fade: fade
2448
+ };
2449
+ }
2450
+ }(jQuery, window, window.document));
2451
+ ;(function ($, window, document, undefined) {
2452
+ 'use strict';
2453
+
2454
+ Foundation.libs.slider = {
2455
+ name : 'slider',
2456
+
2457
+ version : '5.4.7',
2458
+
2459
+ settings: {
2460
+ start: 0,
2461
+ end: 100,
2462
+ step: 1,
2463
+ initial: null,
2464
+ display_selector: '',
2465
+ vertical: false,
2466
+ on_change: function(){}
2467
+ },
2468
+
2469
+ cache : {},
2470
+
2471
+ init : function (scope, method, options) {
2472
+ Foundation.inherit(this,'throttle');
2473
+ this.bindings(method, options);
2474
+ this.reflow();
2475
+ },
2476
+
2477
+ events : function() {
2478
+ var self = this;
2479
+
2480
+ $(this.scope)
2481
+ .off('.slider')
2482
+ .on('mousedown.fndtn.slider touchstart.fndtn.slider pointerdown.fndtn.slider',
2483
+ '[' + self.attr_name() + ']:not(.disabled, [disabled]) .range-slider-handle', function(e) {
2484
+ if (!self.cache.active) {
2485
+ e.preventDefault();
2486
+ self.set_active_slider($(e.target));
2487
+ }
2488
+ })
2489
+ .on('mousemove.fndtn.slider touchmove.fndtn.slider pointermove.fndtn.slider', function(e) {
2490
+ if (!!self.cache.active) {
2491
+ e.preventDefault();
2492
+ if ($.data(self.cache.active[0], 'settings').vertical) {
2493
+ var scroll_offset = 0;
2494
+ if (!e.pageY) {
2495
+ scroll_offset = window.scrollY;
2496
+ }
2497
+ self.calculate_position(self.cache.active, (e.pageY ||
2498
+ e.originalEvent.clientY ||
2499
+ e.originalEvent.touches[0].clientY ||
2500
+ e.currentPoint.y)
2501
+ + scroll_offset);
2502
+ } else {
2503
+ self.calculate_position(self.cache.active, e.pageX ||
2504
+ e.originalEvent.clientX ||
2505
+ e.originalEvent.touches[0].clientX ||
2506
+ e.currentPoint.x);
2507
+ }
2508
+ }
2509
+ })
2510
+ .on('mouseup.fndtn.slider touchend.fndtn.slider pointerup.fndtn.slider', function(e) {
2511
+ self.remove_active_slider();
2512
+ })
2513
+ .on('change.fndtn.slider', function(e) {
2514
+ self.settings.on_change();
2515
+ });
2516
+
2517
+ self.S(window)
2518
+ .on('resize.fndtn.slider', self.throttle(function(e) {
2519
+ self.reflow();
2520
+ }, 300));
2521
+ },
2522
+
2523
+ set_active_slider : function($handle) {
2524
+ this.cache.active = $handle;
2525
+ },
2526
+
2527
+ remove_active_slider : function() {
2528
+ this.cache.active = null;
2529
+ },
2530
+
2531
+ calculate_position : function($handle, cursor_x) {
2532
+ var self = this,
2533
+ settings = $.data($handle[0], 'settings'),
2534
+ handle_l = $.data($handle[0], 'handle_l'),
2535
+ handle_o = $.data($handle[0], 'handle_o'),
2536
+ bar_l = $.data($handle[0], 'bar_l'),
2537
+ bar_o = $.data($handle[0], 'bar_o');
2538
+
2539
+ requestAnimationFrame(function(){
2540
+ var pct;
2541
+
2542
+ if (Foundation.rtl && !settings.vertical) {
2543
+ pct = self.limit_to(((bar_o+bar_l-cursor_x)/bar_l),0,1);
2544
+ } else {
2545
+ pct = self.limit_to(((cursor_x-bar_o)/bar_l),0,1);
2546
+ }
2547
+
2548
+ pct = settings.vertical ? 1-pct : pct;
2549
+
2550
+ var norm = self.normalized_value(pct, settings.start, settings.end, settings.step);
2551
+
2552
+ self.set_ui($handle, norm);
2553
+ });
2554
+ },
2555
+
2556
+ set_ui : function($handle, value) {
2557
+ var settings = $.data($handle[0], 'settings'),
2558
+ handle_l = $.data($handle[0], 'handle_l'),
2559
+ bar_l = $.data($handle[0], 'bar_l'),
2560
+ norm_pct = this.normalized_percentage(value, settings.start, settings.end),
2561
+ handle_offset = norm_pct*(bar_l-handle_l)-1,
2562
+ progress_bar_length = norm_pct*100;
2563
+
2564
+ if (Foundation.rtl && !settings.vertical) {
2565
+ handle_offset = -handle_offset;
2566
+ }
2567
+
2568
+ handle_offset = settings.vertical ? -handle_offset + bar_l - handle_l + 1 : handle_offset;
2569
+ this.set_translate($handle, handle_offset, settings.vertical);
2570
+
2571
+ if (settings.vertical) {
2572
+ $handle.siblings('.range-slider-active-segment').css('height', progress_bar_length + '%');
2573
+ } else {
2574
+ $handle.siblings('.range-slider-active-segment').css('width', progress_bar_length + '%');
2575
+ }
2576
+
2577
+ $handle.parent().attr(this.attr_name(), value).trigger('change').trigger('change.fndtn.slider');
2578
+
2579
+ $handle.parent().children('input[type=hidden]').val(value);
2580
+
2581
+ if (!$handle[0].hasAttribute('aria-valuemin')) {
2582
+ $handle.attr({
2583
+ 'aria-valuemin': settings.start,
2584
+ 'aria-valuemax': settings.end,
2585
+ });
2586
+ }
2587
+ $handle.attr('aria-valuenow', value);
2588
+
2589
+ if (settings.display_selector != '') {
2590
+ $(settings.display_selector).each(function(){
2591
+ if (this.hasOwnProperty('value')) {
2592
+ $(this).val(value);
2593
+ } else {
2594
+ $(this).text(value);
2595
+ }
2596
+ });
2597
+ }
2598
+
2599
+ },
2600
+
2601
+ normalized_percentage : function(val, start, end) {
2602
+ return Math.min(1, (val - start)/(end - start));
2603
+ },
2604
+
2605
+ normalized_value : function(val, start, end, step) {
2606
+ var range = end - start,
2607
+ point = val*range,
2608
+ mod = (point-(point%step)) / step,
2609
+ rem = point % step,
2610
+ round = ( rem >= step*0.5 ? step : 0);
2611
+ return (mod*step + round) + start;
2612
+ },
2613
+
2614
+ set_translate : function(ele, offset, vertical) {
2615
+ if (vertical) {
2616
+ $(ele)
2617
+ .css('-webkit-transform', 'translateY('+offset+'px)')
2618
+ .css('-moz-transform', 'translateY('+offset+'px)')
2619
+ .css('-ms-transform', 'translateY('+offset+'px)')
2620
+ .css('-o-transform', 'translateY('+offset+'px)')
2621
+ .css('transform', 'translateY('+offset+'px)');
2622
+ } else {
2623
+ $(ele)
2624
+ .css('-webkit-transform', 'translateX('+offset+'px)')
2625
+ .css('-moz-transform', 'translateX('+offset+'px)')
2626
+ .css('-ms-transform', 'translateX('+offset+'px)')
2627
+ .css('-o-transform', 'translateX('+offset+'px)')
2628
+ .css('transform', 'translateX('+offset+'px)');
2629
+ }
2630
+ },
2631
+
2632
+ limit_to : function(val, min, max) {
2633
+ return Math.min(Math.max(val, min), max);
2634
+ },
2635
+
2636
+ initialize_settings : function(handle) {
2637
+ var settings = $.extend({}, this.settings, this.data_options($(handle).parent()));
2638
+
2639
+ if (settings.vertical) {
2640
+ $.data(handle, 'bar_o', $(handle).parent().offset().top);
2641
+ $.data(handle, 'bar_l', $(handle).parent().outerHeight());
2642
+ $.data(handle, 'handle_o', $(handle).offset().top);
2643
+ $.data(handle, 'handle_l', $(handle).outerHeight());
2644
+ } else {
2645
+ $.data(handle, 'bar_o', $(handle).parent().offset().left);
2646
+ $.data(handle, 'bar_l', $(handle).parent().outerWidth());
2647
+ $.data(handle, 'handle_o', $(handle).offset().left);
2648
+ $.data(handle, 'handle_l', $(handle).outerWidth());
2649
+ }
2650
+
2651
+ $.data(handle, 'bar', $(handle).parent());
2652
+ $.data(handle, 'settings', settings);
2653
+ },
2654
+
2655
+ set_initial_position : function($ele) {
2656
+ var settings = $.data($ele.children('.range-slider-handle')[0], 'settings'),
2657
+ initial = (!!settings.initial ? settings.initial : Math.floor((settings.end-settings.start)*0.5/settings.step)*settings.step+settings.start),
2658
+ $handle = $ele.children('.range-slider-handle');
2659
+ this.set_ui($handle, initial);
2660
+ },
2661
+
2662
+ set_value : function(value) {
2663
+ var self = this;
2664
+ $('[' + self.attr_name() + ']', this.scope).each(function(){
2665
+ $(this).attr(self.attr_name(), value);
2666
+ });
2667
+ if (!!$(this.scope).attr(self.attr_name())) {
2668
+ $(this.scope).attr(self.attr_name(), value);
2669
+ }
2670
+ self.reflow();
2671
+ },
2672
+
2673
+ reflow : function() {
2674
+ var self = this;
2675
+ self.S('[' + this.attr_name() + ']').each(function() {
2676
+ var handle = $(this).children('.range-slider-handle')[0],
2677
+ val = $(this).attr(self.attr_name());
2678
+ self.initialize_settings(handle);
2679
+
2680
+ if (val) {
2681
+ self.set_ui($(handle), parseFloat(val));
2682
+ } else {
2683
+ self.set_initial_position($(this));
2684
+ }
2685
+ });
2686
+ }
2687
+ };
2688
+
2689
+ }(jQuery, window, window.document));
2690
+ ;(function ($, window, document, undefined) {
2691
+ 'use strict';
2692
+
2693
+ Foundation.libs.tab = {
2694
+ name : 'tab',
2695
+
2696
+ version : '5.4.7',
2697
+
2698
+ settings : {
2699
+ active_class: 'active',
2700
+ callback : function () {},
2701
+ deep_linking: false,
2702
+ scroll_to_content: true,
2703
+ is_hover: false
2704
+ },
2705
+
2706
+ default_tab_hashes: [],
2707
+
2708
+ init : function (scope, method, options) {
2709
+ var self = this,
2710
+ S = this.S;
2711
+
2712
+ this.bindings(method, options);
2713
+ this.handle_location_hash_change();
2714
+
2715
+ // Store the default active tabs which will be referenced when the
2716
+ // location hash is absent, as in the case of navigating the tabs and
2717
+ // returning to the first viewing via the browser Back button.
2718
+ S('[' + this.attr_name() + '] > .active > a', this.scope).each(function () {
2719
+ self.default_tab_hashes.push(this.hash);
2720
+ });
2721
+ },
2722
+
2723
+ events : function () {
2724
+ var self = this,
2725
+ S = this.S;
2726
+
2727
+ var usual_tab_behavior = function (e) {
2728
+ var settings = S(this).closest('[' + self.attr_name() +']').data(self.attr_name(true) + '-init');
2729
+ if (!settings.is_hover || Modernizr.touch) {
2730
+ e.preventDefault();
2731
+ e.stopPropagation();
2732
+ self.toggle_active_tab(S(this).parent());
2733
+ }
2734
+ };
2735
+
2736
+ S(this.scope)
2737
+ .off('.tab')
2738
+ // Click event: tab title
2739
+ .on('focus.fndtn.tab', '[' + this.attr_name() + '] > * > a', usual_tab_behavior )
2740
+ .on('click.fndtn.tab', '[' + this.attr_name() + '] > * > a', usual_tab_behavior )
2741
+ // Hover event: tab title
2742
+ .on('mouseenter.fndtn.tab', '[' + this.attr_name() + '] > * > a', function (e) {
2743
+ var settings = S(this).closest('[' + self.attr_name() +']').data(self.attr_name(true) + '-init');
2744
+ if (settings.is_hover) self.toggle_active_tab(S(this).parent());
2745
+ });
2746
+
2747
+ // Location hash change event
2748
+ S(window).on('hashchange.fndtn.tab', function (e) {
2749
+ e.preventDefault();
2750
+ self.handle_location_hash_change();
2751
+ });
2752
+ },
2753
+
2754
+ handle_location_hash_change : function () {
2755
+
2756
+ var self = this,
2757
+ S = this.S;
2758
+
2759
+ S('[' + this.attr_name() + ']', this.scope).each(function () {
2760
+ var settings = S(this).data(self.attr_name(true) + '-init');
2761
+ if (settings.deep_linking) {
2762
+ // Match the location hash to a label
2763
+ var hash;
2764
+ if (settings.scroll_to_content) {
2765
+ hash = self.scope.location.hash;
2766
+ } else {
2767
+ // prefix the hash to prevent anchor scrolling
2768
+ hash = self.scope.location.hash.replace('fndtn-', '');
2769
+ }
2770
+ if (hash != '') {
2771
+ // Check whether the location hash references a tab content div or
2772
+ // another element on the page (inside or outside the tab content div)
2773
+ var hash_element = S(hash);
2774
+ if (hash_element.hasClass('content') && hash_element.parent().hasClass('tabs-content')) {
2775
+ // Tab content div
2776
+ self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + hash + ']').parent());
2777
+ } else {
2778
+ // Not the tab content div. If inside the tab content, find the
2779
+ // containing tab and toggle it as active.
2780
+ var hash_tab_container_id = hash_element.closest('.content').attr('id');
2781
+ if (hash_tab_container_id != undefined) {
2782
+ self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=#' + hash_tab_container_id + ']').parent(), hash);
2783
+ }
2784
+ }
2785
+ } else {
2786
+ // Reference the default tab hashes which were initialized in the init function
2787
+ for (var ind = 0; ind < self.default_tab_hashes.length; ind++) {
2788
+ self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + self.default_tab_hashes[ind] + ']').parent());
2789
+ }
2790
+ }
2791
+ }
2792
+ });
2793
+ },
2794
+
2795
+ toggle_active_tab: function (tab, location_hash) {
2796
+ var S = this.S,
2797
+ tabs = tab.closest('[' + this.attr_name() + ']'),
2798
+ tab_link = tab.find('a'),
2799
+ anchor = tab.children('a').first(),
2800
+ target_hash = '#' + anchor.attr('href').split('#')[1],
2801
+ target = S(target_hash),
2802
+ siblings = tab.siblings(),
2803
+ settings = tabs.data(this.attr_name(true) + '-init'),
2804
+ interpret_keyup_action = function(e) {
2805
+ // Light modification of Heydon Pickering's Practical ARIA Examples: http://heydonworks.com/practical_aria_examples/js/a11y.js
2806
+
2807
+ // define current, previous and next (possible) tabs
2808
+
2809
+ var $original = $(this);
2810
+ var $prev = $(this).parents('li').prev().children('[role="tab"]');
2811
+ var $next = $(this).parents('li').next().children('[role="tab"]');
2812
+ var $target;
2813
+
2814
+ // find the direction (prev or next)
2815
+
2816
+ switch (e.keyCode) {
2817
+ case 37:
2818
+ $target = $prev;
2819
+ break;
2820
+ case 39:
2821
+ $target = $next;
2822
+ break;
2823
+ default:
2824
+ $target = false
2825
+ break;
2826
+ }
2827
+
2828
+ if ($target.length) {
2829
+ $original.attr({
2830
+ 'tabindex' : '-1',
2831
+ 'aria-selected' : null
2832
+ });
2833
+ $target.attr({
2834
+ 'tabindex' : '0',
2835
+ 'aria-selected' : true
2836
+ }).focus();
2837
+ }
2838
+
2839
+ // Hide panels
2840
+
2841
+ $('[role="tabpanel"]')
2842
+ .attr('aria-hidden', 'true');
2843
+
2844
+ // Show panel which corresponds to target
2845
+
2846
+ $('#' + $(document.activeElement).attr('href').substring(1))
2847
+ .attr('aria-hidden', null);
2848
+
2849
+ };
2850
+
2851
+ // allow usage of data-tab-content attribute instead of href
2852
+ if (S(this).data(this.data_attr('tab-content'))) {
2853
+ target_hash = '#' + S(this).data(this.data_attr('tab-content')).split('#')[1];
2854
+ target = S(target_hash);
2855
+ }
2856
+
2857
+ if (settings.deep_linking) {
2858
+
2859
+ if (settings.scroll_to_content) {
2860
+ // retain current hash to scroll to content
2861
+ window.location.hash = location_hash || target_hash;
2862
+ if (location_hash == undefined || location_hash == target_hash) {
2863
+ tab.parent()[0].scrollIntoView();
2864
+ } else {
2865
+ S(target_hash)[0].scrollIntoView();
2866
+ }
2867
+ } else {
2868
+ // prefix the hashes so that the browser doesn't scroll down
2869
+ if (location_hash != undefined) {
2870
+ window.location.hash = 'fndtn-' + location_hash.replace('#', '');
2871
+ } else {
2872
+ window.location.hash = 'fndtn-' + target_hash.replace('#', '');
2873
+ }
2874
+ }
2875
+ }
2876
+
2877
+ // WARNING: The activation and deactivation of the tab content must
2878
+ // occur after the deep linking in order to properly refresh the browser
2879
+ // window (notably in Chrome).
2880
+ // Clean up multiple attr instances to done once
2881
+ tab.addClass(settings.active_class).triggerHandler('opened');
2882
+ tab_link.attr({"aria-selected": "true", tabindex: 0});
2883
+ siblings.removeClass(settings.active_class)
2884
+ siblings.find('a').attr({"aria-selected": "false", tabindex: -1});
2885
+ target.siblings().removeClass(settings.active_class).attr({"aria-hidden": "true", tabindex: -1});
2886
+ target.addClass(settings.active_class).attr('aria-hidden', 'false').removeAttr("tabindex");
2887
+ settings.callback(tab);
2888
+ target.triggerHandler('toggled', [tab]);
2889
+ tabs.triggerHandler('toggled', [target]);
2890
+
2891
+ tab_link.off('keydown').on('keydown', interpret_keyup_action );
2892
+ },
2893
+
2894
+ data_attr: function (str) {
2895
+ if (this.namespace.length > 0) {
2896
+ return this.namespace + '-' + str;
2897
+ }
2898
+
2899
+ return str;
2900
+ },
2901
+
2902
+ off : function () {},
2903
+
2904
+ reflow : function () {}
2905
+ };
2906
+ }(jQuery, window, window.document));
2907
+ ;(function ($, window, document, undefined) {
2908
+ 'use strict';
2909
+
2910
+ Foundation.libs.tooltip = {
2911
+ name : 'tooltip',
2912
+
2913
+ version : '5.4.7',
2914
+
2915
+ settings : {
2916
+ additional_inheritable_classes : [],
2917
+ tooltip_class : '.tooltip',
2918
+ append_to: 'body',
2919
+ touch_close_text: 'Tap To Close',
2920
+ disable_for_touch: false,
2921
+ hover_delay: 200,
2922
+ show_on : 'all',
2923
+ tip_template : function (selector, content) {
2924
+ return '<span data-selector="' + selector + '" id="' + selector + '" class="'
2925
+ + Foundation.libs.tooltip.settings.tooltip_class.substring(1)
2926
+ + '" role="tooltip">' + content + '<span class="nub"></span></span>';
2927
+ }
2928
+ },
2929
+
2930
+ cache : {},
2931
+
2932
+ init : function (scope, method, options) {
2933
+ Foundation.inherit(this, 'random_str');
2934
+ this.bindings(method, options);
2935
+ },
2936
+
2937
+ should_show: function (target, tip) {
2938
+ var settings = $.extend({}, this.settings, this.data_options(target));
2939
+
2940
+ if (settings.show_on === 'all') {
2941
+ return true;
2942
+ } else if (this.small() && settings.show_on === 'small') {
2943
+ return true;
2944
+ } else if (this.medium() && settings.show_on === 'medium') {
2945
+ return true;
2946
+ } else if (this.large() && settings.show_on === 'large') {
2947
+ return true;
2948
+ }
2949
+ return false;
2950
+ },
2951
+
2952
+ medium : function () {
2953
+ return matchMedia(Foundation.media_queries['medium']).matches;
2954
+ },
2955
+
2956
+ large : function () {
2957
+ return matchMedia(Foundation.media_queries['large']).matches;
2958
+ },
2959
+
2960
+ events : function (instance) {
2961
+ var self = this,
2962
+ S = self.S;
2963
+
2964
+ self.create(this.S(instance));
2965
+
2966
+ $(this.scope)
2967
+ .off('.tooltip')
2968
+ .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip',
2969
+ '[' + this.attr_name() + ']', function (e) {
2970
+ var $this = S(this),
2971
+ settings = $.extend({}, self.settings, self.data_options($this)),
2972
+ is_touch = false;
2973
+
2974
+ if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type) && S(e.target).is('a')) {
2975
+ return false;
2976
+ }
2977
+
2978
+ if (/mouse/i.test(e.type) && self.ie_touch(e)) return false;
2979
+
2980
+ if ($this.hasClass('open')) {
2981
+ if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) e.preventDefault();
2982
+ self.hide($this);
2983
+ } else {
2984
+ if (settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
2985
+ return;
2986
+ } else if(!settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
2987
+ e.preventDefault();
2988
+ S(settings.tooltip_class + '.open').hide();
2989
+ is_touch = true;
2990
+ }
2991
+
2992
+ if (/enter|over/i.test(e.type)) {
2993
+ this.timer = setTimeout(function () {
2994
+ var tip = self.showTip($this);
2995
+ }.bind(this), self.settings.hover_delay);
2996
+ } else if (e.type === 'mouseout' || e.type === 'mouseleave') {
2997
+ clearTimeout(this.timer);
2998
+ self.hide($this);
2999
+ } else {
3000
+ self.showTip($this);
3001
+ }
3002
+ }
3003
+ })
3004
+ .on('mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', '[' + this.attr_name() + '].open', function (e) {
3005
+ if (/mouse/i.test(e.type) && self.ie_touch(e)) return false;
3006
+
3007
+ if($(this).data('tooltip-open-event-type') == 'touch' && e.type == 'mouseleave') {
3008
+ return;
3009
+ }
3010
+ else if($(this).data('tooltip-open-event-type') == 'mouse' && /MSPointerDown|touchstart/i.test(e.type)) {
3011
+ self.convert_to_touch($(this));
3012
+ } else {
3013
+ self.hide($(this));
3014
+ }
3015
+ })
3016
+ .on('DOMNodeRemoved DOMAttrModified', '[' + this.attr_name() + ']:not(a)', function (e) {
3017
+ self.hide(S(this));
3018
+ });
3019
+ },
3020
+
3021
+ ie_touch : function (e) {
3022
+ // How do I distinguish between IE11 and Windows Phone 8?????
3023
+ return false;
3024
+ },
3025
+
3026
+ showTip : function ($target) {
3027
+ var $tip = this.getTip($target);
3028
+ if (this.should_show($target, $tip)){
3029
+ return this.show($target);
3030
+ }
3031
+ return;
3032
+ },
3033
+
3034
+ getTip : function ($target) {
3035
+ var selector = this.selector($target),
3036
+ settings = $.extend({}, this.settings, this.data_options($target)),
3037
+ tip = null;
3038
+
3039
+ if (selector) {
3040
+ tip = this.S('span[data-selector="' + selector + '"]' + settings.tooltip_class);
3041
+ }
3042
+
3043
+ return (typeof tip === 'object') ? tip : false;
3044
+ },
3045
+
3046
+ selector : function ($target) {
3047
+ var id = $target.attr('id'),
3048
+ dataSelector = $target.attr(this.attr_name()) || $target.attr('data-selector');
3049
+
3050
+ if ((id && id.length < 1 || !id) && typeof dataSelector != 'string') {
3051
+ dataSelector = this.random_str(6);
3052
+ $target
3053
+ .attr('data-selector', dataSelector)
3054
+ .attr('aria-describedby', dataSelector);
3055
+ }
3056
+
3057
+ return (id && id.length > 0) ? id : dataSelector;
3058
+ },
3059
+
3060
+ create : function ($target) {
3061
+ var self = this,
3062
+ settings = $.extend({}, this.settings, this.data_options($target)),
3063
+ tip_template = this.settings.tip_template;
3064
+
3065
+ if (typeof settings.tip_template === 'string' && window.hasOwnProperty(settings.tip_template)) {
3066
+ tip_template = window[settings.tip_template];
3067
+ }
3068
+
3069
+ var $tip = $(tip_template(this.selector($target), $('<div></div>').html($target.attr('title')).html())),
3070
+ classes = this.inheritable_classes($target);
3071
+
3072
+ $tip.addClass(classes).appendTo(settings.append_to);
3073
+
3074
+ if (Modernizr.touch) {
3075
+ $tip.append('<span class="tap-to-close">'+settings.touch_close_text+'</span>');
3076
+ $tip.on('touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', function(e) {
3077
+ self.hide($target);
3078
+ });
3079
+ }
3080
+
3081
+ $target.removeAttr('title').attr('title','');
3082
+ },
3083
+
3084
+ reposition : function (target, tip, classes) {
3085
+ var width, nub, nubHeight, nubWidth, column, objPos;
3086
+
3087
+ tip.css('visibility', 'hidden').show();
3088
+
3089
+ width = target.data('width');
3090
+ nub = tip.children('.nub');
3091
+ nubHeight = nub.outerHeight();
3092
+ nubWidth = nub.outerHeight();
3093
+
3094
+ if (this.small()) {
3095
+ tip.css({'width' : '100%' });
3096
+ } else {
3097
+ tip.css({'width' : (width) ? width : 'auto'});
3098
+ }
3099
+
3100
+ objPos = function (obj, top, right, bottom, left, width) {
3101
+ return obj.css({
3102
+ 'top' : (top) ? top : 'auto',
3103
+ 'bottom' : (bottom) ? bottom : 'auto',
3104
+ 'left' : (left) ? left : 'auto',
3105
+ 'right' : (right) ? right : 'auto'
3106
+ }).end();
3107
+ };
3108
+
3109
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', target.offset().left);
3110
+
3111
+ if (this.small()) {
3112
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', 12.5, $(this.scope).width());
3113
+ tip.addClass('tip-override');
3114
+ objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
3115
+ } else {
3116
+ var left = target.offset().left;
3117
+ if (Foundation.rtl) {
3118
+ nub.addClass('rtl');
3119
+ left = target.offset().left + target.outerWidth() - tip.outerWidth();
3120
+ }
3121
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', left);
3122
+ tip.removeClass('tip-override');
3123
+ if (classes && classes.indexOf('tip-top') > -1) {
3124
+ if (Foundation.rtl) nub.addClass('rtl');
3125
+ objPos(tip, (target.offset().top - tip.outerHeight()), 'auto', 'auto', left)
3126
+ .removeClass('tip-override');
3127
+ } else if (classes && classes.indexOf('tip-left') > -1) {
3128
+ objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left - tip.outerWidth() - nubHeight))
3129
+ .removeClass('tip-override');
3130
+ nub.removeClass('rtl');
3131
+ } else if (classes && classes.indexOf('tip-right') > -1) {
3132
+ objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left + target.outerWidth() + nubHeight))
3133
+ .removeClass('tip-override');
3134
+ nub.removeClass('rtl');
3135
+ }
3136
+ }
3137
+
3138
+ tip.css('visibility', 'visible').hide();
3139
+ },
3140
+
3141
+ small : function () {
3142
+ return matchMedia(Foundation.media_queries.small).matches &&
3143
+ !matchMedia(Foundation.media_queries.medium).matches;
3144
+ },
3145
+
3146
+ inheritable_classes : function ($target) {
3147
+ var settings = $.extend({}, this.settings, this.data_options($target)),
3148
+ inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'radius', 'round'].concat(settings.additional_inheritable_classes),
3149
+ classes = $target.attr('class'),
3150
+ filtered = classes ? $.map(classes.split(' '), function (el, i) {
3151
+ if ($.inArray(el, inheritables) !== -1) {
3152
+ return el;
3153
+ }
3154
+ }).join(' ') : '';
3155
+
3156
+ return $.trim(filtered);
3157
+ },
3158
+
3159
+ convert_to_touch : function($target) {
3160
+ var self = this,
3161
+ $tip = self.getTip($target),
3162
+ settings = $.extend({}, self.settings, self.data_options($target));
3163
+
3164
+ if ($tip.find('.tap-to-close').length === 0) {
3165
+ $tip.append('<span class="tap-to-close">'+settings.touch_close_text+'</span>');
3166
+ $tip.on('click.fndtn.tooltip.tapclose touchstart.fndtn.tooltip.tapclose MSPointerDown.fndtn.tooltip.tapclose', function(e) {
3167
+ self.hide($target);
3168
+ });
3169
+ }
3170
+
3171
+ $target.data('tooltip-open-event-type', 'touch');
3172
+ },
3173
+
3174
+ show : function ($target) {
3175
+ var $tip = this.getTip($target);
3176
+
3177
+ if ($target.data('tooltip-open-event-type') == 'touch') {
3178
+ this.convert_to_touch($target);
3179
+ }
3180
+
3181
+ this.reposition($target, $tip, $target.attr('class'));
3182
+ $target.addClass('open');
3183
+ $tip.fadeIn(150);
3184
+ },
3185
+
3186
+ hide : function ($target) {
3187
+ var $tip = this.getTip($target);
3188
+
3189
+ $tip.fadeOut(150, function() {
3190
+ $tip.find('.tap-to-close').remove();
3191
+ $tip.off('click.fndtn.tooltip.tapclose MSPointerDown.fndtn.tapclose');
3192
+ $target.removeClass('open');
3193
+ });
3194
+ },
3195
+
3196
+ off : function () {
3197
+ var self = this;
3198
+ this.S(this.scope).off('.fndtn.tooltip');
3199
+ this.S(this.settings.tooltip_class).each(function (i) {
3200
+ $('[' + self.attr_name() + ']').eq(i).attr('title', $(this).text());
3201
+ }).remove();
3202
+ },
3203
+
3204
+ reflow : function () {}
3205
+ };
3206
+ }(jQuery, window, window.document));
3207
+ ;(function ($, window, document, undefined) {
3208
+ 'use strict';
3209
+
3210
+ Foundation.libs.topbar = {
3211
+ name : 'topbar',
3212
+
3213
+ version: '5.4.7',
3214
+
3215
+ settings : {
3216
+ index : 0,
3217
+ sticky_class : 'sticky',
3218
+ custom_back_text: true,
3219
+ back_text: 'Back',
3220
+ mobile_show_parent_link: true,
3221
+ is_hover: true,
3222
+ scrolltop : true, // jump to top when sticky nav menu toggle is clicked
3223
+ sticky_on : 'all'
3224
+ },
3225
+
3226
+ init : function (section, method, options) {
3227
+ Foundation.inherit(this, 'add_custom_rule register_media throttle');
3228
+ var self = this;
3229
+
3230
+ self.register_media('topbar', 'foundation-mq-topbar');
3231
+
3232
+ this.bindings(method, options);
3233
+
3234
+ self.S('[' + this.attr_name() + ']', this.scope).each(function () {
3235
+ var topbar = $(this),
3236
+ settings = topbar.data(self.attr_name(true) + '-init'),
3237
+ section = self.S('section, .top-bar-section', this);
3238
+ topbar.data('index', 0);
3239
+ var topbarContainer = topbar.parent();
3240
+ if (topbarContainer.hasClass('fixed') || self.is_sticky(topbar, topbarContainer, settings) ) {
3241
+ self.settings.sticky_class = settings.sticky_class;
3242
+ self.settings.sticky_topbar = topbar;
3243
+ topbar.data('height', topbarContainer.outerHeight());
3244
+ topbar.data('stickyoffset', topbarContainer.offset().top);
3245
+ } else {
3246
+ topbar.data('height', topbar.outerHeight());
3247
+ }
3248
+
3249
+ if (!settings.assembled) {
3250
+ self.assemble(topbar);
3251
+ }
3252
+
3253
+ if (settings.is_hover) {
3254
+ self.S('.has-dropdown', topbar).addClass('not-click');
3255
+ } else {
3256
+ self.S('.has-dropdown', topbar).removeClass('not-click');
3257
+ }
3258
+
3259
+ // Pad body when sticky (scrolled) or fixed.
3260
+ self.add_custom_rule('.f-topbar-fixed { padding-top: ' + topbar.data('height') + 'px }');
3261
+
3262
+ if (topbarContainer.hasClass('fixed')) {
3263
+ self.S('body').addClass('f-topbar-fixed');
3264
+ }
3265
+ });
3266
+
3267
+ },
3268
+
3269
+ is_sticky: function (topbar, topbarContainer, settings) {
3270
+ var sticky = topbarContainer.hasClass(settings.sticky_class);
3271
+
3272
+ if (sticky && settings.sticky_on === 'all') {
3273
+ return true;
3274
+ } else if (sticky && this.small() && settings.sticky_on === 'small') {
3275
+ return (matchMedia(Foundation.media_queries.small).matches && !matchMedia(Foundation.media_queries.medium).matches &&
3276
+ !matchMedia(Foundation.media_queries.large).matches);
3277
+ //return true;
3278
+ } else if (sticky && this.medium() && settings.sticky_on === 'medium') {
3279
+ return (matchMedia(Foundation.media_queries.small).matches && matchMedia(Foundation.media_queries.medium).matches &&
3280
+ !matchMedia(Foundation.media_queries.large).matches);
3281
+ //return true;
3282
+ } else if(sticky && this.large() && settings.sticky_on === 'large') {
3283
+ return (matchMedia(Foundation.media_queries.small).matches && matchMedia(Foundation.media_queries.medium).matches &&
3284
+ matchMedia(Foundation.media_queries.large).matches);
3285
+ //return true;
3286
+ }
3287
+
3288
+ return false;
3289
+ },
3290
+
3291
+ toggle: function (toggleEl) {
3292
+ var self = this,
3293
+ topbar;
3294
+
3295
+ if (toggleEl) {
3296
+ topbar = self.S(toggleEl).closest('[' + this.attr_name() + ']');
3297
+ } else {
3298
+ topbar = self.S('[' + this.attr_name() + ']');
3299
+ }
3300
+
3301
+ var settings = topbar.data(this.attr_name(true) + '-init');
3302
+
3303
+ var section = self.S('section, .top-bar-section', topbar);
3304
+
3305
+ if (self.breakpoint()) {
3306
+ if (!self.rtl) {
3307
+ section.css({left: '0%'});
3308
+ $('>.name', section).css({left: '100%'});
3309
+ } else {
3310
+ section.css({right: '0%'});
3311
+ $('>.name', section).css({right: '100%'});
3312
+ }
3313
+
3314
+ self.S('li.moved', section).removeClass('moved');
3315
+ topbar.data('index', 0);
3316
+
3317
+ topbar
3318
+ .toggleClass('expanded')
3319
+ .css('height', '');
3320
+ }
3321
+
3322
+ if (settings.scrolltop) {
3323
+ if (!topbar.hasClass('expanded')) {
3324
+ if (topbar.hasClass('fixed')) {
3325
+ topbar.parent().addClass('fixed');
3326
+ topbar.removeClass('fixed');
3327
+ self.S('body').addClass('f-topbar-fixed');
3328
+ }
3329
+ } else if (topbar.parent().hasClass('fixed')) {
3330
+ if (settings.scrolltop) {
3331
+ topbar.parent().removeClass('fixed');
3332
+ topbar.addClass('fixed');
3333
+ self.S('body').removeClass('f-topbar-fixed');
3334
+
3335
+ window.scrollTo(0,0);
3336
+ } else {
3337
+ topbar.parent().removeClass('expanded');
3338
+ }
3339
+ }
3340
+ } else {
3341
+ if (self.is_sticky(topbar, topbar.parent(), settings)) {
3342
+ topbar.parent().addClass('fixed');
3343
+ }
3344
+
3345
+ if (topbar.parent().hasClass('fixed')) {
3346
+ if (!topbar.hasClass('expanded')) {
3347
+ topbar.removeClass('fixed');
3348
+ topbar.parent().removeClass('expanded');
3349
+ self.update_sticky_positioning();
3350
+ } else {
3351
+ topbar.addClass('fixed');
3352
+ topbar.parent().addClass('expanded');
3353
+ self.S('body').addClass('f-topbar-fixed');
3354
+ }
3355
+ }
3356
+ }
3357
+ },
3358
+
3359
+ timer : null,
3360
+
3361
+ events : function (bar) {
3362
+ var self = this,
3363
+ S = this.S;
3364
+
3365
+ S(this.scope)
3366
+ .off('.topbar')
3367
+ .on('click.fndtn.topbar', '[' + this.attr_name() + '] .toggle-topbar', function (e) {
3368
+ e.preventDefault();
3369
+ self.toggle(this);
3370
+ })
3371
+ .on('click.fndtn.topbar','.top-bar .top-bar-section li a[href^="#"],[' + this.attr_name() + '] .top-bar-section li a[href^="#"]',function (e) {
3372
+ var li = $(this).closest('li');
3373
+ if(self.breakpoint() && !li.hasClass('back') && !li.hasClass('has-dropdown'))
3374
+ {
3375
+ self.toggle();
3376
+ }
3377
+ })
3378
+ .on('click.fndtn.topbar', '[' + this.attr_name() + '] li.has-dropdown', function (e) {
3379
+ var li = S(this),
3380
+ target = S(e.target),
3381
+ topbar = li.closest('[' + self.attr_name() + ']'),
3382
+ settings = topbar.data(self.attr_name(true) + '-init');
3383
+
3384
+ if(target.data('revealId')) {
3385
+ self.toggle();
3386
+ return;
3387
+ }
3388
+
3389
+ if (self.breakpoint()) return;
3390
+ if (settings.is_hover && !Modernizr.touch) return;
3391
+
3392
+ e.stopImmediatePropagation();
3393
+
3394
+ if (li.hasClass('hover')) {
3395
+ li
3396
+ .removeClass('hover')
3397
+ .find('li')
3398
+ .removeClass('hover');
3399
+
3400
+ li.parents('li.hover')
3401
+ .removeClass('hover');
3402
+ } else {
3403
+ li.addClass('hover');
3404
+
3405
+ $(li).siblings().removeClass('hover');
3406
+
3407
+ if (target[0].nodeName === 'A' && target.parent().hasClass('has-dropdown')) {
3408
+ e.preventDefault();
3409
+ }
3410
+ }
3411
+ })
3412
+ .on('click.fndtn.topbar', '[' + this.attr_name() + '] .has-dropdown>a', function (e) {
3413
+ if (self.breakpoint()) {
3414
+
3415
+ e.preventDefault();
3416
+
3417
+ var $this = S(this),
3418
+ topbar = $this.closest('[' + self.attr_name() + ']'),
3419
+ section = topbar.find('section, .top-bar-section'),
3420
+ dropdownHeight = $this.next('.dropdown').outerHeight(),
3421
+ $selectedLi = $this.closest('li');
3422
+
3423
+ topbar.data('index', topbar.data('index') + 1);
3424
+ $selectedLi.addClass('moved');
3425
+
3426
+ if (!self.rtl) {
3427
+ section.css({left: -(100 * topbar.data('index')) + '%'});
3428
+ section.find('>.name').css({left: 100 * topbar.data('index') + '%'});
3429
+ } else {
3430
+ section.css({right: -(100 * topbar.data('index')) + '%'});
3431
+ section.find('>.name').css({right: 100 * topbar.data('index') + '%'});
3432
+ }
3433
+
3434
+ topbar.css('height', $this.siblings('ul').outerHeight(true) + topbar.data('height'));
3435
+ }
3436
+ });
3437
+
3438
+ S(window).off(".topbar").on("resize.fndtn.topbar", self.throttle(function() {
3439
+ self.resize.call(self);
3440
+ }, 50)).trigger("resize").trigger("resize.fndtn.topbar").load(function(){
3441
+ // Ensure that the offset is calculated after all of the pages resources have loaded
3442
+ S(this).trigger("resize.fndtn.topbar");
3443
+ });
3444
+
3445
+ S('body').off('.topbar').on('click.fndtn.topbar', function (e) {
3446
+ var parent = S(e.target).closest('li').closest('li.hover');
3447
+
3448
+ if (parent.length > 0) {
3449
+ return;
3450
+ }
3451
+
3452
+ S('[' + self.attr_name() + '] li.hover').removeClass('hover');
3453
+ });
3454
+
3455
+ // Go up a level on Click
3456
+ S(this.scope).on('click.fndtn.topbar', '[' + this.attr_name() + '] .has-dropdown .back', function (e) {
3457
+ e.preventDefault();
3458
+
3459
+ var $this = S(this),
3460
+ topbar = $this.closest('[' + self.attr_name() + ']'),
3461
+ section = topbar.find('section, .top-bar-section'),
3462
+ settings = topbar.data(self.attr_name(true) + '-init'),
3463
+ $movedLi = $this.closest('li.moved'),
3464
+ $previousLevelUl = $movedLi.parent();
3465
+
3466
+ topbar.data('index', topbar.data('index') - 1);
3467
+
3468
+ if (!self.rtl) {
3469
+ section.css({left: -(100 * topbar.data('index')) + '%'});
3470
+ section.find('>.name').css({left: 100 * topbar.data('index') + '%'});
3471
+ } else {
3472
+ section.css({right: -(100 * topbar.data('index')) + '%'});
3473
+ section.find('>.name').css({right: 100 * topbar.data('index') + '%'});
3474
+ }
3475
+
3476
+ if (topbar.data('index') === 0) {
3477
+ topbar.css('height', '');
3478
+ } else {
3479
+ topbar.css('height', $previousLevelUl.outerHeight(true) + topbar.data('height'));
3480
+ }
3481
+
3482
+ setTimeout(function () {
3483
+ $movedLi.removeClass('moved');
3484
+ }, 300);
3485
+ });
3486
+
3487
+ // Show dropdown menus when their items are focused
3488
+ S(this.scope).find('.dropdown a')
3489
+ .focus(function() {
3490
+ $(this).parents('.has-dropdown').addClass('hover');
3491
+ })
3492
+ .blur(function() {
3493
+ $(this).parents('.has-dropdown').removeClass('hover');
3494
+ });
3495
+ },
3496
+
3497
+ resize : function () {
3498
+ var self = this;
3499
+ self.S('[' + this.attr_name() + ']').each(function () {
3500
+ var topbar = self.S(this),
3501
+ settings = topbar.data(self.attr_name(true) + '-init');
3502
+
3503
+ var stickyContainer = topbar.parent('.' + self.settings.sticky_class);
3504
+ var stickyOffset;
3505
+
3506
+ if (!self.breakpoint()) {
3507
+ var doToggle = topbar.hasClass('expanded');
3508
+ topbar
3509
+ .css('height', '')
3510
+ .removeClass('expanded')
3511
+ .find('li')
3512
+ .removeClass('hover');
3513
+
3514
+ if(doToggle) {
3515
+ self.toggle(topbar);
3516
+ }
3517
+ }
3518
+
3519
+ if(self.is_sticky(topbar, stickyContainer, settings)) {
3520
+ if(stickyContainer.hasClass('fixed')) {
3521
+ // Remove the fixed to allow for correct calculation of the offset.
3522
+ stickyContainer.removeClass('fixed');
3523
+
3524
+ stickyOffset = stickyContainer.offset().top;
3525
+ if(self.S(document.body).hasClass('f-topbar-fixed')) {
3526
+ stickyOffset -= topbar.data('height');
3527
+ }
3528
+
3529
+ topbar.data('stickyoffset', stickyOffset);
3530
+ stickyContainer.addClass('fixed');
3531
+ } else {
3532
+ stickyOffset = stickyContainer.offset().top;
3533
+ topbar.data('stickyoffset', stickyOffset);
3534
+ }
3535
+ }
3536
+
3537
+ });
3538
+ },
3539
+
3540
+ breakpoint : function () {
3541
+ return !matchMedia(Foundation.media_queries['topbar']).matches;
3542
+ },
3543
+
3544
+ small : function () {
3545
+ return matchMedia(Foundation.media_queries['small']).matches;
3546
+ },
3547
+
3548
+ medium : function () {
3549
+ return matchMedia(Foundation.media_queries['medium']).matches;
3550
+ },
3551
+
3552
+ large : function () {
3553
+ return matchMedia(Foundation.media_queries['large']).matches;
3554
+ },
3555
+
3556
+ assemble : function (topbar) {
3557
+ var self = this,
3558
+ settings = topbar.data(this.attr_name(true) + '-init'),
3559
+ section = self.S('section, .top-bar-section', topbar);
3560
+
3561
+ // Pull element out of the DOM for manipulation
3562
+ section.detach();
3563
+
3564
+ self.S('.has-dropdown>a', section).each(function () {
3565
+ var $link = self.S(this),
3566
+ $dropdown = $link.siblings('.dropdown'),
3567
+ url = $link.attr('href'),
3568
+ $titleLi;
3569
+
3570
+
3571
+ if (!$dropdown.find('.title.back').length) {
3572
+
3573
+ if (settings.mobile_show_parent_link == true && url) {
3574
+ $titleLi = $('<li class="title back js-generated"><h5><a href="javascript:void(0)"></a></h5></li><li class="parent-link show-for-small"><a class="parent-link js-generated" href="' + url + '">' + $link.html() +'</a></li>');
3575
+ } else {
3576
+ $titleLi = $('<li class="title back js-generated"><h5><a href="javascript:void(0)"></a></h5>');
3577
+ }
3578
+
3579
+ // Copy link to subnav
3580
+ if (settings.custom_back_text == true) {
3581
+ $('h5>a', $titleLi).html(settings.back_text);
3582
+ } else {
3583
+ $('h5>a', $titleLi).html('&laquo; ' + $link.html());
3584
+ }
3585
+ $dropdown.prepend($titleLi);
3586
+ }
3587
+ });
3588
+
3589
+ // Put element back in the DOM
3590
+ section.appendTo(topbar);
3591
+
3592
+ // check for sticky
3593
+ this.sticky();
3594
+
3595
+ this.assembled(topbar);
3596
+ },
3597
+
3598
+ assembled : function (topbar) {
3599
+ topbar.data(this.attr_name(true), $.extend({}, topbar.data(this.attr_name(true)), {assembled: true}));
3600
+ },
3601
+
3602
+ height : function (ul) {
3603
+ var total = 0,
3604
+ self = this;
3605
+
3606
+ $('> li', ul).each(function () {
3607
+ total += self.S(this).outerHeight(true);
3608
+ });
3609
+
3610
+ return total;
3611
+ },
3612
+
3613
+ sticky : function () {
3614
+ var self = this;
3615
+
3616
+ this.S(window).on('scroll', function() {
3617
+ self.update_sticky_positioning();
3618
+ });
3619
+ },
3620
+
3621
+ update_sticky_positioning: function() {
3622
+ var klass = '.' + this.settings.sticky_class,
3623
+ $window = this.S(window),
3624
+ self = this;
3625
+
3626
+ if (self.settings.sticky_topbar && self.is_sticky(this.settings.sticky_topbar,this.settings.sticky_topbar.parent(), this.settings)) {
3627
+ var distance = this.settings.sticky_topbar.data('stickyoffset');
3628
+ if (!self.S(klass).hasClass('expanded')) {
3629
+ if ($window.scrollTop() > (distance)) {
3630
+ if (!self.S(klass).hasClass('fixed')) {
3631
+ self.S(klass).addClass('fixed');
3632
+ self.S('body').addClass('f-topbar-fixed');
3633
+ }
3634
+ } else if ($window.scrollTop() <= distance) {
3635
+ if (self.S(klass).hasClass('fixed')) {
3636
+ self.S(klass).removeClass('fixed');
3637
+ self.S('body').removeClass('f-topbar-fixed');
3638
+ }
3639
+ }
3640
+ }
3641
+ }
3642
+ },
3643
+
3644
+ off : function () {
3645
+ this.S(this.scope).off('.fndtn.topbar');
3646
+ this.S(window).off('.fndtn.topbar');
3647
+ },
3648
+
3649
+ reflow : function () {}
3650
+ };
3651
+ }(jQuery, window, window.document));