· 5 years ago · Apr 22, 2020, 05:16 PM
1/*
2 * Foundation Responsive Library
3 * http://foundation.zurb.com
4 * Copyright 2013, ZURB
5 * Free to use under the MIT license.
6 * http://www.opensource.org/licenses/mit-license.php
7*/
8
9
10(function ($, window, document, undefined) {
11 'use strict';
12
13 // Used to retrieve Foundation media queries from CSS.
14 if($('head').has('.foundation-mq-small').length === 0) {
15 $('head').append('<meta class="foundation-mq-small">');
16 }
17
18 if($('head').has('.foundation-mq-medium').length === 0) {
19 $('head').append('<meta class="foundation-mq-medium">');
20 }
21
22 if($('head').has('.foundation-mq-large').length === 0) {
23 $('head').append('<meta class="foundation-mq-large">');
24 }
25
26 if($('head').has('.foundation-mq-xlarge').length === 0) {
27 $('head').append('<meta class="foundation-mq-xlarge">');
28 }
29
30 if($('head').has('.foundation-mq-xxlarge').length === 0) {
31 $('head').append('<meta class="foundation-mq-xxlarge">');
32 }
33
34 // Embed FastClick (this should be removed later)
35 function FastClick(layer){'use strict';var oldOnClick,self=this;this.trackingClick=false;this.trackingClickStart=0;this.targetElement=null;this.touchStartX=0;this.touchStartY=0;this.lastTouchIdentifier=0;this.touchBoundary=10;this.layer=layer;if(!layer||!layer.nodeType){throw new TypeError('Layer must be a document node');}this.onClick=function(){return FastClick.prototype.onClick.apply(self,arguments)};this.onMouse=function(){return FastClick.prototype.onMouse.apply(self,arguments)};this.onTouchStart=function(){return FastClick.prototype.onTouchStart.apply(self,arguments)};this.onTouchMove=function(){return FastClick.prototype.onTouchMove.apply(self,arguments)};this.onTouchEnd=function(){return FastClick.prototype.onTouchEnd.apply(self,arguments)};this.onTouchCancel=function(){return FastClick.prototype.onTouchCancel.apply(self,arguments)};if(FastClick.notNeeded(layer)){return}if(this.deviceIsAndroid){layer.addEventListener('mouseover',this.onMouse,true);layer.addEventListener('mousedown',this.onMouse,true);layer.addEventListener('mouseup',this.onMouse,true)}layer.addEventListener('click',this.onClick,true);layer.addEventListener('touchstart',this.onTouchStart,false);layer.addEventListener('touchmove',this.onTouchMove,false);layer.addEventListener('touchend',this.onTouchEnd,false);layer.addEventListener('touchcancel',this.onTouchCancel,false);if(!Event.prototype.stopImmediatePropagation){layer.removeEventListener=function(type,callback,capture){var rmv=Node.prototype.removeEventListener;if(type==='click'){rmv.call(layer,type,callback.hijacked||callback,capture)}else{rmv.call(layer,type,callback,capture)}};layer.addEventListener=function(type,callback,capture){var adv=Node.prototype.addEventListener;if(type==='click'){adv.call(layer,type,callback.hijacked||(callback.hijacked=function(event){if(!event.propagationStopped){callback(event)}}),capture)}else{adv.call(layer,type,callback,capture)}}}if(typeof layer.onclick==='function'){oldOnClick=layer.onclick;layer.addEventListener('click',function(event){oldOnClick(event)},false);layer.onclick=null}}FastClick.prototype.deviceIsAndroid=navigator.userAgent.indexOf('Android')>0;FastClick.prototype.deviceIsIOS=/iP(ad|hone|od)/.test(navigator.userAgent);FastClick.prototype.deviceIsIOS4=FastClick.prototype.deviceIsIOS&&(/OS 4_\d(_\d)?/).test(navigator.userAgent);FastClick.prototype.deviceIsIOSWithBadTarget=FastClick.prototype.deviceIsIOS&&(/OS ([6-9]|\d{2})_\d/).test(navigator.userAgent);FastClick.prototype.needsClick=function(target){'use strict';switch(target.nodeName.toLowerCase()){case'button':case'select':case'textarea':if(target.disabled){return true}break;case'input':if((this.deviceIsIOS&&target.type==='file')||target.disabled){return true}break;case'label':case'video':return true}return(/\bneedsclick\b/).test(target.className)};FastClick.prototype.needsFocus=function(target){'use strict';switch(target.nodeName.toLowerCase()){case'textarea':case'select':return true;case'input':switch(target.type){case'button':case'checkbox':case'file':case'image':case'radio':case'submit':return false}return!target.disabled&&!target.readOnly;default:return(/\bneedsfocus\b/).test(target.className)}};FastClick.prototype.sendClick=function(targetElement,event){'use strict';var clickEvent,touch;if(document.activeElement&&document.activeElement!==targetElement){document.activeElement.blur()}touch=event.changedTouches[0];clickEvent=document.createEvent('MouseEvents');clickEvent.initMouseEvent('click',true,true,window,1,touch.screenX,touch.screenY,touch.clientX,touch.clientY,false,false,false,false,0,null);clickEvent.forwardedTouchEvent=true;targetElement.dispatchEvent(clickEvent)};FastClick.prototype.focus=function(targetElement){'use strict';var length;if(this.deviceIsIOS&&targetElement.setSelectionRange){length=targetElement.value.length;targetElement.setSelectionRange(length,length)}else{targetElement.focus()}};FastClick.prototype.updateScrollParent=function(targetElement){'use strict';var scrollParent,parentElement;scrollParent=targetElement.fastClickScrollParent;if(!scrollParent||!scrollParent.contains(targetElement)){parentElement=targetElement;do{if(parentElement.scrollHeight>parentElement.offsetHeight){scrollParent=parentElement;targetElement.fastClickScrollParent=parentElement;break}parentElement=parentElement.parentElement}while(parentElement)}if(scrollParent){scrollParent.fastClickLastScrollTop=scrollParent.scrollTop}};FastClick.prototype.getTargetElementFromEventTarget=function(eventTarget){'use strict';if(eventTarget.nodeType===Node.TEXT_NODE){return eventTarget.parentNode}return eventTarget};FastClick.prototype.onTouchStart=function(event){'use strict';var targetElement,touch,selection;if(event.targetTouches.length>1){return true}targetElement=this.getTargetElementFromEventTarget(event.target);touch=event.targetTouches[0];if(this.deviceIsIOS){selection=window.getSelection();if(selection.rangeCount&&!selection.isCollapsed){return true}if(!this.deviceIsIOS4){if(touch.identifier===this.lastTouchIdentifier){event.preventDefault();return false}this.lastTouchIdentifier=touch.identifier;this.updateScrollParent(targetElement)}}this.trackingClick=true;this.trackingClickStart=event.timeStamp;this.targetElement=targetElement;this.touchStartX=touch.pageX;this.touchStartY=touch.pageY;if((event.timeStamp-this.lastClickTime)<200){event.preventDefault()}return true};FastClick.prototype.touchHasMoved=function(event){'use strict';var touch=event.changedTouches[0],boundary=this.touchBoundary;if(Math.abs(touch.pageX-this.touchStartX)>boundary||Math.abs(touch.pageY-this.touchStartY)>boundary){return true}return false};FastClick.prototype.onTouchMove=function(event){'use strict';if(!this.trackingClick){return true}if(this.targetElement!==this.getTargetElementFromEventTarget(event.target)||this.touchHasMoved(event)){this.trackingClick=false;this.targetElement=null}return true};FastClick.prototype.findControl=function(labelElement){'use strict';if(labelElement.control!==undefined){return labelElement.control}if(labelElement.htmlFor){return document.getElementById(labelElement.htmlFor)}return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea')};FastClick.prototype.onTouchEnd=function(event){'use strict';var forElement,trackingClickStart,targetTagName,scrollParent,touch,targetElement=this.targetElement;if(!this.trackingClick){return true}if((event.timeStamp-this.lastClickTime)<200){this.cancelNextClick=true;return true}this.lastClickTime=event.timeStamp;trackingClickStart=this.trackingClickStart;this.trackingClick=false;this.trackingClickStart=0;if(this.deviceIsIOSWithBadTarget){touch=event.changedTouches[0];targetElement=document.elementFromPoint(touch.pageX-window.pageXOffset,touch.pageY-window.pageYOffset)||targetElement;targetElement.fastClickScrollParent=this.targetElement.fastClickScrollParent}targetTagName=targetElement.tagName.toLowerCase();if(targetTagName==='label'){forElement=this.findControl(targetElement);if(forElement){this.focus(targetElement);if(this.deviceIsAndroid){return false}targetElement=forElement}}else if(this.needsFocus(targetElement)){if((event.timeStamp-trackingClickStart)>100||(this.deviceIsIOS&&window.top!==window&&targetTagName==='input')){this.targetElement=null;return false}this.focus(targetElement);if(!this.deviceIsIOS4||targetTagName!=='select'){this.targetElement=null;event.preventDefault()}return false}if(this.deviceIsIOS&&!this.deviceIsIOS4){scrollParent=targetElement.fastClickScrollParent;if(scrollParent&&scrollParent.fastClickLastScrollTop!==scrollParent.scrollTop){return true}}if(!this.needsClick(targetElement)){event.preventDefault();this.sendClick(targetElement,event)}return false};FastClick.prototype.onTouchCancel=function(){'use strict';this.trackingClick=false;this.targetElement=null};FastClick.prototype.onMouse=function(event){'use strict';if(!this.targetElement){return true}if(event.forwardedTouchEvent){return true}if(!event.cancelable){return true}if(!this.needsClick(this.targetElement)||this.cancelNextClick){if(event.stopImmediatePropagation){event.stopImmediatePropagation()}else{event.propagationStopped=true}event.stopPropagation();event.preventDefault();return false}return true};FastClick.prototype.onClick=function(event){'use strict';var permitted;if(this.trackingClick){this.targetElement=null;this.trackingClick=false;return true}if(event.target.type==='submit'&&event.detail===0){return true}permitted=this.onMouse(event);if(!permitted){this.targetElement=null}return permitted};FastClick.prototype.destroy=function(){'use strict';var layer=this.layer;if(this.deviceIsAndroid){layer.removeEventListener('mouseover',this.onMouse,true);layer.removeEventListener('mousedown',this.onMouse,true);layer.removeEventListener('mouseup',this.onMouse,true)}layer.removeEventListener('click',this.onClick,true);layer.removeEventListener('touchstart',this.onTouchStart,false);layer.removeEventListener('touchmove',this.onTouchMove,false);layer.removeEventListener('touchend',this.onTouchEnd,false);layer.removeEventListener('touchcancel',this.onTouchCancel,false)};FastClick.notNeeded=function(layer){'use strict';var metaViewport;if(typeof window.ontouchstart==='undefined'){return true}if((/Chrome\/[0-9]+/).test(navigator.userAgent)){if(FastClick.prototype.deviceIsAndroid){metaViewport=document.querySelector('meta[name=viewport]');if(metaViewport&&metaViewport.content.indexOf('user-scalable=no')!==-1){return true}}else{return true}}if(layer.style.msTouchAction==='none'){return true}return false};FastClick.attach=function(layer){'use strict';return new FastClick(layer)};if(typeof define!=='undefined'&&define.amd){define(function(){'use strict';return FastClick})}else if(typeof module!=='undefined'&&module.exports){module.exports=FastClick.attach;module.exports.FastClick=FastClick}else{window.FastClick=FastClick}
36
37
38 // Enable FastClick
39 if(typeof FastClick !== 'undefined') {
40 FastClick.attach(document.body);
41 }
42
43 // private Fast Selector wrapper,
44 // returns jQuery object. Only use where
45 // getElementById is not available.
46 var S = function (selector, context) {
47 if (typeof selector === 'string') {
48 if (context) {
49 return $(context.querySelectorAll(selector));
50 }
51
52 return $(document.querySelectorAll(selector));
53 }
54
55 return $(selector, context);
56 };
57
58 /*
59 https://github.com/paulirish/matchMedia.js
60 */
61
62 window.matchMedia = window.matchMedia || (function( doc, undefined ) {
63
64 "use strict";
65
66 var bool,
67 docElem = doc.documentElement,
68 refNode = docElem.firstElementChild || docElem.firstChild,
69 // fakeBody required for <FF4 when executed in <head>
70 fakeBody = doc.createElement( "body" ),
71 div = doc.createElement( "div" );
72
73 div.id = "mq-test-1";
74 div.style.cssText = "position:absolute;top:-100em";
75 fakeBody.style.background = "none";
76 fakeBody.appendChild(div);
77
78 return function(q){
79
80 div.innerHTML = "­<style media=\"" + q + "\"> #mq-test-1 { width: 42px; }</style>";
81
82 docElem.insertBefore( fakeBody, refNode );
83 bool = div.offsetWidth === 42;
84 docElem.removeChild( fakeBody );
85
86 return {
87 matches: bool,
88 media: q
89 };
90
91 };
92
93 }( document ));
94
95 /*
96 * jquery.requestAnimationFrame
97 * https://github.com/gnarf37/jquery-requestAnimationFrame
98 * Requires jQuery 1.8+
99 *
100 * Copyright (c) 2012 Corey Frang
101 * Licensed under the MIT license.
102 */
103
104 (function( $ ) {
105
106 // requestAnimationFrame polyfill adapted from Erik Möller
107 // fixes from Paul Irish and Tino Zijdel
108 // http://paulirish.com/2011/requestanimationframe-for-smart-animating/
109 // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
110
111
112 var animating,
113 lastTime = 0,
114 vendors = ['webkit', 'moz'],
115 requestAnimationFrame = window.requestAnimationFrame,
116 cancelAnimationFrame = window.cancelAnimationFrame;
117
118 for(; lastTime < vendors.length && !requestAnimationFrame; lastTime++) {
119 requestAnimationFrame = window[ vendors[lastTime] + "RequestAnimationFrame" ];
120 cancelAnimationFrame = cancelAnimationFrame ||
121 window[ vendors[lastTime] + "CancelAnimationFrame" ] ||
122 window[ vendors[lastTime] + "CancelRequestAnimationFrame" ];
123 }
124
125 function raf() {
126 if ( animating ) {
127 requestAnimationFrame( raf );
128 jQuery.fx.tick();
129 }
130 }
131
132 if ( requestAnimationFrame ) {
133 // use rAF
134 window.requestAnimationFrame = requestAnimationFrame;
135 window.cancelAnimationFrame = cancelAnimationFrame;
136 jQuery.fx.timer = function( timer ) {
137 if ( timer() && jQuery.timers.push( timer ) && !animating ) {
138 animating = true;
139 raf();
140 }
141 };
142
143 jQuery.fx.stop = function() {
144 animating = false;
145 };
146 } else {
147 // polyfill
148 window.requestAnimationFrame = function( callback, element ) {
149 var currTime = new Date().getTime(),
150 timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) ),
151 id = window.setTimeout( function() {
152 callback( currTime + timeToCall );
153 }, timeToCall );
154 lastTime = currTime + timeToCall;
155 return id;
156 };
157
158 window.cancelAnimationFrame = function(id) {
159 clearTimeout(id);
160 };
161
162 }
163
164 }( jQuery ));
165
166
167 function removeQuotes (string) {
168 if (typeof string === 'string' || string instanceof String) {
169 string = string.replace(/^[\\/'"]+|(;\s?})+|[\\/'"]+$/g, '');
170 }
171
172 return string;
173 }
174
175 window.Foundation = {
176 name : 'Foundation',
177
178 version : '5.0.0',
179
180 media_queries : {
181 small : S('.foundation-mq-small').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
182 medium : S('.foundation-mq-medium').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
183 large : S('.foundation-mq-large').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
184 xlarge: S('.foundation-mq-xlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
185 xxlarge: S('.foundation-mq-xxlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, '')
186 },
187
188 stylesheet : $('<style></style>').appendTo('head')[0].sheet,
189
190 init : function (scope, libraries, method, options, response) {
191 var library_arr,
192 args = [scope, method, options, response],
193 responses = [];
194
195 // check RTL
196 this.rtl = /rtl/i.test(S('html').attr('dir'));
197
198 // set foundation global scope
199 this.scope = scope || this.scope;
200
201 if (libraries && typeof libraries === 'string' && !/reflow/i.test(libraries)) {
202 if (this.libs.hasOwnProperty(libraries)) {
203 responses.push(this.init_lib(libraries, args));
204 }
205 } else {
206 for (var lib in this.libs) {
207 responses.push(this.init_lib(lib, libraries));
208 }
209 }
210
211 return scope;
212 },
213
214 init_lib : function (lib, args) {
215 if (this.libs.hasOwnProperty(lib)) {
216 this.patch(this.libs[lib]);
217
218 if (args && args.hasOwnProperty(lib)) {
219 return this.libs[lib].init.apply(this.libs[lib], [this.scope, args[lib]]);
220 }
221
222 return this.libs[lib].init.apply(this.libs[lib], args);
223 }
224
225 return function () {};
226 },
227
228 patch : function (lib) {
229 lib.scope = this.scope;
230 lib['data_options'] = this.lib_methods.data_options;
231 lib['bindings'] = this.lib_methods.bindings;
232 lib['S'] = S;
233 lib.rtl = this.rtl;
234 },
235
236 inherit : function (scope, methods) {
237 var methods_arr = methods.split(' ');
238
239 for (var i = methods_arr.length - 1; i >= 0; i--) {
240 if (this.lib_methods.hasOwnProperty(methods_arr[i])) {
241 this.libs[scope.name][methods_arr[i]] = this.lib_methods[methods_arr[i]];
242 }
243 }
244 },
245
246 random_str : function (length) {
247 var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
248
249 if (!length) {
250 length = Math.floor(Math.random() * chars.length);
251 }
252
253 var str = '';
254 for (var i = 0; i < length; i++) {
255 str += chars[Math.floor(Math.random() * chars.length)];
256 }
257 return str;
258 },
259
260 libs : {},
261
262 // methods that can be inherited in libraries
263 lib_methods : {
264 throttle : function(fun, delay) {
265 var timer = null;
266
267 return function () {
268 var context = this, args = arguments;
269
270 clearTimeout(timer);
271 timer = setTimeout(function () {
272 fun.apply(context, args);
273 }, delay);
274 };
275 },
276
277 // parses data-options attribute
278 data_options : function (el) {
279 var opts = {}, ii, p, opts_arr, opts_len,
280 data_options = el.data('options');
281
282 if (typeof data_options === 'object') {
283 return data_options;
284 }
285
286 opts_arr = (data_options || ':').split(';'),
287 opts_len = opts_arr.length;
288
289 function isNumber (o) {
290 return ! isNaN (o-0) && o !== null && o !== "" && o !== false && o !== true;
291 }
292
293 function trim(str) {
294 if (typeof str === 'string') return $.trim(str);
295 return str;
296 }
297
298 // parse options
299 for (ii = opts_len - 1; ii >= 0; ii--) {
300 p = opts_arr[ii].split(':');
301
302 if (/true/i.test(p[1])) p[1] = true;
303 if (/false/i.test(p[1])) p[1] = false;
304 if (isNumber(p[1])) p[1] = parseInt(p[1], 10);
305
306 if (p.length === 2 && p[0].length > 0) {
307 opts[trim(p[0])] = trim(p[1]);
308 }
309 }
310
311 return opts;
312 },
313
314 delay : function (fun, delay) {
315 return setTimeout(fun, delay);
316 },
317
318 // test for empty object or array
319 empty : function (obj) {
320 if (obj.length && obj.length > 0) return false;
321 if (obj.length && obj.length === 0) return true;
322
323 for (var key in obj) {
324 if (hasOwnProperty.call(obj, key)) return false;
325 }
326
327 return true;
328 },
329
330 register_media : function(media, media_class) {
331 if(Foundation.media_queries[media] === undefined) {
332 $('head').append('<meta class="' + media_class + '">');
333 Foundation.media_queries[media] = removeQuotes($('.' + media_class).css('font-family'));
334 }
335 },
336
337 addCustomRule : function(rule, media) {
338 if(media === undefined) {
339 Foundation.stylesheet.insertRule(rule, Foundation.stylesheet.cssRules.length);
340 } else {
341 var query = Foundation.media_queries[media];
342 if(query !== undefined) {
343 Foundation.stylesheet.insertRule('@media ' +
344 Foundation.media_queries[media] + '{ ' + rule + ' }');
345 }
346 }
347 },
348
349 loaded : function (image, callback) {
350 function loaded () {
351 callback(image[0]);
352 }
353
354 function bindLoad () {
355 this.one('load', loaded);
356
357 if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
358 var src = this.attr( 'src' ),
359 param = src.match( /\?/ ) ? '&' : '?';
360
361 param += 'random=' + (new Date()).getTime();
362 this.attr('src', src + param);
363 }
364 }
365
366 if (!image.attr('src')) {
367 loaded();
368 return;
369 }
370
371 if (image[0].complete || image[0].readyState === 4) {
372 loaded();
373 } else {
374 bindLoad.call(image);
375 }
376 },
377
378 bindings : function (method, options) {
379 var self = this,
380 should_bind_events = !S(this).data(this.name + '-init');
381
382 if (typeof method === 'string') {
383 return this[method].call(this);
384 }
385
386 if (S(this.scope).is('[data-' + this.name +']')) {
387 S(this.scope).data(this.name + '-init', $.extend({}, this.settings, (options || method), this.data_options(S(this.scope))));
388
389 if (should_bind_events) {
390 this.events(this.scope);
391 }
392
393 } else {
394 S('[data-' + this.name + ']', this.scope).each(function () {
395 var should_bind_events = !S(this).data(self.name + '-init');
396
397 S(this).data(self.name + '-init', $.extend({}, self.settings, (options || method), self.data_options(S(this))));
398
399 if (should_bind_events) {
400 self.events(this);
401 }
402 });
403 }
404 }
405 }
406 };
407
408 $.fn.foundation = function () {
409 var args = Array.prototype.slice.call(arguments, 0);
410
411 return this.each(function () {
412 Foundation.init.apply(Foundation, [this].concat(args));
413 return this;
414 });
415 };
416
417}(jQuery, this, this.document));
418
419;(function ($, window, document, undefined) {
420 'use strict';
421
422 Foundation.libs.abide = {
423 name : 'abide',
424
425 version : '5.0.0',
426
427 settings : {
428 focus_on_invalid : true,
429 timeout : 1000,
430 patterns : {
431 alpha: /[a-zA-Z]+/,
432 alpha_numeric : /[a-zA-Z0-9]+/,
433 integer: /-?\d+/,
434 number: /-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?/,
435
436 // generic password: upper-case, lower-case, number/special character, and min 8 characters
437 password : /(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,
438
439 // amex, visa, diners
440 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})$/,
441 cvv : /^([0-9]){3,4}$/,
442
443 // http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address
444 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])?)*$/,
445
446 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})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?/,
447 // abc.de
448 domain: /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/,
449
450 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))/,
451 // YYYY-MM-DD
452 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))/,
453 // HH:MM:SS
454 time : /(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}/,
455 dateISO: /\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/,
456 // MM/DD/YYYY
457 month_day_year : /(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.](19|20)\d\d/,
458
459 // #FFF or #FFFFFF
460 color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/
461 }
462 },
463
464 timer : null,
465
466 init : function (scope, method, options) {
467 this.bindings(method, options);
468 },
469
470 events : function (scope) {
471 var self = this,
472 form = $(scope).attr('novalidate', 'novalidate'),
473 settings = form.data('abide-init');
474
475 form
476 .off('.abide')
477 .on('submit.fndtn.abide validate.fndtn.abide', function (e) {
478 var is_ajax = /ajax/i.test($(this).attr('data-abide'));
479 return self.validate($(this).find('input, textarea, select').get(), e, is_ajax);
480 })
481 .find('input, textarea, select')
482 .off('.abide')
483 .on('blur.fndtn.abide change.fndtn.abide', function (e) {
484 self.validate([this], e);
485 })
486 .on('keydown.fndtn.abide', function (e) {
487 var settings = $(this).closest('form').data('abide-init');
488 clearTimeout(self.timer);
489 self.timer = setTimeout(function () {
490 self.validate([this], e);
491 }.bind(this), settings.timeout);
492 });
493 },
494
495 validate : function (els, e, is_ajax) {
496 var validations = this.parse_patterns(els),
497 validation_count = validations.length,
498 form = $(els[0]).closest('form'),
499 submit_event = /submit/.test(e.type);
500
501 for (var i=0; i < validation_count; i++) {
502 if (!validations[i] && (submit_event || is_ajax)) {
503 if (this.settings.focus_on_invalid) els[i].focus();
504 form.trigger('invalid');
505 $(els[i]).closest('form').attr('data-invalid', '');
506 return false;
507 }
508 }
509
510 if (submit_event || is_ajax) {
511 form.trigger('valid');
512 }
513
514 form.removeAttr('data-invalid');
515
516 if (is_ajax) return false;
517
518 return true;
519 },
520
521 parse_patterns : function (els) {
522 var count = els.length,
523 el_patterns = [];
524
525 for (var i = count - 1; i >= 0; i--) {
526 el_patterns.push(this.pattern(els[i]));
527 }
528
529 return this.check_validation_and_apply_styles(el_patterns);
530 },
531
532 pattern : function (el) {
533 var type = el.getAttribute('type'),
534 required = typeof el.getAttribute('required') === 'string';
535
536 if (this.settings.patterns.hasOwnProperty(type)) {
537 return [el, this.settings.patterns[type], required];
538 }
539
540 var pattern = el.getAttribute('pattern') || '';
541
542 if (this.settings.patterns.hasOwnProperty(pattern) && pattern.length > 0) {
543 return [el, this.settings.patterns[pattern], required];
544 } else if (pattern.length > 0) {
545 return [el, new RegExp(pattern), required];
546 }
547
548 pattern = /.*/;
549
550 return [el, pattern, required];
551 },
552
553 check_validation_and_apply_styles : function (el_patterns) {
554 var count = el_patterns.length,
555 validations = [];
556
557 for (var i = count - 1; i >= 0; i--) {
558 var el = el_patterns[i][0],
559 required = el_patterns[i][2],
560 value = el.value,
561 is_equal = el.getAttribute('data-equalto'),
562 is_radio = el.type === "radio",
563 valid_length = (required) ? (el.value.length > 0) : true;
564
565 if (is_radio && required) {
566 validations.push(this.valid_radio(el, required));
567 } else if (is_equal && required) {
568 validations.push(this.valid_equal(el, required));
569 } else {
570 if (el_patterns[i][1].test(value) && valid_length ||
571 !required && el.value.length < 1) {
572 $(el).removeAttr('data-invalid').parent().removeClass('error');
573 validations.push(true);
574 } else {
575 $(el).attr('data-invalid', '').parent().addClass('error');
576 validations.push(false);
577 }
578 }
579 }
580
581 return validations;
582 },
583
584 valid_radio : function (el, required) {
585 var name = el.getAttribute('name'),
586 group = document.getElementsByName(name),
587 count = group.length,
588 valid = false;
589
590 for (var i=0; i < count; i++) {
591 if (group[i].checked) valid = true;
592 }
593
594 for (var i=0; i < count; i++) {
595 if (valid) {
596 $(group[i]).removeAttr('data-invalid').parent().removeClass('error');
597 } else {
598 $(group[i]).attr('data-invalid', '').parent().addClass('error');
599 }
600 }
601
602 return valid;
603 },
604
605 valid_equal: function(el, required) {
606 var from = document.getElementById(el.getAttribute('data-equalto')).value,
607 to = el.value,
608 valid = (from === to);
609
610 if (valid) {
611 $(el).removeAttr('data-invalid').parent().removeClass('error');
612 } else {
613 $(el).attr('data-invalid', '').parent().addClass('error');
614 }
615
616 return valid;
617 }
618 };
619}(jQuery, this, this.document));
620;(function ($, window, document, undefined) {
621 'use strict';
622
623 Foundation.libs.accordion = {
624 name : 'accordion',
625
626 version : '5.0.1',
627
628 settings : {
629 active_class: 'active',
630 toggleable: true
631 },
632
633 init : function (scope, method, options) {
634 this.bindings(method, options);
635 },
636
637 events : function () {
638 $(this.scope).off('.accordion').on('click.fndtn.accordion', '[data-accordion] > dd > a', function (e) {
639 var accordion = $(this).parent(),
640 target = $('#' + this.href.split('#')[1]),
641 siblings = $('> dd > .content', target.closest('[data-accordion]')),
642 settings = accordion.parent().data('accordion-init'),
643 active = $('> dd > .content.' + settings.active_class, accordion.parent());
644
645 e.preventDefault();
646
647 if (active[0] == target[0] && settings.toggleable) {
648 return target.toggleClass(settings.active_class);
649 }
650
651 siblings.removeClass(settings.active_class);
652 target.addClass(settings.active_class);
653 });
654 },
655
656 off : function () {},
657
658 reflow : function () {}
659 };
660}(jQuery, this, this.document));
661
662;(function ($, window, document, undefined) {
663 'use strict';
664
665 Foundation.libs.alert = {
666 name : 'alert',
667
668 version : '5.0.0',
669
670 settings : {
671 animation: 'fadeOut',
672 speed: 300, // fade out speed
673 callback: function (){}
674 },
675
676 init : function (scope, method, options) {
677 this.bindings(method, options);
678 },
679
680 events : function () {
681 $(this.scope).off('.alert').on('click.fndtn.alert', '[data-alert] a.close', function (e) {
682 var alertBox = $(this).closest("[data-alert]"),
683 settings = alertBox.data('alert-init');
684
685 e.preventDefault();
686 alertBox[settings.animation](settings.speed, function () {
687 $(this).trigger('closed').remove();
688 settings.callback();
689 });
690 });
691 },
692
693 reflow : function () {}
694 };
695}(jQuery, this, this.document));
696;(function ($, window, document, undefined) {
697 'use strict';
698
699 Foundation.libs.clearing = {
700 name : 'clearing',
701
702 version: '5.0.0',
703
704 settings : {
705 templates : {
706 viewing : '<a href="#" class="clearing-close">×</a>' +
707 '<div class="visible-img" style="display: none"><img src="//:0">' +
708 '<p class="clearing-caption"></p><a href="#" class="clearing-main-prev"><span></span></a>' +
709 '<a href="#" class="clearing-main-next"><span></span></a></div>'
710 },
711
712 // comma delimited list of selectors that, on click, will close clearing,
713 // add 'div.clearing-blackout, div.visible-img' to close on background click
714 close_selectors : '.clearing-close',
715
716 // event initializers and locks
717 init : false,
718 locked : false
719 },
720
721 init : function (scope, method, options) {
722 var self = this;
723 Foundation.inherit(this, 'throttle loaded');
724
725 this.bindings(method, options);
726
727 if ($(this.scope).is('[data-clearing]')) {
728 this.assemble($('li', this.scope));
729 } else {
730 $('[data-clearing]', this.scope).each(function () {
731 self.assemble($('li', this));
732 });
733 }
734 },
735
736 events : function (scope) {
737 var self = this;
738
739 $(this.scope)
740 .off('.clearing')
741 .on('click.fndtn.clearing', 'ul[data-clearing] li',
742 function (e, current, target) {
743 var current = current || $(this),
744 target = target || current,
745 next = current.next('li'),
746 settings = current.closest('[data-clearing]').data('clearing-init'),
747 image = $(e.target);
748
749 e.preventDefault();
750
751 if (!settings) {
752 self.init();
753 settings = current.closest('[data-clearing]').data('clearing-init');
754 }
755
756 // if clearing is open and the current image is
757 // clicked, go to the next image in sequence
758 if (target.hasClass('visible') &&
759 current[0] === target[0] &&
760 next.length > 0 && self.is_open(current)) {
761 target = next;
762 image = $('img', target);
763 }
764
765 // set current and target to the clicked li if not otherwise defined.
766 self.open(image, current, target);
767 self.update_paddles(target);
768 })
769
770 .on('click.fndtn.clearing', '.clearing-main-next',
771 function (e) { self.nav(e, 'next') })
772 .on('click.fndtn.clearing', '.clearing-main-prev',
773 function (e) { self.nav(e, 'prev') })
774 .on('click.fndtn.clearing', this.settings.close_selectors,
775 function (e) { Foundation.libs.clearing.close(e, this) })
776 .on('keydown.fndtn.clearing',
777 function (e) { self.keydown(e) });
778
779 $(window).off('.clearing').on('resize.fndtn.clearing',
780 function () { self.resize() });
781
782 this.swipe_events(scope);
783 },
784
785 swipe_events : function (scope) {
786 var self = this;
787
788 $(this.scope)
789 .on('touchstart.fndtn.clearing', '.visible-img', function(e) {
790 if (!e.touches) { e = e.originalEvent; }
791 var data = {
792 start_page_x: e.touches[0].pageX,
793 start_page_y: e.touches[0].pageY,
794 start_time: (new Date()).getTime(),
795 delta_x: 0,
796 is_scrolling: undefined
797 };
798
799 $(this).data('swipe-transition', data);
800 e.stopPropagation();
801 })
802 .on('touchmove.fndtn.clearing', '.visible-img', function(e) {
803 if (!e.touches) { e = e.originalEvent; }
804 // Ignore pinch/zoom events
805 if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
806
807 var data = $(this).data('swipe-transition');
808
809 if (typeof data === 'undefined') {
810 data = {};
811 }
812
813 data.delta_x = e.touches[0].pageX - data.start_page_x;
814
815 if ( typeof data.is_scrolling === 'undefined') {
816 data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
817 }
818
819 if (!data.is_scrolling && !data.active) {
820 e.preventDefault();
821 var direction = (data.delta_x < 0) ? 'next' : 'prev';
822 data.active = true;
823 self.nav(e, direction);
824 }
825 })
826 .on('touchend.fndtn.clearing', '.visible-img', function(e) {
827 $(this).data('swipe-transition', {});
828 e.stopPropagation();
829 });
830 },
831
832 assemble : function ($li) {
833 var $el = $li.parent();
834
835 if ($el.parent().hasClass('carousel')) return;
836 $el.after('<div id="foundationClearingHolder"></div>');
837
838 var holder = $('#foundationClearingHolder'),
839 settings = $el.data('clearing-init'),
840 grid = $el.detach(),
841 data = {
842 grid: '<div class="carousel">' + grid[0].outerHTML + '</div>',
843 viewing: settings.templates.viewing
844 },
845 wrapper = '<div class="clearing-assembled"><div>' + data.viewing +
846 data.grid + '</div></div>';
847
848 return holder.after(wrapper).remove();
849 },
850
851 open : function ($image, current, target) {
852 var root = target.closest('.clearing-assembled'),
853 container = $('div', root).first(),
854 visible_image = $('.visible-img', container),
855 image = $('img', visible_image).not($image);
856
857 if (!this.locked()) {
858 // set the image to the selected thumbnail
859 image
860 .attr('src', this.load($image))
861 .css('visibility', 'hidden');
862
863 this.loaded(image, function () {
864 image.css('visibility', 'visible');
865 // toggle the gallery
866 root.addClass('clearing-blackout');
867 container.addClass('clearing-container');
868 visible_image.show();
869 this.fix_height(target)
870 .caption($('.clearing-caption', visible_image), $image)
871 .center(image)
872 .shift(current, target, function () {
873 target.siblings().removeClass('visible');
874 target.addClass('visible');
875 });
876 }.bind(this));
877 }
878 },
879
880 close : function (e, el) {
881 e.preventDefault();
882
883 var root = (function (target) {
884 if (/blackout/.test(target.selector)) {
885 return target;
886 } else {
887 return target.closest('.clearing-blackout');
888 }
889 }($(el))), container, visible_image;
890
891 if (el === e.target && root) {
892 container = $('div', root).first();
893 visible_image = $('.visible-img', container);
894 this.settings.prev_index = 0;
895 $('ul[data-clearing]', root)
896 .attr('style', '').closest('.clearing-blackout')
897 .removeClass('clearing-blackout');
898 container.removeClass('clearing-container');
899 visible_image.hide();
900 }
901
902 return false;
903 },
904
905 is_open : function (current) {
906 return current.parent().prop('style').length > 0;
907 },
908
909 keydown : function (e) {
910 var clearing = $('ul[data-clearing]', '.clearing-blackout');
911
912 if (e.which === 39) this.go(clearing, 'next');
913 if (e.which === 37) this.go(clearing, 'prev');
914 if (e.which === 27) $('a.clearing-close').trigger('click');
915 },
916
917 nav : function (e, direction) {
918 var clearing = $('ul[data-clearing]', '.clearing-blackout');
919
920 e.preventDefault();
921 this.go(clearing, direction);
922 },
923
924 resize : function () {
925 var image = $('img', '.clearing-blackout .visible-img');
926
927 if (image.length) {
928 this.center(image);
929 }
930 },
931
932 // visual adjustments
933 fix_height : function (target) {
934 var lis = target.parent().children(),
935 self = this;
936
937 lis.each(function () {
938 var li = $(this),
939 image = li.find('img');
940
941 if (li.height() > image.outerHeight()) {
942 li.addClass('fix-height');
943 }
944 })
945 .closest('ul')
946 .width(lis.length * 100 + '%');
947
948 return this;
949 },
950
951 update_paddles : function (target) {
952 var visible_image = target
953 .closest('.carousel')
954 .siblings('.visible-img');
955
956 if (target.next().length > 0) {
957 $('.clearing-main-next', visible_image)
958 .removeClass('disabled');
959 } else {
960 $('.clearing-main-next', visible_image)
961 .addClass('disabled');
962 }
963
964 if (target.prev().length > 0) {
965 $('.clearing-main-prev', visible_image)
966 .removeClass('disabled');
967 } else {
968 $('.clearing-main-prev', visible_image)
969 .addClass('disabled');
970 }
971 },
972
973 center : function (target) {
974 if (!this.rtl) {
975 target.css({
976 marginLeft : -(target.outerWidth() / 2),
977 marginTop : -(target.outerHeight() / 2)
978 });
979 } else {
980 target.css({
981 marginRight : -(target.outerWidth() / 2),
982 marginTop : -(target.outerHeight() / 2)
983 });
984 }
985 return this;
986 },
987
988 // image loading and preloading
989
990 load : function ($image) {
991 if ($image[0].nodeName === "A") {
992 var href = $image.attr('href');
993 } else {
994 var href = $image.parent().attr('href');
995 }
996
997 this.preload($image);
998
999 if (href) return href;
1000 return $image.attr('src');
1001 },
1002
1003 preload : function ($image) {
1004 this
1005 .img($image.closest('li').next())
1006 .img($image.closest('li').prev());
1007 },
1008
1009 img : function (img) {
1010 if (img.length) {
1011 var new_img = new Image(),
1012 new_a = $('a', img);
1013
1014 if (new_a.length) {
1015 new_img.src = new_a.attr('href');
1016 } else {
1017 new_img.src = $('img', img).attr('src');
1018 }
1019 }
1020 return this;
1021 },
1022
1023 // image caption
1024
1025 caption : function (container, $image) {
1026 var caption = $image.data('caption');
1027
1028 if (caption) {
1029 container
1030 .html(caption)
1031 .show();
1032 } else {
1033 container
1034 .text('')
1035 .hide();
1036 }
1037 return this;
1038 },
1039
1040 // directional methods
1041
1042 go : function ($ul, direction) {
1043 var current = $('.visible', $ul),
1044 target = current[direction]();
1045
1046 if (target.length) {
1047 $('img', target)
1048 .trigger('click', [current, target]);
1049 }
1050 },
1051
1052 shift : function (current, target, callback) {
1053 var clearing = target.parent(),
1054 old_index = this.settings.prev_index || target.index(),
1055 direction = this.direction(clearing, current, target),
1056 left = parseInt(clearing.css('left'), 10),
1057 width = target.outerWidth(),
1058 skip_shift;
1059
1060 // we use jQuery animate instead of CSS transitions because we
1061 // need a callback to unlock the next animation
1062 if (target.index() !== old_index && !/skip/.test(direction)){
1063 if (/left/.test(direction)) {
1064 this.lock();
1065 clearing.animate({left : left + width}, 300, this.unlock());
1066 } else if (/right/.test(direction)) {
1067 this.lock();
1068 clearing.animate({left : left - width}, 300, this.unlock());
1069 }
1070 } else if (/skip/.test(direction)) {
1071 // the target image is not adjacent to the current image, so
1072 // do we scroll right or not
1073 skip_shift = target.index() - this.settings.up_count;
1074 this.lock();
1075
1076 if (skip_shift > 0) {
1077 clearing.animate({left : -(skip_shift * width)}, 300, this.unlock());
1078 } else {
1079 clearing.animate({left : 0}, 300, this.unlock());
1080 }
1081 }
1082
1083 callback();
1084 },
1085
1086 direction : function ($el, current, target) {
1087 var lis = $('li', $el),
1088 li_width = lis.outerWidth() + (lis.outerWidth() / 4),
1089 up_count = Math.floor($('.clearing-container').outerWidth() / li_width) - 1,
1090 target_index = lis.index(target),
1091 response;
1092
1093 this.settings.up_count = up_count;
1094
1095 if (this.adjacent(this.settings.prev_index, target_index)) {
1096 if ((target_index > up_count)
1097 && target_index > this.settings.prev_index) {
1098 response = 'right';
1099 } else if ((target_index > up_count - 1)
1100 && target_index <= this.settings.prev_index) {
1101 response = 'left';
1102 } else {
1103 response = false;
1104 }
1105 } else {
1106 response = 'skip';
1107 }
1108
1109 this.settings.prev_index = target_index;
1110
1111 return response;
1112 },
1113
1114 adjacent : function (current_index, target_index) {
1115 for (var i = target_index + 1; i >= target_index - 1; i--) {
1116 if (i === current_index) return true;
1117 }
1118 return false;
1119 },
1120
1121 // lock management
1122
1123 lock : function () {
1124 this.settings.locked = true;
1125 },
1126
1127 unlock : function () {
1128 this.settings.locked = false;
1129 },
1130
1131 locked : function () {
1132 return this.settings.locked;
1133 },
1134
1135 off : function () {
1136 $(this.scope).off('.fndtn.clearing');
1137 $(window).off('.fndtn.clearing');
1138 },
1139
1140 reflow : function () {
1141 this.init();
1142 }
1143 };
1144
1145}(jQuery, this, this.document));
1146
1147;(function ($, window, document, undefined) {
1148 'use strict';
1149
1150 Foundation.libs.dropdown = {
1151 name : 'dropdown',
1152
1153 version : '5.0.0',
1154
1155 settings : {
1156 active_class: 'open',
1157 is_hover: false,
1158 opened: function(){},
1159 closed: function(){}
1160 },
1161
1162 init : function (scope, method, options) {
1163 Foundation.inherit(this, 'throttle');
1164
1165 this.bindings(method, options);
1166 },
1167
1168 events : function (scope) {
1169 var self = this;
1170
1171 $(this.scope)
1172 .off('.dropdown')
1173 .on('click.fndtn.dropdown', '[data-dropdown]', function (e) {
1174 var settings = $(this).data('dropdown-init');
1175 e.preventDefault();
1176
1177 if (!settings.is_hover || Modernizr.touch) self.toggle($(this));
1178 })
1179 .on('mouseenter.fndtn.dropdown', '[data-dropdown], [data-dropdown-content]', function (e) {
1180 var $this = $(this);
1181 clearTimeout(self.timeout);
1182
1183 if ($this.data('dropdown')) {
1184 var dropdown = $('#' + $this.data('dropdown')),
1185 target = $this;
1186 } else {
1187 var dropdown = $this;
1188 target = $("[data-dropdown='" + dropdown.attr('id') + "']");
1189 }
1190
1191 var settings = target.data('dropdown-init');
1192 if (settings.is_hover) self.open.apply(self, [dropdown, target]);
1193 })
1194 .on('mouseleave.fndtn.dropdown', '[data-dropdown], [data-dropdown-content]', function (e) {
1195 var $this = $(this);
1196 self.timeout = setTimeout(function () {
1197 if ($this.data('dropdown')) {
1198 var settings = $this.data('dropdown-init');
1199 if (settings.is_hover) self.close.call(self, $('#' + $this.data('dropdown')));
1200 } else {
1201 var target = $('[data-dropdown="' + $(this).attr('id') + '"]'),
1202 settings = target.data('dropdown-init');
1203 if (settings.is_hover) self.close.call(self, $this);
1204 }
1205 }.bind(this), 150);
1206 })
1207 .on('click.fndtn.dropdown', function (e) {
1208 var parent = $(e.target).closest('[data-dropdown-content]');
1209
1210 if ($(e.target).data('dropdown') || $(e.target).parent().data('dropdown')) {
1211 return;
1212 }
1213 if (!($(e.target).data('revealId')) &&
1214 (parent.length > 0 && ($(e.target).is('[data-dropdown-content]') ||
1215 $.contains(parent.first()[0], e.target)))) {
1216 e.stopPropagation();
1217 return;
1218 }
1219
1220 self.close.call(self, $('[data-dropdown-content]'));
1221 })
1222 .on('opened.fndtn.dropdown', '[data-dropdown-content]', this.settings.opened)
1223 .on('closed.fndtn.dropdown', '[data-dropdown-content]', this.settings.closed);
1224
1225 $(window)
1226 .off('.dropdown')
1227 .on('resize.fndtn.dropdown', self.throttle(function () {
1228 self.resize.call(self);
1229 }, 50)).trigger('resize');
1230 },
1231
1232 close: function (dropdown) {
1233 var self = this;
1234 dropdown.each(function () {
1235 if ($(this).hasClass(self.settings.active_class)) {
1236 $(this)
1237 .css(Foundation.rtl ? 'right':'left', '-99999px')
1238 .removeClass(self.settings.active_class);
1239 $(this).trigger('closed');
1240 }
1241 });
1242 },
1243
1244 open: function (dropdown, target) {
1245 this
1246 .css(dropdown
1247 .addClass(this.settings.active_class), target);
1248 dropdown.trigger('opened');
1249 },
1250
1251 toggle : function (target) {
1252 var dropdown = $('#' + target.data('dropdown'));
1253 if (dropdown.length === 0) {
1254 // No dropdown found, not continuing
1255 return;
1256 }
1257
1258 this.close.call(this, $('[data-dropdown-content]').not(dropdown));
1259
1260 if (dropdown.hasClass(this.settings.active_class)) {
1261 this.close.call(this, dropdown);
1262 } else {
1263 this.close.call(this, $('[data-dropdown-content]'))
1264 this.open.call(this, dropdown, target);
1265 }
1266 },
1267
1268 resize : function () {
1269 var dropdown = $('[data-dropdown-content].open'),
1270 target = $("[data-dropdown='" + dropdown.attr('id') + "']");
1271
1272 if (dropdown.length && target.length) {
1273 this.css(dropdown, target);
1274 }
1275 },
1276
1277 css : function (dropdown, target) {
1278 var offset_parent = dropdown.offsetParent(),
1279 position = target.offset();
1280
1281 position.top -= offset_parent.offset().top;
1282 position.left -= offset_parent.offset().left;
1283
1284 if (this.small()) {
1285 dropdown.css({
1286 position : 'absolute',
1287 width: '95%',
1288 'max-width': 'none',
1289 top: position.top + target.outerHeight()
1290 });
1291 dropdown.css(Foundation.rtl ? 'right':'left', '2.5%');
1292 } else {
1293 if (!Foundation.rtl && $(window).width() > dropdown.outerWidth() + target.offset().left) {
1294 var left = position.left;
1295 if (dropdown.hasClass('right')) {
1296 dropdown.removeClass('right');
1297 }
1298 } else {
1299 if (!dropdown.hasClass('right')) {
1300 dropdown.addClass('right');
1301 }
1302 var left = position.left - (dropdown.outerWidth() - target.outerWidth());
1303 }
1304
1305 dropdown.attr('style', '').css({
1306 position : 'absolute',
1307 top: position.top + target.outerHeight(),
1308 left: left
1309 });
1310 }
1311
1312 return dropdown;
1313 },
1314
1315 small : function () {
1316 return matchMedia(Foundation.media_queries.small).matches &&
1317 !matchMedia(Foundation.media_queries.medium).matches;
1318 },
1319
1320 off: function () {
1321 $(this.scope).off('.fndtn.dropdown');
1322 $('html, body').off('.fndtn.dropdown');
1323 $(window).off('.fndtn.dropdown');
1324 $('[data-dropdown-content]').off('.fndtn.dropdown');
1325 this.settings.init = false;
1326 },
1327
1328 reflow : function () {}
1329 };
1330}(jQuery, this, this.document));
1331
1332;(function ($, window, document, undefined) {
1333 'use strict';
1334
1335 Foundation.libs.interchange = {
1336 name : 'interchange',
1337
1338 version : '5.0.0',
1339
1340 cache : {},
1341
1342 images_loaded : false,
1343 nodes_loaded : false,
1344
1345 settings : {
1346 load_attr : 'interchange',
1347
1348 named_queries : {
1349 'default' : Foundation.media_queries.small,
1350 small : Foundation.media_queries.small,
1351 medium : Foundation.media_queries.medium,
1352 large : Foundation.media_queries.large,
1353 xlarge : Foundation.media_queries.xlarge,
1354 xxlarge: Foundation.media_queries.xxlarge,
1355 landscape : 'only screen and (orientation: landscape)',
1356 portrait : 'only screen and (orientation: portrait)',
1357 retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' +
1358 'only screen and (min--moz-device-pixel-ratio: 2),' +
1359 'only screen and (-o-min-device-pixel-ratio: 2/1),' +
1360 'only screen and (min-device-pixel-ratio: 2),' +
1361 'only screen and (min-resolution: 192dpi),' +
1362 'only screen and (min-resolution: 2dppx)'
1363 },
1364
1365 directives : {
1366 replace: function (el, path, trigger) {
1367 // The trigger argument, if called within the directive, fires
1368 // an event named after the directive on the element, passing
1369 // any parameters along to the event that you pass to trigger.
1370 //
1371 // ex. trigger(), trigger([a, b, c]), or trigger(a, b, c)
1372 //
1373 // This allows you to bind a callback like so:
1374 // $('#interchangeContainer').on('replace', function (e, a, b, c) {
1375 // console.log($(this).html(), a, b, c);
1376 // });
1377
1378 if (/IMG/.test(el[0].nodeName)) {
1379 var orig_path = el[0].src;
1380
1381 if (new RegExp(path, 'i').test(orig_path)) return;
1382
1383 el[0].src = path;
1384
1385 return trigger(el[0].src);
1386 }
1387 var last_path = el.data('interchange-last-path');
1388
1389 if (last_path == path) return;
1390
1391 return $.get(path, function (response) {
1392 el.html(response);
1393 el.data('interchange-last-path', path);
1394 trigger();
1395 });
1396
1397 }
1398 }
1399 },
1400
1401 init : function (scope, method, options) {
1402 Foundation.inherit(this, 'throttle');
1403
1404 this.data_attr = 'data-' + this.settings.load_attr;
1405
1406 this.bindings(method, options);
1407 this.load('images');
1408 this.load('nodes');
1409 },
1410
1411 events : function () {
1412 var self = this;
1413
1414 $(window)
1415 .off('.interchange')
1416 .on('resize.fndtn.interchange', self.throttle(function () {
1417 self.resize.call(self);
1418 }, 50));
1419
1420 return this;
1421 },
1422
1423 resize : function () {
1424 var cache = this.cache;
1425
1426 if(!this.images_loaded || !this.nodes_loaded) {
1427 setTimeout($.proxy(this.resize, this), 50);
1428 return;
1429 }
1430
1431 for (var uuid in cache) {
1432 if (cache.hasOwnProperty(uuid)) {
1433 var passed = this.results(uuid, cache[uuid]);
1434
1435 if (passed) {
1436 this.settings.directives[passed
1437 .scenario[1]](passed.el, passed.scenario[0], function () {
1438 if (arguments[0] instanceof Array) {
1439 var args = arguments[0];
1440 } else {
1441 var args = Array.prototype.slice.call(arguments, 0);
1442 }
1443
1444 passed.el.trigger(passed.scenario[1], args);
1445 });
1446 }
1447 }
1448 }
1449
1450 },
1451
1452 results : function (uuid, scenarios) {
1453 var count = scenarios.length;
1454
1455 if (count > 0) {
1456 var el = this.S('[data-uuid="' + uuid + '"]');
1457
1458 for (var i = count - 1; i >= 0; i--) {
1459 var mq, rule = scenarios[i][2];
1460 if (this.settings.named_queries.hasOwnProperty(rule)) {
1461 mq = matchMedia(this.settings.named_queries[rule]);
1462 } else {
1463 mq = matchMedia(rule);
1464 }
1465 if (mq.matches) {
1466 return {el: el, scenario: scenarios[i]};
1467 }
1468 }
1469 }
1470
1471 return false;
1472 },
1473
1474 load : function (type, force_update) {
1475 if (typeof this['cached_' + type] === 'undefined' || force_update) {
1476 this['update_' + type]();
1477 }
1478
1479 return this['cached_' + type];
1480 },
1481
1482 update_images : function () {
1483 var images = this.S('img[' + this.data_attr + ']'),
1484 count = images.length,
1485 loaded_count = 0,
1486 data_attr = this.data_attr;
1487
1488 this.cache = {};
1489 this.cached_images = [];
1490 this.images_loaded = (count === 0);
1491
1492 for (var i = count - 1; i >= 0; i--) {
1493 loaded_count++;
1494 if (images[i]) {
1495 var str = images[i].getAttribute(data_attr) || '';
1496
1497 if (str.length > 0) {
1498 this.cached_images.push(images[i]);
1499 }
1500 }
1501
1502 if(loaded_count === count) {
1503 this.images_loaded = true;
1504 this.enhance('images');
1505 }
1506 }
1507
1508 return this;
1509 },
1510
1511 update_nodes : function () {
1512 var nodes = this.S('[' + this.data_attr + ']:not(img)'),
1513 count = nodes.length,
1514 loaded_count = 0,
1515 data_attr = this.data_attr;
1516
1517 this.cached_nodes = [];
1518 // Set nodes_loaded to true if there are no nodes
1519 // this.nodes_loaded = false;
1520 this.nodes_loaded = (count === 0);
1521
1522
1523 for (var i = count - 1; i >= 0; i--) {
1524 loaded_count++;
1525 var str = nodes[i].getAttribute(data_attr) || '';
1526
1527 if (str.length > 0) {
1528 this.cached_nodes.push(nodes[i]);
1529 }
1530
1531 if(loaded_count === count) {
1532 this.nodes_loaded = true;
1533 this.enhance('nodes');
1534 }
1535 }
1536
1537 return this;
1538 },
1539
1540 enhance : function (type) {
1541 var count = this['cached_' + type].length;
1542
1543 for (var i = count - 1; i >= 0; i--) {
1544 this.object($(this['cached_' + type][i]));
1545 }
1546
1547 return $(window).trigger('resize');
1548 },
1549
1550 parse_params : function (path, directive, mq) {
1551 return [this.trim(path), this.convert_directive(directive), this.trim(mq)];
1552 },
1553
1554 convert_directive : function (directive) {
1555 var trimmed = this.trim(directive);
1556
1557 if (trimmed.length > 0) {
1558 return trimmed;
1559 }
1560
1561 return 'replace';
1562 },
1563
1564 object : function(el) {
1565 var raw_arr = this.parse_data_attr(el),
1566 scenarios = [], count = raw_arr.length;
1567
1568 if (count > 0) {
1569 for (var i = count - 1; i >= 0; i--) {
1570 var split = raw_arr[i].split(/\((.*?)(\))$/);
1571
1572 if (split.length > 1) {
1573 var cached_split = split[0].split(','),
1574 params = this.parse_params(cached_split[0],
1575 cached_split[1], split[1]);
1576
1577 scenarios.push(params);
1578 }
1579 }
1580 }
1581
1582 return this.store(el, scenarios);
1583 },
1584
1585 uuid : function (separator) {
1586 var delim = separator || "-";
1587
1588 function S4() {
1589 return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
1590 }
1591
1592 return (S4() + S4() + delim + S4() + delim + S4()
1593 + delim + S4() + delim + S4() + S4() + S4());
1594 },
1595
1596 store : function (el, scenarios) {
1597 var uuid = this.uuid(),
1598 current_uuid = el.data('uuid');
1599
1600 if (current_uuid) return this.cache[current_uuid];
1601
1602 el.attr('data-uuid', uuid);
1603
1604 return this.cache[uuid] = scenarios;
1605 },
1606
1607 trim : function(str) {
1608 if (typeof str === 'string') {
1609 return $.trim(str);
1610 }
1611
1612 return str;
1613 },
1614
1615 parse_data_attr : function (el) {
1616 var raw = el.data(this.settings.load_attr).split(/\[(.*?)\]/),
1617 count = raw.length, output = [];
1618
1619 for (var i = count - 1; i >= 0; i--) {
1620 if (raw[i].replace(/[\W\d]+/, '').length > 4) {
1621 output.push(raw[i]);
1622 }
1623 }
1624
1625 return output;
1626 },
1627
1628 reflow : function () {
1629 this.load('images', true);
1630 this.load('nodes', true);
1631 }
1632
1633 };
1634
1635}(jQuery, this, this.document));
1636;(function ($, window, document, undefined) {
1637 'use strict';
1638
1639 var Modernizr = Modernizr || false;
1640
1641 Foundation.libs.joyride = {
1642 name : 'joyride',
1643
1644 version : '5.0.0',
1645
1646 defaults : {
1647 expose : false, // turn on or off the expose feature
1648 modal : true, // Whether to cover page with modal during the tour
1649 tip_location : 'bottom', // 'top' or 'bottom' in relation to parent
1650 nub_position : 'auto', // override on a per tooltip bases
1651 scroll_speed : 1500, // Page scrolling speed in milliseconds, 0 = no scroll animation
1652 scroll_animation : 'linear', // supports 'swing' and 'linear', extend with jQuery UI.
1653 timer : 0, // 0 = no timer , all other numbers = timer in milliseconds
1654 start_timer_on_click : true, // true or false - true requires clicking the first button start the timer
1655 start_offset : 0, // the index of the tooltip you want to start on (index of the li)
1656 next_button : true, // true or false to control whether a next button is used
1657 tip_animation : 'fade', // 'pop' or 'fade' in each tip
1658 pause_after : [], // array of indexes where to pause the tour after
1659 exposed : [], // array of expose elements
1660 tip_animation_fade_speed: 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition
1661 cookie_monster : false, // true or false to control whether cookies are used
1662 cookie_name : 'joyride', // Name the cookie you'll use
1663 cookie_domain : false, // Will this cookie be attached to a domain, ie. '.notableapp.com'
1664 cookie_expires : 365, // set when you would like the cookie to expire.
1665 tip_container : 'body', // Where will the tip be attached
1666 tip_location_patterns : {
1667 top: ['bottom'],
1668 bottom: [], // bottom should not need to be repositioned
1669 left: ['right', 'top', 'bottom'],
1670 right: ['left', 'top', 'bottom']
1671 },
1672 post_ride_callback : function (){}, // A method to call once the tour closes (canceled or complete)
1673 post_step_callback : function (){}, // A method to call after each step
1674 pre_step_callback : function (){}, // A method to call before each step
1675 pre_ride_callback : function (){}, // A method to call before the tour starts (passed index, tip, and cloned exposed element)
1676 post_expose_callback : function (){}, // A method to call after an element has been exposed
1677 template : { // HTML segments for tip layout
1678 link : '<a href="#close" class="joyride-close-tip">×</a>',
1679 timer : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',
1680 tip : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>',
1681 wrapper : '<div class="joyride-content-wrapper"></div>',
1682 button : '<a href="#" class="small button joyride-next-tip"></a>',
1683 modal : '<div class="joyride-modal-bg"></div>',
1684 expose : '<div class="joyride-expose-wrapper"></div>',
1685 expose_cover: '<div class="joyride-expose-cover"></div>'
1686 },
1687 expose_add_class : '' // One or more space-separated class names to be added to exposed element
1688 },
1689
1690 init : function (scope, method, options) {
1691 Foundation.inherit(this, 'throttle delay');
1692
1693 this.settings = this.defaults;
1694
1695 this.bindings(method, options)
1696 },
1697
1698 events : function () {
1699 var self = this;
1700
1701 $(this.scope)
1702 .off('.joyride')
1703 .on('click.fndtn.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
1704 e.preventDefault();
1705
1706 if (this.settings.$li.next().length < 1) {
1707 this.end();
1708 } else if (this.settings.timer > 0) {
1709 clearTimeout(this.settings.automate);
1710 this.hide();
1711 this.show();
1712 this.startTimer();
1713 } else {
1714 this.hide();
1715 this.show();
1716 }
1717
1718 }.bind(this))
1719
1720 .on('click.fndtn.joyride', '.joyride-close-tip', function (e) {
1721 e.preventDefault();
1722 this.end();
1723 }.bind(this));
1724
1725 $(window)
1726 .off('.joyride')
1727 .on('resize.fndtn.joyride', self.throttle(function () {
1728 if ($('[data-joyride]').length > 0 && self.settings.$next_tip) {
1729 if (self.settings.exposed.length > 0) {
1730 var $els = $(self.settings.exposed);
1731
1732 $els.each(function () {
1733 var $this = $(this);
1734 self.un_expose($this);
1735 self.expose($this);
1736 });
1737 }
1738
1739 if (self.is_phone()) {
1740 self.pos_phone();
1741 } else {
1742 self.pos_default(false, true);
1743 }
1744 }
1745 }, 100));
1746 },
1747
1748 start : function () {
1749 var self = this,
1750 $this = $('[data-joyride]', this.scope),
1751 integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'],
1752 int_settings_count = integer_settings.length;
1753
1754 if (!$this.length > 0) return;
1755
1756 if (!this.settings.init) this.events();
1757
1758 this.settings = $this.data('joyride-init');
1759
1760 // non configureable settings
1761 this.settings.$content_el = $this;
1762 this.settings.$body = $(this.settings.tip_container);
1763 this.settings.body_offset = $(this.settings.tip_container).position();
1764 this.settings.$tip_content = this.settings.$content_el.find('> li');
1765 this.settings.paused = false;
1766 this.settings.attempts = 0;
1767
1768 // can we create cookies?
1769 if (typeof $.cookie !== 'function') {
1770 this.settings.cookie_monster = false;
1771 }
1772
1773 // generate the tips and insert into dom.
1774 if (!this.settings.cookie_monster || this.settings.cookie_monster && $.cookie(this.settings.cookie_name) === null) {
1775 this.settings.$tip_content.each(function (index) {
1776 var $this = $(this);
1777 this.settings = $.extend({}, self.defaults, self.data_options($this))
1778
1779 // Make sure that settings parsed from data_options are integers where necessary
1780 for (var i = int_settings_count - 1; i >= 0; i--) {
1781 self.settings[integer_settings[i]] = parseInt(self.settings[integer_settings[i]], 10);
1782 }
1783 self.create({$li : $this, index : index});
1784 });
1785
1786 // show first tip
1787 if (!this.settings.start_timer_on_click && this.settings.timer > 0) {
1788 this.show('init');
1789 this.startTimer();
1790 } else {
1791 this.show('init');
1792 }
1793
1794 }
1795 },
1796
1797 resume : function () {
1798 this.set_li();
1799 this.show();
1800 },
1801
1802 tip_template : function (opts) {
1803 var $blank, content;
1804
1805 opts.tip_class = opts.tip_class || '';
1806
1807 $blank = $(this.settings.template.tip).addClass(opts.tip_class);
1808 content = $.trim($(opts.li).html()) +
1809 this.button_text(opts.button_text) +
1810 this.settings.template.link +
1811 this.timer_instance(opts.index);
1812
1813 $blank.append($(this.settings.template.wrapper));
1814 $blank.first().attr('data-index', opts.index);
1815 $('.joyride-content-wrapper', $blank).append(content);
1816
1817 return $blank[0];
1818 },
1819
1820 timer_instance : function (index) {
1821 var txt;
1822
1823 if ((index === 0 && this.settings.start_timer_on_click && this.settings.timer > 0) || this.settings.timer === 0) {
1824 txt = '';
1825 } else {
1826 txt = $(this.settings.template.timer)[0].outerHTML;
1827 }
1828 return txt;
1829 },
1830
1831 button_text : function (txt) {
1832 if (this.settings.next_button) {
1833 txt = $.trim(txt) || 'Next';
1834 txt = $(this.settings.template.button).append(txt)[0].outerHTML;
1835 } else {
1836 txt = '';
1837 }
1838 return txt;
1839 },
1840
1841 create : function (opts) {
1842 var buttonText = opts.$li.attr('data-button') || opts.$li.attr('data-text'),
1843 tipClass = opts.$li.attr('class'),
1844 $tip_content = $(this.tip_template({
1845 tip_class : tipClass,
1846 index : opts.index,
1847 button_text : buttonText,
1848 li : opts.$li
1849 }));
1850
1851 $(this.settings.tip_container).append($tip_content);
1852 },
1853
1854 show : function (init) {
1855 var $timer = null;
1856
1857 // are we paused?
1858 if (this.settings.$li === undefined
1859 || ($.inArray(this.settings.$li.index(), this.settings.pause_after) === -1)) {
1860
1861 // don't go to the next li if the tour was paused
1862 if (this.settings.paused) {
1863 this.settings.paused = false;
1864 } else {
1865 this.set_li(init);
1866 }
1867
1868 this.settings.attempts = 0;
1869
1870 if (this.settings.$li.length && this.settings.$target.length > 0) {
1871 if (init) { //run when we first start
1872 this.settings.pre_ride_callback(this.settings.$li.index(), this.settings.$next_tip);
1873 if (this.settings.modal) {
1874 this.show_modal();
1875 }
1876 }
1877
1878 this.settings.pre_step_callback(this.settings.$li.index(), this.settings.$next_tip);
1879
1880 if (this.settings.modal && this.settings.expose) {
1881 this.expose();
1882 }
1883
1884 this.settings.tip_settings = $.extend({}, this.settings, this.data_options(this.settings.$li));
1885
1886 this.settings.timer = parseInt(this.settings.timer, 10);
1887
1888 this.settings.tip_settings.tip_location_pattern = this.settings.tip_location_patterns[this.settings.tip_settings.tip_location];
1889
1890 // scroll if not modal
1891 if (!/body/i.test(this.settings.$target.selector)) {
1892 this.scroll_to();
1893 }
1894
1895 if (this.is_phone()) {
1896 this.pos_phone(true);
1897 } else {
1898 this.pos_default(true);
1899 }
1900
1901 $timer = this.settings.$next_tip.find('.joyride-timer-indicator');
1902
1903 if (/pop/i.test(this.settings.tip_animation)) {
1904
1905 $timer.width(0);
1906
1907 if (this.settings.timer > 0) {
1908
1909 this.settings.$next_tip.show();
1910
1911 this.delay(function () {
1912 $timer.animate({
1913 width: $timer.parent().width()
1914 }, this.settings.timer, 'linear');
1915 }.bind(this), this.settings.tip_animation_fade_speed);
1916
1917 } else {
1918 this.settings.$next_tip.show();
1919
1920 }
1921
1922
1923 } else if (/fade/i.test(this.settings.tip_animation)) {
1924
1925 $timer.width(0);
1926
1927 if (this.settings.timer > 0) {
1928
1929 this.settings.$next_tip
1930 .fadeIn(this.settings.tip_animation_fade_speed)
1931 .show();
1932
1933 this.delay(function () {
1934 $timer.animate({
1935 width: $timer.parent().width()
1936 }, this.settings.timer, 'linear');
1937 }.bind(this), this.settings.tip_animation_fadeSpeed);
1938
1939 } else {
1940 this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed);
1941 }
1942 }
1943
1944 this.settings.$current_tip = this.settings.$next_tip;
1945
1946 // skip non-existant targets
1947 } else if (this.settings.$li && this.settings.$target.length < 1) {
1948
1949 this.show();
1950
1951 } else {
1952
1953 this.end();
1954
1955 }
1956 } else {
1957
1958 this.settings.paused = true;
1959
1960 }
1961
1962 },
1963
1964 is_phone : function () {
1965 return matchMedia(Foundation.media_queries.small).matches &&
1966 !matchMedia(Foundation.media_queries.medium).matches;
1967 },
1968
1969 hide : function () {
1970 if (this.settings.modal && this.settings.expose) {
1971 this.un_expose();
1972 }
1973
1974 if (!this.settings.modal) {
1975 $('.joyride-modal-bg').hide();
1976 }
1977
1978 // Prevent scroll bouncing...wait to remove from layout
1979 this.settings.$current_tip.css('visibility', 'hidden');
1980 setTimeout($.proxy(function() {
1981 this.hide();
1982 this.css('visibility', 'visible');
1983 }, this.settings.$current_tip), 0);
1984 this.settings.post_step_callback(this.settings.$li.index(),
1985 this.settings.$current_tip);
1986 },
1987
1988 set_li : function (init) {
1989 if (init) {
1990 this.settings.$li = this.settings.$tip_content.eq(this.settings.start_offset);
1991 this.set_next_tip();
1992 this.settings.$current_tip = this.settings.$next_tip;
1993 } else {
1994 this.settings.$li = this.settings.$li.next();
1995 this.set_next_tip();
1996 }
1997
1998 this.set_target();
1999 },
2000
2001 set_next_tip : function () {
2002 this.settings.$next_tip = $(".joyride-tip-guide").eq(this.settings.$li.index());
2003 this.settings.$next_tip.data('closed', '');
2004 },
2005
2006 set_target : function () {
2007 var cl = this.settings.$li.attr('data-class'),
2008 id = this.settings.$li.attr('data-id'),
2009 $sel = function () {
2010 if (id) {
2011 return $(document.getElementById(id));
2012 } else if (cl) {
2013 return $('.' + cl).first();
2014 } else {
2015 return $('body');
2016 }
2017 };
2018
2019 this.settings.$target = $sel();
2020 },
2021
2022 scroll_to : function () {
2023 var window_half, tipOffset;
2024
2025 window_half = $(window).height() / 2;
2026 tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight());
2027
2028 if (tipOffset > 0) {
2029 $('html, body').animate({
2030 scrollTop: tipOffset
2031 }, this.settings.scroll_speed, 'swing');
2032 }
2033 },
2034
2035 paused : function () {
2036 return ($.inArray((this.settings.$li.index() + 1), this.settings.pause_after) === -1);
2037 },
2038
2039 restart : function () {
2040 this.hide();
2041 this.settings.$li = undefined;
2042 this.show('init');
2043 },
2044
2045 pos_default : function (init, resizing) {
2046 var half_fold = Math.ceil($(window).height() / 2),
2047 tip_position = this.settings.$next_tip.offset(),
2048 $nub = this.settings.$next_tip.find('.joyride-nub'),
2049 nub_width = Math.ceil($nub.outerWidth() / 2),
2050 nub_height = Math.ceil($nub.outerHeight() / 2),
2051 toggle = init || false;
2052
2053 // tip must not be "display: none" to calculate position
2054 if (toggle) {
2055 this.settings.$next_tip.css('visibility', 'hidden');
2056 this.settings.$next_tip.show();
2057 }
2058
2059 if (typeof resizing === 'undefined') {
2060 resizing = false;
2061 }
2062
2063 if (!/body/i.test(this.settings.$target.selector)) {
2064
2065 if (this.bottom()) {
2066 var leftOffset = this.settings.$target.offset().left;
2067 if (Foundation.rtl) {
2068 leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset;
2069 }
2070 this.settings.$next_tip.css({
2071 top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight()),
2072 left: leftOffset});
2073
2074 this.nub_position($nub, this.settings.tip_settings.nub_position, 'top');
2075
2076 } else if (this.top()) {
2077 var leftOffset = this.settings.$target.offset().left;
2078 if (Foundation.rtl) {
2079 leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset;
2080 }
2081 this.settings.$next_tip.css({
2082 top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height),
2083 left: leftOffset});
2084
2085 this.nub_position($nub, this.settings.tip_settings.nub_position, 'bottom');
2086
2087 } else if (this.right()) {
2088
2089 this.settings.$next_tip.css({
2090 top: this.settings.$target.offset().top,
2091 left: (this.outerWidth(this.settings.$target) + this.settings.$target.offset().left + nub_width)});
2092
2093 this.nub_position($nub, this.settings.tip_settings.nub_position, 'left');
2094
2095 } else if (this.left()) {
2096
2097 this.settings.$next_tip.css({
2098 top: this.settings.$target.offset().top,
2099 left: (this.settings.$target.offset().left - this.outerWidth(this.settings.$next_tip) - nub_width)});
2100
2101 this.nub_position($nub, this.settings.tip_settings.nub_position, 'right');
2102
2103 }
2104
2105 if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tip_settings.tip_location_pattern.length) {
2106
2107 $nub.removeClass('bottom')
2108 .removeClass('top')
2109 .removeClass('right')
2110 .removeClass('left');
2111
2112 this.settings.tip_settings.tip_location = this.settings.tip_settings.tip_location_pattern[this.settings.attempts];
2113
2114 this.settings.attempts++;
2115
2116 this.pos_default();
2117
2118 }
2119
2120 } else if (this.settings.$li.length) {
2121
2122 this.pos_modal($nub);
2123
2124 }
2125
2126 if (toggle) {
2127 this.settings.$next_tip.hide();
2128 this.settings.$next_tip.css('visibility', 'visible');
2129 }
2130
2131 },
2132
2133 pos_phone : function (init) {
2134 var tip_height = this.settings.$next_tip.outerHeight(),
2135 tip_offset = this.settings.$next_tip.offset(),
2136 target_height = this.settings.$target.outerHeight(),
2137 $nub = $('.joyride-nub', this.settings.$next_tip),
2138 nub_height = Math.ceil($nub.outerHeight() / 2),
2139 toggle = init || false;
2140
2141 $nub.removeClass('bottom')
2142 .removeClass('top')
2143 .removeClass('right')
2144 .removeClass('left');
2145
2146 if (toggle) {
2147 this.settings.$next_tip.css('visibility', 'hidden');
2148 this.settings.$next_tip.show();
2149 }
2150
2151 if (!/body/i.test(this.settings.$target.selector)) {
2152
2153 if (this.top()) {
2154
2155 this.settings.$next_tip.offset({top: this.settings.$target.offset().top - tip_height - nub_height});
2156 $nub.addClass('bottom');
2157
2158 } else {
2159
2160 this.settings.$next_tip.offset({top: this.settings.$target.offset().top + target_height + nub_height});
2161 $nub.addClass('top');
2162
2163 }
2164
2165 } else if (this.settings.$li.length) {
2166 this.pos_modal($nub);
2167 }
2168
2169 if (toggle) {
2170 this.settings.$next_tip.hide();
2171 this.settings.$next_tip.css('visibility', 'visible');
2172 }
2173 },
2174
2175 pos_modal : function ($nub) {
2176 this.center();
2177 $nub.hide();
2178
2179 this.show_modal();
2180 },
2181
2182 show_modal : function () {
2183 if (!this.settings.$next_tip.data('closed')) {
2184 var joyridemodalbg = $('.joyride-modal-bg');
2185 if (joyridemodalbg.length < 1) {
2186 $('body').append(this.settings.template.modal).show();
2187 }
2188
2189 if (/pop/i.test(this.settings.tip_animation)) {
2190 joyridemodalbg.show();
2191 } else {
2192 joyridemodalbg.fadeIn(this.settings.tip_animation_fade_speed);
2193 }
2194 }
2195 },
2196
2197 expose : function () {
2198 var expose,
2199 exposeCover,
2200 el,
2201 origCSS,
2202 origClasses,
2203 randId = 'expose-'+Math.floor(Math.random()*10000);
2204
2205 if (arguments.length > 0 && arguments[0] instanceof $) {
2206 el = arguments[0];
2207 } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
2208 el = this.settings.$target;
2209 } else {
2210 return false;
2211 }
2212
2213 if(el.length < 1){
2214 if(window.console){
2215 console.error('element not valid', el);
2216 }
2217 return false;
2218 }
2219
2220 expose = $(this.settings.template.expose);
2221 this.settings.$body.append(expose);
2222 expose.css({
2223 top: el.offset().top,
2224 left: el.offset().left,
2225 width: el.outerWidth(true),
2226 height: el.outerHeight(true)
2227 });
2228
2229 exposeCover = $(this.settings.template.expose_cover);
2230
2231 origCSS = {
2232 zIndex: el.css('z-index'),
2233 position: el.css('position')
2234 };
2235
2236 origClasses = el.attr('class') == null ? '' : el.attr('class');
2237
2238 el.css('z-index',parseInt(expose.css('z-index'))+1);
2239
2240 if (origCSS.position == 'static') {
2241 el.css('position','relative');
2242 }
2243
2244 el.data('expose-css',origCSS);
2245 el.data('orig-class', origClasses);
2246 el.attr('class', origClasses + ' ' + this.settings.expose_add_class);
2247
2248 exposeCover.css({
2249 top: el.offset().top,
2250 left: el.offset().left,
2251 width: el.outerWidth(true),
2252 height: el.outerHeight(true)
2253 });
2254
2255 if (this.settings.modal) this.show_modal();
2256
2257 this.settings.$body.append(exposeCover);
2258 expose.addClass(randId);
2259 exposeCover.addClass(randId);
2260 el.data('expose', randId);
2261 this.settings.post_expose_callback(this.settings.$li.index(), this.settings.$next_tip, el);
2262 this.add_exposed(el);
2263 },
2264
2265 un_expose : function () {
2266 var exposeId,
2267 el,
2268 expose ,
2269 origCSS,
2270 origClasses,
2271 clearAll = false;
2272
2273 if (arguments.length > 0 && arguments[0] instanceof $) {
2274 el = arguments[0];
2275 } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
2276 el = this.settings.$target;
2277 } else {
2278 return false;
2279 }
2280
2281 if(el.length < 1){
2282 if (window.console) {
2283 console.error('element not valid', el);
2284 }
2285 return false;
2286 }
2287
2288 exposeId = el.data('expose');
2289 expose = $('.' + exposeId);
2290
2291 if (arguments.length > 1) {
2292 clearAll = arguments[1];
2293 }
2294
2295 if (clearAll === true) {
2296 $('.joyride-expose-wrapper,.joyride-expose-cover').remove();
2297 } else {
2298 expose.remove();
2299 }
2300
2301 origCSS = el.data('expose-css');
2302
2303 if (origCSS.zIndex == 'auto') {
2304 el.css('z-index', '');
2305 } else {
2306 el.css('z-index', origCSS.zIndex);
2307 }
2308
2309 if (origCSS.position != el.css('position')) {
2310 if(origCSS.position == 'static') {// this is default, no need to set it.
2311 el.css('position', '');
2312 } else {
2313 el.css('position', origCSS.position);
2314 }
2315 }
2316
2317 origClasses = el.data('orig-class');
2318 el.attr('class', origClasses);
2319 el.removeData('orig-classes');
2320
2321 el.removeData('expose');
2322 el.removeData('expose-z-index');
2323 this.remove_exposed(el);
2324 },
2325
2326 add_exposed: function(el){
2327 this.settings.exposed = this.settings.exposed || [];
2328 if (el instanceof $ || typeof el === 'object') {
2329 this.settings.exposed.push(el[0]);
2330 } else if (typeof el == 'string') {
2331 this.settings.exposed.push(el);
2332 }
2333 },
2334
2335 remove_exposed: function(el){
2336 var search, count;
2337 if (el instanceof $) {
2338 search = el[0]
2339 } else if (typeof el == 'string'){
2340 search = el;
2341 }
2342
2343 this.settings.exposed = this.settings.exposed || [];
2344 count = this.settings.exposed.length;
2345
2346 for (var i=0; i < count; i++) {
2347 if (this.settings.exposed[i] == search) {
2348 this.settings.exposed.splice(i, 1);
2349 return;
2350 }
2351 }
2352 },
2353
2354 center : function () {
2355 var $w = $(window);
2356
2357 this.settings.$next_tip.css({
2358 top : ((($w.height() - this.settings.$next_tip.outerHeight()) / 2) + $w.scrollTop()),
2359 left : ((($w.width() - this.settings.$next_tip.outerWidth()) / 2) + $w.scrollLeft())
2360 });
2361
2362 return true;
2363 },
2364
2365 bottom : function () {
2366 return /bottom/i.test(this.settings.tip_settings.tip_location);
2367 },
2368
2369 top : function () {
2370 return /top/i.test(this.settings.tip_settings.tip_location);
2371 },
2372
2373 right : function () {
2374 return /right/i.test(this.settings.tip_settings.tip_location);
2375 },
2376
2377 left : function () {
2378 return /left/i.test(this.settings.tip_settings.tip_location);
2379 },
2380
2381 corners : function (el) {
2382 var w = $(window),
2383 window_half = w.height() / 2,
2384 //using this to calculate since scroll may not have finished yet.
2385 tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()),
2386 right = w.width() + w.scrollLeft(),
2387 offsetBottom = w.height() + tipOffset,
2388 bottom = w.height() + w.scrollTop(),
2389 top = w.scrollTop();
2390
2391 if (tipOffset < top) {
2392 if (tipOffset < 0) {
2393 top = 0;
2394 } else {
2395 top = tipOffset;
2396 }
2397 }
2398
2399 if (offsetBottom > bottom) {
2400 bottom = offsetBottom;
2401 }
2402
2403 return [
2404 el.offset().top < top,
2405 right < el.offset().left + el.outerWidth(),
2406 bottom < el.offset().top + el.outerHeight(),
2407 w.scrollLeft() > el.offset().left
2408 ];
2409 },
2410
2411 visible : function (hidden_corners) {
2412 var i = hidden_corners.length;
2413
2414 while (i--) {
2415 if (hidden_corners[i]) return false;
2416 }
2417
2418 return true;
2419 },
2420
2421 nub_position : function (nub, pos, def) {
2422 if (pos === 'auto') {
2423 nub.addClass(def);
2424 } else {
2425 nub.addClass(pos);
2426 }
2427 },
2428
2429 startTimer : function () {
2430 if (this.settings.$li.length) {
2431 this.settings.automate = setTimeout(function () {
2432 this.hide();
2433 this.show();
2434 this.startTimer();
2435 }.bind(this), this.settings.timer);
2436 } else {
2437 clearTimeout(this.settings.automate);
2438 }
2439 },
2440
2441 end : function () {
2442 if (this.settings.cookie_monster) {
2443 $.cookie(this.settings.cookie_name, 'ridden', { expires: this.settings.cookie_expires, domain: this.settings.cookie_domain });
2444 }
2445
2446 if (this.settings.timer > 0) {
2447 clearTimeout(this.settings.automate);
2448 }
2449
2450 if (this.settings.modal && this.settings.expose) {
2451 this.un_expose();
2452 }
2453
2454 this.settings.$next_tip.data('closed', true);
2455
2456 $('.joyride-modal-bg').hide();
2457 this.settings.$current_tip.hide();
2458 this.settings.post_step_callback(this.settings.$li.index(), this.settings.$current_tip);
2459 this.settings.post_ride_callback(this.settings.$li.index(), this.settings.$current_tip);
2460 $('.joyride-tip-guide').remove();
2461 },
2462
2463 off : function () {
2464 $(this.scope).off('.joyride');
2465 $(window).off('.joyride');
2466 $('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride');
2467 $('.joyride-tip-guide, .joyride-modal-bg').remove();
2468 clearTimeout(this.settings.automate);
2469 this.settings = {};
2470 },
2471
2472 reflow : function () {}
2473 };
2474}(jQuery, this, this.document));
2475
2476;(function ($, window, document, undefined) {
2477 'use strict';
2478
2479 Foundation.libs.magellan = {
2480 name : 'magellan',
2481
2482 version : '5.0.0',
2483
2484 settings : {
2485 active_class: 'active',
2486 threshold: 0
2487 },
2488
2489 init : function (scope, method, options) {
2490 this.fixed_magellan = $("[data-magellan-expedition]");
2491 this.set_threshold();
2492 this.last_destination = $('[data-magellan-destination]').last();
2493 this.events();
2494 },
2495
2496 events : function () {
2497 var self = this;
2498
2499 $(this.scope)
2500 .off('.magellan')
2501 .on('arrival.fndtn.magellan', '[data-magellan-arrival]', function (e) {
2502 var $destination = $(this),
2503 $expedition = $destination.closest('[data-magellan-expedition]'),
2504 active_class = $expedition.attr('data-magellan-active-class')
2505 || self.settings.active_class;
2506
2507 $destination
2508 .closest('[data-magellan-expedition]')
2509 .find('[data-magellan-arrival]')
2510 .not($destination)
2511 .removeClass(active_class);
2512 $destination.addClass(active_class);
2513 });
2514
2515 this.fixed_magellan
2516 .off('.magellan')
2517 .on('update-position.fndtn.magellan', function() {
2518 var $el = $(this);
2519 })
2520 .trigger('update-position');
2521
2522 $(window)
2523 .off('.magellan')
2524 .on('resize.fndtn.magellan', function() {
2525 this.fixed_magellan.trigger('update-position');
2526 }.bind(this))
2527 .on('scroll.fndtn.magellan', function() {
2528 var windowScrollTop = $(window).scrollTop();
2529 self.fixed_magellan.each(function() {
2530 var $expedition = $(this);
2531 if (typeof $expedition.data('magellan-top-offset') === 'undefined') {
2532 $expedition.data('magellan-top-offset', $expedition.offset().top);
2533 }
2534 if (typeof $expedition.data('magellan-fixed-position') === 'undefined') {
2535 $expedition.data('magellan-fixed-position', false);
2536 }
2537 var fixed_position = (windowScrollTop + self.settings.threshold) > $expedition.data("magellan-top-offset");
2538 var attr = $expedition.attr('data-magellan-top-offset');
2539
2540 if ($expedition.data("magellan-fixed-position") != fixed_position) {
2541 $expedition.data("magellan-fixed-position", fixed_position);
2542 if (fixed_position) {
2543 $expedition.addClass('fixed');
2544 $expedition.css({position:"fixed", top:0});
2545 } else {
2546 $expedition.removeClass('fixed');
2547 $expedition.css({position:"", top:""});
2548 }
2549 if (fixed_position && typeof attr != 'undefined' && attr != false) {
2550 $expedition.css({position:"fixed", top:attr + "px"});
2551 }
2552 }
2553 });
2554 });
2555
2556
2557 if (this.last_destination.length > 0) {
2558 $(window).on('scroll.fndtn.magellan', function (e) {
2559 var windowScrollTop = $(window).scrollTop(),
2560 scrolltopPlusHeight = windowScrollTop + $(window).height(),
2561 lastDestinationTop = Math.ceil(self.last_destination.offset().top);
2562
2563 $('[data-magellan-destination]').each(function () {
2564 var $destination = $(this),
2565 destination_name = $destination.attr('data-magellan-destination'),
2566 topOffset = $destination.offset().top - $destination.outerHeight(true) - windowScrollTop;
2567 if (topOffset <= self.settings.threshold) {
2568 $("[data-magellan-arrival='" + destination_name + "']").trigger('arrival');
2569 }
2570 // In large screens we may hit the bottom of the page and dont reach the top of the last magellan-destination, so lets force it
2571 if (scrolltopPlusHeight >= $(self.scope).height() && lastDestinationTop > windowScrollTop && lastDestinationTop < scrolltopPlusHeight) {
2572 $('[data-magellan-arrival]').last().trigger('arrival');
2573 }
2574 });
2575 });
2576 }
2577 },
2578
2579 set_threshold : function () {
2580 if (typeof this.settings.threshold !== 'number') {
2581 this.settings.threshold = (this.fixed_magellan.length > 0) ?
2582 this.fixed_magellan.outerHeight(true) : 0;
2583 }
2584 },
2585
2586 off : function () {
2587 $(this.scope).off('.fndtn.magellan');
2588 $(window).off('.fndtn.magellan');
2589 },
2590
2591 reflow : function () {}
2592 };
2593}(jQuery, this, this.document));
2594
2595;(function ($, window, document, undefined) {
2596 'use strict';
2597
2598 Foundation.libs.offcanvas = {
2599 name : 'offcanvas',
2600
2601 version : '5.0.0',
2602
2603 settings : {},
2604
2605 init : function (scope, method, options) {
2606 this.events();
2607 },
2608
2609 events : function () {
2610 $(this.scope).off('.offcanvas')
2611 .on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) {
2612 e.preventDefault();
2613 $(this).closest('.off-canvas-wrap').toggleClass('move-right');
2614 })
2615 .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
2616 e.preventDefault();
2617 $(".off-canvas-wrap").removeClass("move-right");
2618 })
2619 .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) {
2620 e.preventDefault();
2621 $(this).closest(".off-canvas-wrap").toggleClass("move-left");
2622 })
2623 .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
2624 e.preventDefault();
2625 $(".off-canvas-wrap").removeClass("move-left");
2626 });
2627 },
2628
2629 reflow : function () {}
2630 };
2631}(jQuery, this, this.document));
2632;(function ($, window, document, undefined) {
2633 'use strict';
2634
2635 var noop = function() {};
2636
2637 var Orbit = function(el, settings) {
2638 // Don't reinitialize plugin
2639 if (el.hasClass(settings.slides_container_class)) {
2640 return this;
2641 }
2642
2643 var self = this,
2644 container,
2645 slides_container = el,
2646 number_container,
2647 bullets_container,
2648 timer_container,
2649 idx = 0,
2650 animate,
2651 timer,
2652 locked = false,
2653 adjust_height_after = false;
2654
2655 slides_container.children().first().addClass(settings.active_slide_class);
2656
2657 self.update_slide_number = function(index) {
2658 if (settings.slide_number) {
2659 number_container.find('span:first').text(parseInt(index)+1);
2660 number_container.find('span:last').text(slides_container.children().length);
2661 }
2662 if (settings.bullets) {
2663 bullets_container.children().removeClass(settings.bullets_active_class);
2664 $(bullets_container.children().get(index)).addClass(settings.bullets_active_class);
2665 }
2666 };
2667
2668 self.update_active_link = function(index) {
2669 var link = $('a[data-orbit-link="'+slides_container.children().eq(index).attr('data-orbit-slide')+'"]');
2670 link.parents('ul').find('[data-orbit-link]').removeClass(settings.bullets_active_class);
2671 link.addClass(settings.bullets_active_class);
2672 };
2673
2674 self.build_markup = function() {
2675 slides_container.wrap('<div class="'+settings.container_class+'"></div>');
2676 container = slides_container.parent();
2677 slides_container.addClass(settings.slides_container_class);
2678
2679 if (settings.navigation_arrows) {
2680 container.append($('<a href="#"><span></span></a>').addClass(settings.prev_class));
2681 container.append($('<a href="#"><span></span></a>').addClass(settings.next_class));
2682 }
2683
2684 if (settings.timer) {
2685 timer_container = $('<div>').addClass(settings.timer_container_class);
2686 timer_container.append('<span>');
2687 timer_container.append($('<div>').addClass(settings.timer_progress_class));
2688 timer_container.addClass(settings.timer_paused_class);
2689 container.append(timer_container);
2690 }
2691
2692 if (settings.slide_number) {
2693 number_container = $('<div>').addClass(settings.slide_number_class);
2694 number_container.append('<span></span> ' + settings.slide_number_text + ' <span></span>');
2695 container.append(number_container);
2696 }
2697
2698 if (settings.bullets) {
2699 bullets_container = $('<ol>').addClass(settings.bullets_container_class);
2700 container.append(bullets_container);
2701 bullets_container.wrap('<div class="orbit-bullets-container"></div>');
2702 slides_container.children().each(function(idx, el) {
2703 var bullet = $('<li>').attr('data-orbit-slide', idx);
2704 bullets_container.append(bullet);
2705 });
2706 }
2707
2708 if (settings.stack_on_small) {
2709 container.addClass(settings.stack_on_small_class);
2710 }
2711
2712 self.update_slide_number(0);
2713 self.update_active_link(0);
2714 };
2715
2716 self._goto = function(next_idx, start_timer) {
2717 // if (locked) {return false;}
2718 if (next_idx === idx) {return false;}
2719 if (typeof timer === 'object') {timer.restart();}
2720 var slides = slides_container.children();
2721
2722 var dir = 'next';
2723 locked = true;
2724 if (next_idx < idx) {dir = 'prev';}
2725 if (next_idx >= slides.length) {next_idx = 0;}
2726 else if (next_idx < 0) {next_idx = slides.length - 1;}
2727
2728 var current = $(slides.get(idx));
2729 var next = $(slides.get(next_idx));
2730
2731 current.css('zIndex', 2);
2732 current.removeClass(settings.active_slide_class);
2733 next.css('zIndex', 4).addClass(settings.active_slide_class);
2734
2735 slides_container.trigger('before-slide-change.fndtn.orbit');
2736 settings.before_slide_change();
2737 self.update_active_link(next_idx);
2738
2739 var callback = function() {
2740 var unlock = function() {
2741 idx = next_idx;
2742 locked = false;
2743 if (start_timer === true) {timer = self.create_timer(); timer.start();}
2744 self.update_slide_number(idx);
2745 slides_container.trigger('after-slide-change.fndtn.orbit',[{slide_number: idx, total_slides: slides.length}]);
2746 settings.after_slide_change(idx, slides.length);
2747 };
2748 if (slides_container.height() != next.height() && settings.variable_height) {
2749 slides_container.animate({'height': next.height()}, 250, 'linear', unlock);
2750 } else {
2751 unlock();
2752 }
2753 };
2754
2755 if (slides.length === 1) {callback(); return false;}
2756
2757 var start_animation = function() {
2758 if (dir === 'next') {animate.next(current, next, callback);}
2759 if (dir === 'prev') {animate.prev(current, next, callback);}
2760 };
2761
2762 if (next.height() > slides_container.height() && settings.variable_height) {
2763 slides_container.animate({'height': next.height()}, 250, 'linear', start_animation);
2764 } else {
2765 start_animation();
2766 }
2767 };
2768
2769 self.next = function(e) {
2770 e.stopImmediatePropagation();
2771 e.preventDefault();
2772 self._goto(idx + 1);
2773 };
2774
2775 self.prev = function(e) {
2776 e.stopImmediatePropagation();
2777 e.preventDefault();
2778 self._goto(idx - 1);
2779 };
2780
2781 self.link_custom = function(e) {
2782 e.preventDefault();
2783 var link = $(this).attr('data-orbit-link');
2784 if ((typeof link === 'string') && (link = $.trim(link)) != "") {
2785 var slide = container.find('[data-orbit-slide='+link+']');
2786 if (slide.index() != -1) {self._goto(slide.index());}
2787 }
2788 };
2789
2790 self.link_bullet = function(e) {
2791 var index = $(this).attr('data-orbit-slide');
2792 if ((typeof index === 'string') && (index = $.trim(index)) != "") {
2793 self._goto(parseInt(index));
2794 }
2795 }
2796
2797 self.timer_callback = function() {
2798 self._goto(idx + 1, true);
2799 }
2800
2801 self.compute_dimensions = function() {
2802 var current = $(slides_container.children().get(idx));
2803 var h = current.height();
2804 if (!settings.variable_height) {
2805 slides_container.children().each(function(){
2806 if ($(this).height() > h) { h = $(this).height(); }
2807 });
2808 }
2809 slides_container.height(h);
2810 };
2811
2812 self.create_timer = function() {
2813 var t = new Timer(
2814 container.find('.'+settings.timer_container_class),
2815 settings,
2816 self.timer_callback
2817 );
2818 return t;
2819 };
2820
2821 self.stop_timer = function() {
2822 if (typeof timer === 'object') timer.stop();
2823 };
2824
2825 self.toggle_timer = function() {
2826 var t = container.find('.'+settings.timer_container_class);
2827 if (t.hasClass(settings.timer_paused_class)) {
2828 if (typeof timer === 'undefined') {timer = self.create_timer();}
2829 timer.start();
2830 }
2831 else {
2832 if (typeof timer === 'object') {timer.stop();}
2833 }
2834 };
2835
2836 self.init = function() {
2837 self.build_markup();
2838 if (settings.timer) {timer = self.create_timer(); timer.start();}
2839 animate = new FadeAnimation(settings, slides_container);
2840 if (settings.animation === 'slide')
2841 animate = new SlideAnimation(settings, slides_container);
2842 container.on('click', '.'+settings.next_class, self.next);
2843 container.on('click', '.'+settings.prev_class, self.prev);
2844 container.on('click', '[data-orbit-slide]', self.link_bullet);
2845 container.on('click', self.toggle_timer);
2846 if (settings.swipe) {
2847 container.on('touchstart.fndtn.orbit', function(e) {
2848 if (!e.touches) {e = e.originalEvent;}
2849 var data = {
2850 start_page_x: e.touches[0].pageX,
2851 start_page_y: e.touches[0].pageY,
2852 start_time: (new Date()).getTime(),
2853 delta_x: 0,
2854 is_scrolling: undefined
2855 };
2856 container.data('swipe-transition', data);
2857 e.stopPropagation();
2858 })
2859 .on('touchmove.fndtn.orbit', function(e) {
2860 if (!e.touches) { e = e.originalEvent; }
2861 // Ignore pinch/zoom events
2862 if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
2863
2864 var data = container.data('swipe-transition');
2865 if (typeof data === 'undefined') {data = {};}
2866
2867 data.delta_x = e.touches[0].pageX - data.start_page_x;
2868
2869 if ( typeof data.is_scrolling === 'undefined') {
2870 data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
2871 }
2872
2873 if (!data.is_scrolling && !data.active) {
2874 e.preventDefault();
2875 var direction = (data.delta_x < 0) ? (idx+1) : (idx-1);
2876 data.active = true;
2877 self._goto(direction);
2878 }
2879 })
2880 .on('touchend.fndtn.orbit', function(e) {
2881 container.data('swipe-transition', {});
2882 e.stopPropagation();
2883 })
2884 }
2885 container.on('mouseenter.fndtn.orbit', function(e) {
2886 if (settings.timer && settings.pause_on_hover) {
2887 self.stop_timer();
2888 }
2889 })
2890 .on('mouseleave.fndtn.orbit', function(e) {
2891 if (settings.timer && settings.resume_on_mouseout) {
2892 timer.start();
2893 }
2894 });
2895
2896 $(document).on('click', '[data-orbit-link]', self.link_custom);
2897 $(window).on('resize', self.compute_dimensions);
2898 $(window).on('load', self.compute_dimensions);
2899 $(window).on('load', function(){
2900 container.prev('.preloader').css('display', 'none');
2901 });
2902 slides_container.trigger('ready.fndtn.orbit');
2903 };
2904
2905 self.init();
2906 };
2907
2908 var Timer = function(el, settings, callback) {
2909 var self = this,
2910 duration = settings.timer_speed,
2911 progress = el.find('.'+settings.timer_progress_class),
2912 start,
2913 timeout,
2914 left = -1;
2915
2916 this.update_progress = function(w) {
2917 var new_progress = progress.clone();
2918 new_progress.attr('style', '');
2919 new_progress.css('width', w+'%');
2920 progress.replaceWith(new_progress);
2921 progress = new_progress;
2922 };
2923
2924 this.restart = function() {
2925 clearTimeout(timeout);
2926 el.addClass(settings.timer_paused_class);
2927 left = -1;
2928 self.update_progress(0);
2929 };
2930
2931 this.start = function() {
2932 if (!el.hasClass(settings.timer_paused_class)) {return true;}
2933 left = (left === -1) ? duration : left;
2934 el.removeClass(settings.timer_paused_class);
2935 start = new Date().getTime();
2936 progress.animate({'width': '100%'}, left, 'linear');
2937 timeout = setTimeout(function() {
2938 self.restart();
2939 callback();
2940 }, left);
2941 el.trigger('timer-started.fndtn.orbit')
2942 };
2943
2944 this.stop = function() {
2945 if (el.hasClass(settings.timer_paused_class)) {return true;}
2946 clearTimeout(timeout);
2947 el.addClass(settings.timer_paused_class);
2948 var end = new Date().getTime();
2949 left = left - (end - start);
2950 var w = 100 - ((left / duration) * 100);
2951 self.update_progress(w);
2952 el.trigger('timer-stopped.fndtn.orbit');
2953 };
2954 };
2955
2956 var SlideAnimation = function(settings, container) {
2957 var duration = settings.animation_speed;
2958 var is_rtl = ($('html[dir=rtl]').length === 1);
2959 var margin = is_rtl ? 'marginRight' : 'marginLeft';
2960 var animMargin = {};
2961 animMargin[margin] = '0%';
2962
2963 this.next = function(current, next, callback) {
2964 current.animate({marginLeft:'-100%'}, duration);
2965 next.animate(animMargin, duration, function() {
2966 current.css(margin, '100%');
2967 callback();
2968 });
2969 };
2970
2971 this.prev = function(current, prev, callback) {
2972 current.animate({marginLeft:'100%'}, duration);
2973 prev.css(margin, '-100%');
2974 prev.animate(animMargin, duration, function() {
2975 current.css(margin, '100%');
2976 callback();
2977 });
2978 };
2979 };
2980
2981 var FadeAnimation = function(settings, container) {
2982 var duration = settings.animation_speed;
2983 var is_rtl = ($('html[dir=rtl]').length === 1);
2984 var margin = is_rtl ? 'marginRight' : 'marginLeft';
2985
2986 this.next = function(current, next, callback) {
2987 next.css({'margin':'0%', 'opacity':'0.01'});
2988 next.animate({'opacity':'1'}, duration, 'linear', function() {
2989 current.css('margin', '100%');
2990 callback();
2991 });
2992 };
2993
2994 this.prev = function(current, prev, callback) {
2995 prev.css({'margin':'0%', 'opacity':'0.01'});
2996 prev.animate({'opacity':'1'}, duration, 'linear', function() {
2997 current.css('margin', '100%');
2998 callback();
2999 });
3000 };
3001 };
3002
3003
3004 Foundation.libs = Foundation.libs || {};
3005
3006 Foundation.libs.orbit = {
3007 name: 'orbit',
3008
3009 version: '5.0.0',
3010
3011 settings: {
3012 animation: 'slide',
3013 timer_speed: 10000,
3014 pause_on_hover: true,
3015 resume_on_mouseout: false,
3016 animation_speed: 500,
3017 stack_on_small: false,
3018 navigation_arrows: true,
3019 slide_number: true,
3020 slide_number_text: 'of',
3021 container_class: 'orbit-container',
3022 stack_on_small_class: 'orbit-stack-on-small',
3023 next_class: 'orbit-next',
3024 prev_class: 'orbit-prev',
3025 timer_container_class: 'orbit-timer',
3026 timer_paused_class: 'paused',
3027 timer_progress_class: 'orbit-progress',
3028 slides_container_class: 'orbit-slides-container',
3029 bullets_container_class: 'orbit-bullets',
3030 bullets_active_class: 'active',
3031 slide_number_class: 'orbit-slide-number',
3032 caption_class: 'orbit-caption',
3033 active_slide_class: 'active',
3034 orbit_transition_class: 'orbit-transitioning',
3035 bullets: true,
3036 timer: true,
3037 variable_height: false,
3038 swipe: true,
3039 before_slide_change: noop,
3040 after_slide_change: noop
3041 },
3042
3043 init: function (scope, method, options) {
3044 var self = this;
3045
3046 if (typeof method === 'object') {
3047 $.extend(true, self.settings, method);
3048 }
3049
3050 if ($(scope).is('[data-orbit]')) {
3051 var $el = $(scope);
3052 var opts = self.data_options($el);
3053 new Orbit($el, $.extend({},self.settings, opts));
3054 }
3055
3056 $('[data-orbit]', scope).each(function(idx, el) {
3057 var $el = $(el);
3058 var opts = self.data_options($el);
3059 new Orbit($el, $.extend({},self.settings, opts));
3060 });
3061 }
3062 };
3063
3064
3065}(jQuery, this, this.document));
3066
3067;(function ($, window, document, undefined) {
3068 'use strict';
3069
3070 Foundation.libs.reveal = {
3071 name : 'reveal',
3072
3073 version : '5.0.0',
3074
3075 locked : false,
3076
3077 settings : {
3078 animation: 'fadeAndPop',
3079 animation_speed: 250,
3080 close_on_background_click: true,
3081 close_on_esc: true,
3082 dismiss_modal_class: 'close-reveal-modal',
3083 bg_class: 'reveal-modal-bg',
3084 open: function(){},
3085 opened: function(){},
3086 close: function(){},
3087 closed: function(){},
3088 bg : $('.reveal-modal-bg'),
3089 css : {
3090 open : {
3091 'opacity': 0,
3092 'visibility': 'visible',
3093 'display' : 'block'
3094 },
3095 close : {
3096 'opacity': 1,
3097 'visibility': 'hidden',
3098 'display': 'none'
3099 }
3100 }
3101 },
3102
3103 init : function (scope, method, options) {
3104 Foundation.inherit(this, 'delay');
3105
3106 this.bindings(method, options);
3107 },
3108
3109 events : function (scope) {
3110 var self = this;
3111
3112 $('[data-reveal-id]', this.scope)
3113 .off('.reveal')
3114 .on('click.fndtn.reveal', function (e) {
3115 e.preventDefault();
3116
3117 if (!self.locked) {
3118 var element = $(this),
3119 ajax = element.data('reveal-ajax');
3120
3121 self.locked = true;
3122
3123 if (typeof ajax === 'undefined') {
3124 self.open.call(self, element);
3125 } else {
3126 var url = ajax === true ? element.attr('href') : ajax;
3127
3128 self.open.call(self, element, {url: url});
3129 }
3130 }
3131 });
3132
3133 $(this.scope)
3134 .off('.reveal')
3135 .on('click.fndtn.reveal', this.close_targets(), function (e) {
3136
3137 e.preventDefault();
3138
3139 if (!self.locked) {
3140 var settings = $('[data-reveal].open').data('reveal-init'),
3141 bg_clicked = $(e.target)[0] === $('.' + settings.bg_class)[0];
3142
3143 if (bg_clicked && !settings.close_on_background_click) {
3144 return;
3145 }
3146
3147 self.locked = true;
3148 self.close.call(self, bg_clicked ? $('[data-reveal].open') : $(this).closest('[data-reveal]'));
3149 }
3150 });
3151
3152 if($('[data-reveal]', this.scope).length > 0) {
3153 $(this.scope)
3154 // .off('.reveal')
3155 .on('open.fndtn.reveal', this.settings.open)
3156 .on('opened.fndtn.reveal', this.settings.opened)
3157 .on('opened.fndtn.reveal', this.open_video)
3158 .on('close.fndtn.reveal', this.settings.close)
3159 .on('closed.fndtn.reveal', this.settings.closed)
3160 .on('closed.fndtn.reveal', this.close_video);
3161 } else {
3162 $(this.scope)
3163 // .off('.reveal')
3164 .on('open.fndtn.reveal', '[data-reveal]', this.settings.open)
3165 .on('opened.fndtn.reveal', '[data-reveal]', this.settings.opened)
3166 .on('opened.fndtn.reveal', '[data-reveal]', this.open_video)
3167 .on('close.fndtn.reveal', '[data-reveal]', this.settings.close)
3168 .on('closed.fndtn.reveal', '[data-reveal]', this.settings.closed)
3169 .on('closed.fndtn.reveal', '[data-reveal]', this.close_video);
3170 }
3171
3172 $('body').on('keyup.fndtn.reveal', function ( event ) {
3173 var open_modal = $('[data-reveal].open'),
3174 settings = open_modal.data('reveal-init');
3175 if ( event.which === 27 && settings.close_on_esc) { // 27 is the keycode for the Escape key
3176 open_modal.foundation('reveal', 'close');
3177 }
3178 });
3179
3180 return true;
3181 },
3182
3183 open : function (target, ajax_settings) {
3184 if (target) {
3185 if (typeof target.selector !== 'undefined') {
3186 var modal = $('#' + target.data('reveal-id'));
3187 } else {
3188 var modal = $(this.scope);
3189
3190 ajax_settings = target;
3191 }
3192 } else {
3193 var modal = $(this.scope);
3194 }
3195
3196 if (!modal.hasClass('open')) {
3197 var open_modal = $('[data-reveal].open');
3198
3199 if (typeof modal.data('css-top') === 'undefined') {
3200 modal.data('css-top', parseInt(modal.css('top'), 10))
3201 .data('offset', this.cache_offset(modal));
3202 }
3203
3204 modal.trigger('open');
3205
3206 if (open_modal.length < 1) {
3207 this.toggle_bg();
3208 }
3209
3210 if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
3211 this.hide(open_modal, this.settings.css.close);
3212 this.show(modal, this.settings.css.open);
3213 } else {
3214 var self = this,
3215 old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
3216
3217 $.extend(ajax_settings, {
3218 success: function (data, textStatus, jqXHR) {
3219 if ( $.isFunction(old_success) ) {
3220 old_success(data, textStatus, jqXHR);
3221 }
3222
3223 modal.html(data);
3224 $(modal).foundation('section', 'reflow');
3225
3226 self.hide(open_modal, self.settings.css.close);
3227 self.show(modal, self.settings.css.open);
3228 }
3229 });
3230
3231 $.ajax(ajax_settings);
3232 }
3233 }
3234 },
3235
3236 close : function (modal) {
3237
3238 var modal = modal && modal.length ? modal : $(this.scope),
3239 open_modals = $('[data-reveal].open');
3240
3241 if (open_modals.length > 0) {
3242 this.locked = true;
3243 modal.trigger('close');
3244 this.toggle_bg();
3245 this.hide(open_modals, this.settings.css.close);
3246 }
3247 },
3248
3249 close_targets : function () {
3250 var base = '.' + this.settings.dismiss_modal_class;
3251
3252 if (this.settings.close_on_background_click) {
3253 return base + ', .' + this.settings.bg_class;
3254 }
3255
3256 return base;
3257 },
3258
3259 toggle_bg : function () {
3260 if ($('.' + this.settings.bg_class).length === 0) {
3261 this.settings.bg = $('<div />', {'class': this.settings.bg_class})
3262 .appendTo('body');
3263 }
3264
3265 if (this.settings.bg.filter(':visible').length > 0) {
3266 this.hide(this.settings.bg);
3267 } else {
3268 this.show(this.settings.bg);
3269 }
3270 },
3271
3272 show : function (el, css) {
3273 // is modal
3274 if (css) {
3275 if (el.parent('body').length === 0) {
3276 var placeholder = el.wrap('<div style="display: none;" />').parent();
3277 el.on('closed.fndtn.reveal.wrapped', function() {
3278 el.detach().appendTo(placeholder);
3279 el.unwrap().unbind('closed.fndtn.reveal.wrapped');
3280 });
3281
3282 el.detach().appendTo('body');
3283 }
3284
3285 if (/pop/i.test(this.settings.animation)) {
3286 css.top = $(window).scrollTop() - el.data('offset') + 'px';
3287 var end_css = {
3288 top: $(window).scrollTop() + el.data('css-top') + 'px',
3289 opacity: 1
3290 };
3291
3292 return this.delay(function () {
3293 return el
3294 .css(css)
3295 .animate(end_css, this.settings.animation_speed, 'linear', function () {
3296 this.locked = false;
3297 el.trigger('opened');
3298 }.bind(this))
3299 .addClass('open');
3300 }.bind(this), this.settings.animation_speed / 2);
3301 }
3302
3303 if (/fade/i.test(this.settings.animation)) {
3304 var end_css = {opacity: 1};
3305
3306 return this.delay(function () {
3307 return el
3308 .css(css)
3309 .animate(end_css, this.settings.animation_speed, 'linear', function () {
3310 this.locked = false;
3311 el.trigger('opened');
3312 }.bind(this))
3313 .addClass('open');
3314 }.bind(this), this.settings.animation_speed / 2);
3315 }
3316
3317 return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened');
3318 }
3319
3320 // should we animate the background?
3321 if (/fade/i.test(this.settings.animation)) {
3322 return el.fadeIn(this.settings.animation_speed / 2);
3323 }
3324
3325 return el.show();
3326 },
3327
3328 hide : function (el, css) {
3329 // is modal
3330 if (css) {
3331 if (/pop/i.test(this.settings.animation)) {
3332 var end_css = {
3333 top: - $(window).scrollTop() - el.data('offset') + 'px',
3334 opacity: 0
3335 };
3336
3337 return this.delay(function () {
3338 return el
3339 .animate(end_css, this.settings.animation_speed, 'linear', function () {
3340 this.locked = false;
3341 el.css(css).trigger('closed');
3342 }.bind(this))
3343 .removeClass('open');
3344 }.bind(this), this.settings.animation_speed / 2);
3345 }
3346
3347 if (/fade/i.test(this.settings.animation)) {
3348 var end_css = {opacity: 0};
3349
3350 return this.delay(function () {
3351 return el
3352 .animate(end_css, this.settings.animation_speed, 'linear', function () {
3353 this.locked = false;
3354 el.css(css).trigger('closed');
3355 }.bind(this))
3356 .removeClass('open');
3357 }.bind(this), this.settings.animation_speed / 2);
3358 }
3359
3360 return el.hide().css(css).removeClass('open').trigger('closed');
3361 }
3362
3363 // should we animate the background?
3364 if (/fade/i.test(this.settings.animation)) {
3365 return el.fadeOut(this.settings.animation_speed / 2);
3366 }
3367
3368 return el.hide();
3369 },
3370
3371 close_video : function (e) {
3372 var video = $(this).find('.flex-video'),
3373 iframe = video.find('iframe');
3374
3375 if (iframe.length > 0) {
3376 iframe.attr('data-src', iframe[0].src);
3377 iframe.attr('src', 'about:blank');
3378 video.hide();
3379 }
3380 },
3381
3382 open_video : function (e) {
3383 var video = $(this).find('.flex-video'),
3384 iframe = video.find('iframe');
3385
3386 if (iframe.length > 0) {
3387 var data_src = iframe.attr('data-src');
3388 if (typeof data_src === 'string') {
3389 iframe[0].src = iframe.attr('data-src');
3390 } else {
3391 var src = iframe[0].src;
3392 iframe[0].src = undefined;
3393 iframe[0].src = src;
3394 }
3395 video.show();
3396 }
3397 },
3398
3399 cache_offset : function (modal) {
3400 var offset = modal.show().height() + parseInt(modal.css('top'), 10);
3401
3402 modal.hide();
3403
3404 return offset;
3405 },
3406
3407 off : function () {
3408 $(this.scope).off('.fndtn.reveal');
3409 },
3410
3411 reflow : function () {}
3412 };
3413}(jQuery, this, this.document));
3414
3415/*jslint unparam: true, browser: true, indent: 2 */
3416;(function ($, window, document, undefined) {
3417 'use strict';
3418
3419 Foundation.libs.tab = {
3420 name : 'tab',
3421
3422 version : '5.0.1',
3423
3424 settings : {
3425 active_class: 'active'
3426 },
3427
3428 init : function (scope, method, options) {
3429 this.bindings(method, options);
3430 },
3431
3432 events : function () {
3433 $(this.scope).off('.tab').on('click.fndtn.tab', '[data-tab] > dd > a', function (e) {
3434 e.preventDefault();
3435
3436 var tab = $(this).parent(),
3437 target = $('#' + this.href.split('#')[1]),
3438 siblings = tab.siblings(),
3439 settings = tab.closest('[data-tab]').data('tab-init');
3440
3441 tab.addClass(settings.active_class);
3442 siblings.removeClass(settings.active_class);
3443 target.siblings().removeClass(settings.active_class).end().addClass(settings.active_class);
3444 });
3445 },
3446
3447 off : function () {},
3448
3449 reflow : function () {}
3450 };
3451}(jQuery, this, this.document));
3452
3453;(function ($, window, document, undefined) {
3454 'use strict';
3455
3456 Foundation.libs.tooltip = {
3457 name : 'tooltip',
3458
3459 version : '5.0.0',
3460
3461 settings : {
3462 additional_inheritable_classes : [],
3463 tooltip_class : '.tooltip',
3464 append_to: 'body',
3465 touch_close_text: 'Tap To Close',
3466 disable_for_touch: false,
3467 tip_template : function (selector, content) {
3468 return '<span data-selector="' + selector + '" class="'
3469 + Foundation.libs.tooltip.settings.tooltip_class.substring(1)
3470 + '">' + content + '<span class="nub"></span></span>';
3471 }
3472 },
3473
3474 cache : {},
3475
3476 init : function (scope, method, options) {
3477 this.bindings(method, options);
3478 },
3479
3480 events : function () {
3481 var self = this;
3482
3483 if (Modernizr.touch) {
3484 $(this.scope)
3485 .off('.tooltip')
3486 .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip',
3487 '[data-tooltip]', function (e) {
3488 var settings = $.extend({}, self.settings, self.data_options($(this)));
3489 if (!settings.disable_for_touch) {
3490 e.preventDefault();
3491 $(settings.tooltip_class).hide();
3492 self.showOrCreateTip($(this));
3493 }
3494 })
3495 .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip',
3496 this.settings.tooltip_class, function (e) {
3497 e.preventDefault();
3498 $(this).fadeOut(150);
3499 });
3500 } else {
3501 $(this.scope)
3502 .off('.tooltip')
3503 .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip',
3504 '[data-tooltip]', function (e) {
3505 var $this = $(this);
3506
3507 if (/enter|over/i.test(e.type)) {
3508 self.showOrCreateTip($this);
3509 } else if (e.type === 'mouseout' || e.type === 'mouseleave') {
3510 self.hide($this);
3511 }
3512 });
3513 }
3514 },
3515
3516 showOrCreateTip : function ($target) {
3517 var $tip = this.getTip($target);
3518
3519 if ($tip && $tip.length > 0) {
3520 return this.show($target);
3521 }
3522
3523 return this.create($target);
3524 },
3525
3526 getTip : function ($target) {
3527 var selector = this.selector($target),
3528 tip = null;
3529
3530 if (selector) {
3531 tip = $('span[data-selector="' + selector + '"]' + this.settings.tooltip_class);
3532 }
3533
3534 return (typeof tip === 'object') ? tip : false;
3535 },
3536
3537 selector : function ($target) {
3538 var id = $target.attr('id'),
3539 dataSelector = $target.attr('data-tooltip') || $target.attr('data-selector');
3540
3541 if ((id && id.length < 1 || !id) && typeof dataSelector != 'string') {
3542 dataSelector = 'tooltip' + Math.random().toString(36).substring(7);
3543 $target.attr('data-selector', dataSelector);
3544 }
3545
3546 return (id && id.length > 0) ? id : dataSelector;
3547 },
3548
3549 create : function ($target) {
3550 var $tip = $(this.settings.tip_template(this.selector($target), $('<div></div>').html($target.attr('title')).html())),
3551 classes = this.inheritable_classes($target);
3552
3553 $tip.addClass(classes).appendTo(this.settings.append_to);
3554 if (Modernizr.touch) {
3555 $tip.append('<span class="tap-to-close">'+this.settings.touch_close_text+'</span>');
3556 }
3557 $target.removeAttr('title').attr('title','');
3558 this.show($target);
3559 },
3560
3561 reposition : function (target, tip, classes) {
3562 var width, nub, nubHeight, nubWidth, column, objPos;
3563
3564 tip.css('visibility', 'hidden').show();
3565
3566 width = target.data('width');
3567 nub = tip.children('.nub');
3568 nubHeight = nub.outerHeight();
3569 nubWidth = nub.outerHeight();
3570
3571 objPos = function (obj, top, right, bottom, left, width) {
3572 return obj.css({
3573 'top' : (top) ? top : 'auto',
3574 'bottom' : (bottom) ? bottom : 'auto',
3575 'left' : (left) ? left : 'auto',
3576 'right' : (right) ? right : 'auto',
3577 'width' : (width) ? width : 'auto'
3578 }).end();
3579 };
3580
3581 objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', target.offset().left, width);
3582
3583 if (this.small()) {
3584 objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', 12.5, $(this.scope).width());
3585 tip.addClass('tip-override');
3586 objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
3587 } else {
3588 var left = target.offset().left;
3589 if (Foundation.rtl) {
3590 left = target.offset().left + target.offset().width - tip.outerWidth();
3591 }
3592 objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', left, width);
3593 tip.removeClass('tip-override');
3594 if (classes && classes.indexOf('tip-top') > -1) {
3595 objPos(tip, (target.offset().top - tip.outerHeight()), 'auto', 'auto', left, width)
3596 .removeClass('tip-override');
3597 } else if (classes && classes.indexOf('tip-left') > -1) {
3598 objPos(tip, (target.offset().top + (target.outerHeight() / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left - tip.outerWidth() - nubHeight), width)
3599 .removeClass('tip-override');
3600 } else if (classes && classes.indexOf('tip-right') > -1) {
3601 objPos(tip, (target.offset().top + (target.outerHeight() / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left + target.outerWidth() + nubHeight), width)
3602 .removeClass('tip-override');
3603 }
3604 }
3605
3606 tip.css('visibility', 'visible').hide();
3607 },
3608
3609 small : function () {
3610 return matchMedia(Foundation.media_queries.small).matches;
3611 },
3612
3613 inheritable_classes : function (target) {
3614 var inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'noradius'].concat(this.settings.additional_inheritable_classes),
3615 classes = target.attr('class'),
3616 filtered = classes ? $.map(classes.split(' '), function (el, i) {
3617 if ($.inArray(el, inheritables) !== -1) {
3618 return el;
3619 }
3620 }).join(' ') : '';
3621
3622 return $.trim(filtered);
3623 },
3624
3625 show : function ($target) {
3626 var $tip = this.getTip($target);
3627
3628 this.reposition($target, $tip, $target.attr('class'));
3629 $tip.fadeIn(150);
3630 },
3631
3632 hide : function ($target) {
3633 var $tip = this.getTip($target);
3634
3635 $tip.fadeOut(150);
3636 },
3637
3638 // deprecate reload
3639 reload : function () {
3640 var $self = $(this);
3641
3642 return ($self.data('fndtn-tooltips')) ? $self.foundationTooltips('destroy').foundationTooltips('init') : $self.foundationTooltips('init');
3643 },
3644
3645 off : function () {
3646 $(this.scope).off('.fndtn.tooltip');
3647 $(this.settings.tooltip_class).each(function (i) {
3648 $('[data-tooltip]').get(i).attr('title', $(this).text());
3649 }).remove();
3650 },
3651
3652 reflow : function () {}
3653 };
3654}(jQuery, this, this.document));
3655
3656;(function ($, window, document, undefined) {
3657 'use strict';
3658
3659 Foundation.libs.topbar = {
3660 name : 'topbar',
3661
3662 version: '5.0.1',
3663
3664 settings : {
3665 index : 0,
3666 sticky_class : 'sticky',
3667 custom_back_text: true,
3668 back_text: 'Back',
3669 is_hover: true,
3670 mobile_show_parent_link: false,
3671 scrolltop : true // jump to top when sticky nav menu toggle is clicked
3672 },
3673
3674 init : function (section, method, options) {
3675 Foundation.inherit(this, 'addCustomRule register_media throttle');
3676 var self = this;
3677
3678 self.register_media('topbar', 'foundation-mq-topbar');
3679
3680 this.bindings(method, options);
3681
3682 $('[data-topbar]', this.scope).each(function () {
3683 var topbar = $(this),
3684 settings = topbar.data('topbar-init'),
3685 section = $('section', this),
3686 titlebar = $('> ul', this).first();
3687
3688 topbar.data('index', 0);
3689
3690 var topbarContainer = topbar.parent();
3691 if(topbarContainer.hasClass('fixed') || topbarContainer.hasClass(settings.sticky_class)) {
3692 self.settings.sticky_class = settings.sticky_class;
3693 self.settings.stick_topbar = topbar;
3694 topbar.data('height', topbarContainer.outerHeight());
3695 topbar.data('stickyoffset', topbarContainer.offset().top);
3696 } else {
3697 topbar.data('height', topbar.outerHeight());
3698 }
3699
3700 if (!settings.assembled) self.assemble(topbar);
3701
3702 if (settings.is_hover) {
3703 $('.has-dropdown', topbar).addClass('not-click');
3704 } else {
3705 $('.has-dropdown', topbar).removeClass('not-click');
3706 }
3707
3708 // Pad body when sticky (scrolled) or fixed.
3709 self.addCustomRule('.f-topbar-fixed { padding-top: ' + topbar.data('height') + 'px }');
3710
3711 if (topbarContainer.hasClass('fixed')) {
3712 $('body').addClass('f-topbar-fixed');
3713 }
3714 });
3715
3716 },
3717
3718 toggle: function (toggleEl) {
3719 var self = this;
3720
3721 if (toggleEl) {
3722 var topbar = $(toggleEl).closest('[data-topbar]');
3723 } else {
3724 var topbar = $('[data-topbar]');
3725 }
3726
3727 var settings = topbar.data('topbar-init');
3728
3729 var section = $('section, .section', topbar);
3730
3731 if (self.breakpoint()) {
3732 if (!self.rtl) {
3733 section.css({left: '0%'});
3734 $('>.name', section).css({left: '100%'});
3735 } else {
3736 section.css({right: '0%'});
3737 $('>.name', section).css({right: '100%'});
3738 }
3739
3740 $('li.moved', section).removeClass('moved');
3741 topbar.data('index', 0);
3742
3743 topbar
3744 .toggleClass('expanded')
3745 .css('height', '');
3746 }
3747
3748 if (settings.scrolltop) {
3749 if (!topbar.hasClass('expanded')) {
3750 if (topbar.hasClass('fixed')) {
3751 topbar.parent().addClass('fixed');
3752 topbar.removeClass('fixed');
3753 $('body').addClass('f-topbar-fixed');
3754 }
3755 } else if (topbar.parent().hasClass('fixed')) {
3756 if (settings.scrolltop) {
3757 topbar.parent().removeClass('fixed');
3758 topbar.addClass('fixed');
3759 $('body').removeClass('f-topbar-fixed');
3760
3761 window.scrollTo(0,0);
3762 } else {
3763 topbar.parent().removeClass('expanded');
3764 }
3765 }
3766 } else {
3767 if(topbar.parent().hasClass(self.settings.sticky_class)) {
3768 topbar.parent().addClass('fixed');
3769 }
3770
3771 if(topbar.parent().hasClass('fixed')) {
3772 if (!topbar.hasClass('expanded')) {
3773 topbar.removeClass('fixed');
3774 topbar.parent().removeClass('expanded');
3775 self.update_sticky_positioning();
3776 } else {
3777 topbar.addClass('fixed');
3778 topbar.parent().addClass('expanded');
3779 }
3780 }
3781 }
3782 },
3783
3784 timer : null,
3785
3786 events : function (bar) {
3787 var self = this;
3788 $(this.scope)
3789 .off('.topbar')
3790 .on('click.fndtn.topbar', '[data-topbar] .toggle-topbar', function (e) {
3791 e.preventDefault();
3792 self.toggle(this);
3793 })
3794 .on('click.fndtn.topbar', '[data-topbar] li.has-dropdown', function (e) {
3795 var li = $(this),
3796 target = $(e.target),
3797 topbar = li.closest('[data-topbar]'),
3798 settings = topbar.data('topbar-init');
3799
3800 if(target.data('revealId')) {
3801 self.toggle();
3802 return;
3803 }
3804
3805 if (self.breakpoint()) return;
3806 if (settings.is_hover && !Modernizr.touch) return;
3807
3808 e.stopImmediatePropagation();
3809
3810 if (li.hasClass('hover')) {
3811 li
3812 .removeClass('hover')
3813 .find('li')
3814 .removeClass('hover');
3815
3816 li.parents('li.hover')
3817 .removeClass('hover');
3818 } else {
3819 li.addClass('hover');
3820
3821 if (target[0].nodeName === 'A' && target.parent().hasClass('has-dropdown')) {
3822 e.preventDefault();
3823 }
3824 }
3825 })
3826 .on('click.fndtn.topbar', '[data-topbar] .has-dropdown>a', function (e) {
3827 if (self.breakpoint()) {
3828
3829 e.preventDefault();
3830
3831 var $this = $(this),
3832 topbar = $this.closest('[data-topbar]'),
3833 section = topbar.find('section, .section'),
3834 dropdownHeight = $this.next('.dropdown').outerHeight(),
3835 $selectedLi = $this.closest('li');
3836
3837 topbar.data('index', topbar.data('index') + 1);
3838 $selectedLi.addClass('moved');
3839
3840 if (!self.rtl) {
3841 section.css({left: -(100 * topbar.data('index')) + '%'});
3842 section.find('>.name').css({left: 100 * topbar.data('index') + '%'});
3843 } else {
3844 section.css({right: -(100 * topbar.data('index')) + '%'});
3845 section.find('>.name').css({right: 100 * topbar.data('index') + '%'});
3846 }
3847
3848 topbar.css('height', $this.siblings('ul').outerHeight(true) + topbar.data('height'));
3849 }
3850 });
3851
3852 $(window).off('.topbar').on('resize.fndtn.topbar', self.throttle(function () {
3853 self.resize.call(self);
3854 }, 50)).trigger('resize');
3855
3856 $('body').off('.topbar').on('click.fndtn.topbar touchstart.fndtn.topbar', function (e) {
3857 var parent = $(e.target).closest('li').closest('li.hover');
3858
3859 if (parent.length > 0) {
3860 return;
3861 }
3862
3863 $('[data-topbar] li').removeClass('hover');
3864 });
3865
3866 // Go up a level on Click
3867 $(this.scope).on('click.fndtn.topbar', '[data-topbar] .has-dropdown .back', function (e) {
3868 e.preventDefault();
3869
3870 var $this = $(this),
3871 topbar = $this.closest('[data-topbar]'),
3872 section = topbar.find('section, .section'),
3873 settings = topbar.data('topbar-init'),
3874 $movedLi = $this.closest('li.moved'),
3875 $previousLevelUl = $movedLi.parent();
3876
3877 topbar.data('index', topbar.data('index') - 1);
3878
3879 if (!self.rtl) {
3880 section.css({left: -(100 * topbar.data('index')) + '%'});
3881 section.find('>.name').css({left: 100 * topbar.data('index') + '%'});
3882 } else {
3883 section.css({right: -(100 * topbar.data('index')) + '%'});
3884 section.find('>.name').css({right: 100 * topbar.data('index') + '%'});
3885 }
3886
3887 if (topbar.data('index') === 0) {
3888 topbar.css('height', '');
3889 } else {
3890 topbar.css('height', $previousLevelUl.outerHeight(true) + topbar.data('height'));
3891 }
3892
3893 setTimeout(function () {
3894 $movedLi.removeClass('moved');
3895 }, 300);
3896 });
3897 },
3898
3899 resize : function () {
3900 var self = this;
3901 $('[data-topbar]').each(function () {
3902 var topbar = $(this),
3903 settings = topbar.data('topbar-init');
3904
3905 var stickyContainer = topbar.parent('.' + self.settings.sticky_class);
3906 var stickyOffset;
3907
3908 if (!self.breakpoint()) {
3909 var doToggle = topbar.hasClass('expanded');
3910 topbar
3911 .css('height', '')
3912 .removeClass('expanded')
3913 .find('li')
3914 .removeClass('hover');
3915
3916 if(doToggle) {
3917 self.toggle(topbar);
3918 }
3919 }
3920
3921 if(stickyContainer.length > 0) {
3922 if(stickyContainer.hasClass('fixed')) {
3923 // Remove the fixed to allow for correct calculation of the offset.
3924 stickyContainer.removeClass('fixed');
3925
3926 stickyOffset = stickyContainer.offset().top;
3927 if($(document.body).hasClass('f-topbar-fixed')) {
3928 stickyOffset -= topbar.data('height');
3929 }
3930
3931 topbar.data('stickyoffset', stickyOffset);
3932 stickyContainer.addClass('fixed');
3933 } else {
3934 stickyOffset = stickyContainer.offset().top;
3935 topbar.data('stickyoffset', stickyOffset);
3936 }
3937 }
3938
3939 });
3940 },
3941
3942 breakpoint : function () {
3943 return !matchMedia(Foundation.media_queries['topbar']).matches;
3944 },
3945
3946 assemble : function (topbar) {
3947 var self = this,
3948 settings = topbar.data('topbar-init'),
3949 section = $('section', topbar),
3950 titlebar = $('> ul', topbar).first();
3951
3952 // Pull element out of the DOM for manipulation
3953 section.detach();
3954
3955 $('.has-dropdown>a', section).each(function () {
3956 var $link = $(this),
3957 $dropdown = $link.siblings('.dropdown'),
3958 url = $link.attr('href');
3959
3960 if (settings.mobile_show_parent_link && url && url.length > 1) {
3961 var $titleLi = $('<li class="title back js-generated"><h5><a href="#"></a></h5></li><li><a class="parent-link js-generated" href="' + url + '">' + $link.text() +'</a></li>');
3962 } else {
3963 var $titleLi = $('<li class="title back js-generated"><h5><a href="#"></a></h5></li>');
3964 }
3965
3966 // Copy link to subnav
3967 if (settings.custom_back_text == true) {
3968 $('h5>a', $titleLi).html(settings.back_text);
3969 } else {
3970 $('h5>a', $titleLi).html('« ' + $link.html());
3971 }
3972 $dropdown.prepend($titleLi);
3973 });
3974
3975 // Put element back in the DOM
3976 section.appendTo(topbar);
3977
3978 // check for sticky
3979 this.sticky();
3980
3981 this.assembled(topbar);
3982 },
3983
3984 assembled : function (topbar) {
3985 topbar.data('topbar-init', $.extend({}, topbar.data('topbar-init'), {assembled: true}));
3986 },
3987
3988 height : function (ul) {
3989 var total = 0,
3990 self = this;
3991
3992 $('> li', ul).each(function () { total += $(this).outerHeight(true); });
3993
3994 return total;
3995 },
3996
3997 sticky : function () {
3998 var $window = $(window),
3999 self = this;
4000
4001 $(window).on('scroll', function() {
4002 self.update_sticky_positioning();
4003 });
4004 },
4005
4006 update_sticky_positioning: function() {
4007 var klass = '.' + this.settings.sticky_class;
4008 var $window = $(window);
4009
4010 if ($(klass).length > 0) {
4011 var distance = this.settings.sticky_topbar.data('stickyoffset');
4012 if (!$(klass).hasClass('expanded')) {
4013 if ($window.scrollTop() > (distance)) {
4014 if (!$(klass).hasClass('fixed')) {
4015 $(klass).addClass('fixed');
4016 $('body').addClass('f-topbar-fixed');
4017 }
4018 } else if ($window.scrollTop() <= distance) {
4019 if ($(klass).hasClass('fixed')) {
4020 $(klass).removeClass('fixed');
4021 $('body').removeClass('f-topbar-fixed');
4022 }
4023 }
4024 }
4025 }
4026 },
4027
4028 off : function () {
4029 $(this.scope).off('.fndtn.topbar');
4030 $(window).off('.fndtn.topbar');
4031 },
4032
4033 reflow : function () {}
4034 };
4035}(jQuery, this, this.document));
4036/*!
4037 * Modernizr v2.7.1
4038 * www.modernizr.com
4039 *
4040 * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton
4041 * Available under the BSD and MIT licenses: www.modernizr.com/license/
4042 */
4043
4044/*
4045 * Modernizr tests which native CSS3 and HTML5 features are available in
4046 * the current UA and makes the results available to you in two ways:
4047 * as properties on a global Modernizr object, and as classes on the
4048 * <html> element. This information allows you to progressively enhance
4049 * your pages with a granular level of control over the experience.
4050 *
4051 * Modernizr has an optional (not included) conditional resource loader
4052 * called Modernizr.load(), based on Yepnope.js (yepnopejs.com).
4053 * To get a build that includes Modernizr.load(), as well as choosing
4054 * which tests to include, go to www.modernizr.com/download/
4055 *
4056 * Authors Faruk Ates, Paul Irish, Alex Sexton
4057 * Contributors Ryan Seddon, Ben Alman
4058 */
4059
4060
4061window.Modernizr = (function( window, document, undefined ) {
4062
4063 var version = '2.7.1',
4064
4065 Modernizr = {},
4066
4067 /*>>cssclasses*/
4068 // option for enabling the HTML classes to be added
4069 enableClasses = true,
4070 /*>>cssclasses*/
4071
4072 docElement = document.documentElement,
4073
4074 /**
4075 * Create our "modernizr" element that we do most feature tests on.
4076 */
4077 mod = 'modernizr',
4078 modElem = document.createElement(mod),
4079 mStyle = modElem.style,
4080
4081 /**
4082 * Create the input element for various Web Forms feature tests.
4083 */
4084 inputElem /*>>inputelem*/ = document.createElement('input') /*>>inputelem*/ ,
4085
4086 /*>>smile*/
4087 smile = ':)',
4088 /*>>smile*/
4089
4090 toString = {}.toString,
4091
4092 // TODO :: make the prefixes more granular
4093 /*>>prefixes*/
4094 // List of property values to set for css tests. See ticket #21
4095 prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
4096 /*>>prefixes*/
4097
4098 /*>>domprefixes*/
4099 // Following spec is to expose vendor-specific style properties as:
4100 // elem.style.WebkitBorderRadius
4101 // and the following would be incorrect:
4102 // elem.style.webkitBorderRadius
4103
4104 // Webkit ghosts their properties in lowercase but Opera & Moz do not.
4105 // Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+
4106 // erik.eae.net/archives/2008/03/10/21.48.10/
4107
4108 // More here: github.com/Modernizr/Modernizr/issues/issue/21
4109 omPrefixes = 'Webkit Moz O ms',
4110
4111 cssomPrefixes = omPrefixes.split(' '),
4112
4113 domPrefixes = omPrefixes.toLowerCase().split(' '),
4114 /*>>domprefixes*/
4115
4116 /*>>ns*/
4117 ns = {'svg': 'http://www.w3.org/2000/svg'},
4118 /*>>ns*/
4119
4120 tests = {},
4121 inputs = {},
4122 attrs = {},
4123
4124 classes = [],
4125
4126 slice = classes.slice,
4127
4128 featureName, // used in testing loop
4129
4130
4131 /*>>teststyles*/
4132 // Inject element with style element and some CSS rules
4133 injectElementWithStyles = function( rule, callback, nodes, testnames ) {
4134
4135 var style, ret, node, docOverflow,
4136 div = document.createElement('div'),
4137 // After page load injecting a fake body doesn't work so check if body exists
4138 body = document.body,
4139 // IE6 and 7 won't return offsetWidth or offsetHeight unless it's in the body element, so we fake it.
4140 fakeBody = body || document.createElement('body');
4141
4142 if ( parseInt(nodes, 10) ) {
4143 // In order not to give false positives we create a node for each test
4144 // This also allows the method to scale for unspecified uses
4145 while ( nodes-- ) {
4146 node = document.createElement('div');
4147 node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
4148 div.appendChild(node);
4149 }
4150 }
4151
4152 // <style> elements in IE6-9 are considered 'NoScope' elements and therefore will be removed
4153 // when injected with innerHTML. To get around this you need to prepend the 'NoScope' element
4154 // with a 'scoped' element, in our case the soft-hyphen entity as it won't mess with our measurements.
4155 // msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx
4156 // Documents served as xml will throw if using ­ so use xml friendly encoded version. See issue #277
4157 style = ['­','<style id="s', mod, '">', rule, '</style>'].join('');
4158 div.id = mod;
4159 // IE6 will false positive on some tests due to the style element inside the test div somehow interfering offsetHeight, so insert it into body or fakebody.
4160 // Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270
4161 (body ? div : fakeBody).innerHTML += style;
4162 fakeBody.appendChild(div);
4163 if ( !body ) {
4164 //avoid crashing IE8, if background image is used
4165 fakeBody.style.background = '';
4166 //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible
4167 fakeBody.style.overflow = 'hidden';
4168 docOverflow = docElement.style.overflow;
4169 docElement.style.overflow = 'hidden';
4170 docElement.appendChild(fakeBody);
4171 }
4172
4173 ret = callback(div, rule);
4174 // If this is done after page load we don't want to remove the body so check if body exists
4175 if ( !body ) {
4176 fakeBody.parentNode.removeChild(fakeBody);
4177 docElement.style.overflow = docOverflow;
4178 } else {
4179 div.parentNode.removeChild(div);
4180 }
4181
4182 return !!ret;
4183
4184 },
4185 /*>>teststyles*/
4186
4187 /*>>mq*/
4188 // adapted from matchMedia polyfill
4189 // by Scott Jehl and Paul Irish
4190 // gist.github.com/786768
4191 testMediaQuery = function( mq ) {
4192
4193 var matchMedia = window.matchMedia || window.msMatchMedia;
4194 if ( matchMedia ) {
4195 return matchMedia(mq).matches;
4196 }
4197
4198 var bool;
4199
4200 injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) {
4201 bool = (window.getComputedStyle ?
4202 getComputedStyle(node, null) :
4203 node.currentStyle)['position'] == 'absolute';
4204 });
4205
4206 return bool;
4207
4208 },
4209 /*>>mq*/
4210
4211
4212 /*>>hasevent*/
4213 //
4214 // isEventSupported determines if a given element supports the given event
4215 // kangax.github.com/iseventsupported/
4216 //
4217 // The following results are known incorrects:
4218 // Modernizr.hasEvent("webkitTransitionEnd", elem) // false negative
4219 // Modernizr.hasEvent("textInput") // in Webkit. github.com/Modernizr/Modernizr/issues/333
4220 // ...
4221 isEventSupported = (function() {
4222
4223 var TAGNAMES = {
4224 'select': 'input', 'change': 'input',
4225 'submit': 'form', 'reset': 'form',
4226 'error': 'img', 'load': 'img', 'abort': 'img'
4227 };
4228
4229 function isEventSupported( eventName, element ) {
4230
4231 element = element || document.createElement(TAGNAMES[eventName] || 'div');
4232 eventName = 'on' + eventName;
4233
4234 // When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those
4235 var isSupported = eventName in element;
4236
4237 if ( !isSupported ) {
4238 // If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element
4239 if ( !element.setAttribute ) {
4240 element = document.createElement('div');
4241 }
4242 if ( element.setAttribute && element.removeAttribute ) {
4243 element.setAttribute(eventName, '');
4244 isSupported = is(element[eventName], 'function');
4245
4246 // If property was created, "remove it" (by setting value to `undefined`)
4247 if ( !is(element[eventName], 'undefined') ) {
4248 element[eventName] = undefined;
4249 }
4250 element.removeAttribute(eventName);
4251 }
4252 }
4253
4254 element = null;
4255 return isSupported;
4256 }
4257 return isEventSupported;
4258 })(),
4259 /*>>hasevent*/
4260
4261 // TODO :: Add flag for hasownprop ? didn't last time
4262
4263 // hasOwnProperty shim by kangax needed for Safari 2.0 support
4264 _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;
4265
4266 if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
4267 hasOwnProp = function (object, property) {
4268 return _hasOwnProperty.call(object, property);
4269 };
4270 }
4271 else {
4272 hasOwnProp = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */
4273 return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
4274 };
4275 }
4276
4277 // Adapted from ES5-shim https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js
4278 // es5.github.com/#x15.3.4.5
4279
4280 if (!Function.prototype.bind) {
4281 Function.prototype.bind = function bind(that) {
4282
4283 var target = this;
4284
4285 if (typeof target != "function") {
4286 throw new TypeError();
4287 }
4288
4289 var args = slice.call(arguments, 1),
4290 bound = function () {
4291
4292 if (this instanceof bound) {
4293
4294 var F = function(){};
4295 F.prototype = target.prototype;
4296 var self = new F();
4297
4298 var result = target.apply(
4299 self,
4300 args.concat(slice.call(arguments))
4301 );
4302 if (Object(result) === result) {
4303 return result;
4304 }
4305 return self;
4306
4307 } else {
4308
4309 return target.apply(
4310 that,
4311 args.concat(slice.call(arguments))
4312 );
4313
4314 }
4315
4316 };
4317
4318 return bound;
4319 };
4320 }
4321
4322 /**
4323 * setCss applies given styles to the Modernizr DOM node.
4324 */
4325 function setCss( str ) {
4326 mStyle.cssText = str;
4327 }
4328
4329 /**
4330 * setCssAll extrapolates all vendor-specific css strings.
4331 */
4332 function setCssAll( str1, str2 ) {
4333 return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
4334 }
4335
4336 /**
4337 * is returns a boolean for if typeof obj is exactly type.
4338 */
4339 function is( obj, type ) {
4340 return typeof obj === type;
4341 }
4342
4343 /**
4344 * contains returns a boolean for if substr is found within str.
4345 */
4346 function contains( str, substr ) {
4347 return !!~('' + str).indexOf(substr);
4348 }
4349
4350 /*>>testprop*/
4351
4352 // testProps is a generic CSS / DOM property test.
4353
4354 // In testing support for a given CSS property, it's legit to test:
4355 // `elem.style[styleName] !== undefined`
4356 // If the property is supported it will return an empty string,
4357 // if unsupported it will return undefined.
4358
4359 // We'll take advantage of this quick test and skip setting a style
4360 // on our modernizr element, but instead just testing undefined vs
4361 // empty string.
4362
4363 // Because the testing of the CSS property names (with "-", as
4364 // opposed to the camelCase DOM properties) is non-portable and
4365 // non-standard but works in WebKit and IE (but not Gecko or Opera),
4366 // we explicitly reject properties with dashes so that authors
4367 // developing in WebKit or IE first don't end up with
4368 // browser-specific content by accident.
4369
4370 function testProps( props, prefixed ) {
4371 for ( var i in props ) {
4372 var prop = props[i];
4373 if ( !contains(prop, "-") && mStyle[prop] !== undefined ) {
4374 return prefixed == 'pfx' ? prop : true;
4375 }
4376 }
4377 return false;
4378 }
4379 /*>>testprop*/
4380
4381 // TODO :: add testDOMProps
4382 /**
4383 * testDOMProps is a generic DOM property test; if a browser supports
4384 * a certain property, it won't return undefined for it.
4385 */
4386 function testDOMProps( props, obj, elem ) {
4387 for ( var i in props ) {
4388 var item = obj[props[i]];
4389 if ( item !== undefined) {
4390
4391 // return the property name as a string
4392 if (elem === false) return props[i];
4393
4394 // let's bind a function
4395 if (is(item, 'function')){
4396 // default to autobind unless override
4397 return item.bind(elem || obj);
4398 }
4399
4400 // return the unbound function or obj or value
4401 return item;
4402 }
4403 }
4404 return false;
4405 }
4406
4407 /*>>testallprops*/
4408 /**
4409 * testPropsAll tests a list of DOM properties we want to check against.
4410 * We specify literally ALL possible (known and/or likely) properties on
4411 * the element including the non-vendor prefixed one, for forward-
4412 * compatibility.
4413 */
4414 function testPropsAll( prop, prefixed, elem ) {
4415
4416 var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),
4417 props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
4418
4419 // did they call .prefixed('boxSizing') or are we just testing a prop?
4420 if(is(prefixed, "string") || is(prefixed, "undefined")) {
4421 return testProps(props, prefixed);
4422
4423 // otherwise, they called .prefixed('requestAnimationFrame', window[, elem])
4424 } else {
4425 props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
4426 return testDOMProps(props, prefixed, elem);
4427 }
4428 }
4429 /*>>testallprops*/
4430
4431
4432 /**
4433 * Tests
4434 * -----
4435 */
4436
4437 // The *new* flexbox
4438 // dev.w3.org/csswg/css3-flexbox
4439
4440 tests['flexbox'] = function() {
4441 return testPropsAll('flexWrap');
4442 };
4443
4444 // The *old* flexbox
4445 // www.w3.org/TR/2009/WD-css3-flexbox-20090723/
4446
4447 tests['flexboxlegacy'] = function() {
4448 return testPropsAll('boxDirection');
4449 };
4450
4451 // On the S60 and BB Storm, getContext exists, but always returns undefined
4452 // so we actually have to call getContext() to verify
4453 // github.com/Modernizr/Modernizr/issues/issue/97/
4454
4455 tests['canvas'] = function() {
4456 var elem = document.createElement('canvas');
4457 return !!(elem.getContext && elem.getContext('2d'));
4458 };
4459
4460 tests['canvastext'] = function() {
4461 return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function'));
4462 };
4463
4464 // webk.it/70117 is tracking a legit WebGL feature detect proposal
4465
4466 // We do a soft detect which may false positive in order to avoid
4467 // an expensive context creation: bugzil.la/732441
4468
4469 tests['webgl'] = function() {
4470 return !!window.WebGLRenderingContext;
4471 };
4472
4473 /*
4474 * The Modernizr.touch test only indicates if the browser supports
4475 * touch events, which does not necessarily reflect a touchscreen
4476 * device, as evidenced by tablets running Windows 7 or, alas,
4477 * the Palm Pre / WebOS (touch) phones.
4478 *
4479 * Additionally, Chrome (desktop) used to lie about its support on this,
4480 * but that has since been rectified: crbug.com/36415
4481 *
4482 * We also test for Firefox 4 Multitouch Support.
4483 *
4484 * For more info, see: modernizr.github.com/Modernizr/touch.html
4485 */
4486
4487 tests['touch'] = function() {
4488 var bool;
4489
4490 if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
4491 bool = true;
4492 } else {
4493 injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) {
4494 bool = node.offsetTop === 9;
4495 });
4496 }
4497
4498 return bool;
4499 };
4500
4501
4502 // geolocation is often considered a trivial feature detect...
4503 // Turns out, it's quite tricky to get right:
4504 //
4505 // Using !!navigator.geolocation does two things we don't want. It:
4506 // 1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513
4507 // 2. Disables page caching in WebKit: webk.it/43956
4508 //
4509 // Meanwhile, in Firefox < 8, an about:config setting could expose
4510 // a false positive that would throw an exception: bugzil.la/688158
4511
4512 tests['geolocation'] = function() {
4513 return 'geolocation' in navigator;
4514 };
4515
4516
4517 tests['postmessage'] = function() {
4518 return !!window.postMessage;
4519 };
4520
4521
4522 // Chrome incognito mode used to throw an exception when using openDatabase
4523 // It doesn't anymore.
4524 tests['websqldatabase'] = function() {
4525 return !!window.openDatabase;
4526 };
4527
4528 // Vendors had inconsistent prefixing with the experimental Indexed DB:
4529 // - Webkit's implementation is accessible through webkitIndexedDB
4530 // - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB
4531 // For speed, we don't test the legacy (and beta-only) indexedDB
4532 tests['indexedDB'] = function() {
4533 return !!testPropsAll("indexedDB", window);
4534 };
4535
4536 // documentMode logic from YUI to filter out IE8 Compat Mode
4537 // which false positives.
4538 tests['hashchange'] = function() {
4539 return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7);
4540 };
4541
4542 // Per 1.6:
4543 // This used to be Modernizr.historymanagement but the longer
4544 // name has been deprecated in favor of a shorter and property-matching one.
4545 // The old API is still available in 1.6, but as of 2.0 will throw a warning,
4546 // and in the first release thereafter disappear entirely.
4547 tests['history'] = function() {
4548 return !!(window.history && history.pushState);
4549 };
4550
4551 tests['draganddrop'] = function() {
4552 var div = document.createElement('div');
4553 return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div);
4554 };
4555
4556 // FF3.6 was EOL'ed on 4/24/12, but the ESR version of FF10
4557 // will be supported until FF19 (2/12/13), at which time, ESR becomes FF17.
4558 // FF10 still uses prefixes, so check for it until then.
4559 // for more ESR info, see: mozilla.org/en-US/firefox/organizations/faq/
4560 tests['websockets'] = function() {
4561 return 'WebSocket' in window || 'MozWebSocket' in window;
4562 };
4563
4564
4565 // css-tricks.com/rgba-browser-support/
4566 tests['rgba'] = function() {
4567 // Set an rgba() color and check the returned value
4568
4569 setCss('background-color:rgba(150,255,150,.5)');
4570
4571 return contains(mStyle.backgroundColor, 'rgba');
4572 };
4573
4574 tests['hsla'] = function() {
4575 // Same as rgba(), in fact, browsers re-map hsla() to rgba() internally,
4576 // except IE9 who retains it as hsla
4577
4578 setCss('background-color:hsla(120,40%,100%,.5)');
4579
4580 return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla');
4581 };
4582
4583 tests['multiplebgs'] = function() {
4584 // Setting multiple images AND a color on the background shorthand property
4585 // and then querying the style.background property value for the number of
4586 // occurrences of "url(" is a reliable method for detecting ACTUAL support for this!
4587
4588 setCss('background:url(https://),url(https://),red url(https://)');
4589
4590 // If the UA supports multiple backgrounds, there should be three occurrences
4591 // of the string "url(" in the return value for elemStyle.background
4592
4593 return (/(url\s*\(.*?){3}/).test(mStyle.background);
4594 };
4595
4596
4597
4598 // this will false positive in Opera Mini
4599 // github.com/Modernizr/Modernizr/issues/396
4600
4601 tests['backgroundsize'] = function() {
4602 return testPropsAll('backgroundSize');
4603 };
4604
4605 tests['borderimage'] = function() {
4606 return testPropsAll('borderImage');
4607 };
4608
4609
4610 // Super comprehensive table about all the unique implementations of
4611 // border-radius: muddledramblings.com/table-of-css3-border-radius-compliance
4612
4613 tests['borderradius'] = function() {
4614 return testPropsAll('borderRadius');
4615 };
4616
4617 // WebOS unfortunately false positives on this test.
4618 tests['boxshadow'] = function() {
4619 return testPropsAll('boxShadow');
4620 };
4621
4622 // FF3.0 will false positive on this test
4623 tests['textshadow'] = function() {
4624 return document.createElement('div').style.textShadow === '';
4625 };
4626
4627
4628 tests['opacity'] = function() {
4629 // Browsers that actually have CSS Opacity implemented have done so
4630 // according to spec, which means their return values are within the
4631 // range of [0.0,1.0] - including the leading zero.
4632
4633 setCssAll('opacity:.55');
4634
4635 // The non-literal . in this regex is intentional:
4636 // German Chrome returns this value as 0,55
4637 // github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632
4638 return (/^0.55$/).test(mStyle.opacity);
4639 };
4640
4641
4642 // Note, Android < 4 will pass this test, but can only animate
4643 // a single property at a time
4644 // daneden.me/2011/12/putting-up-with-androids-bullshit/
4645 tests['cssanimations'] = function() {
4646 return testPropsAll('animationName');
4647 };
4648
4649
4650 tests['csscolumns'] = function() {
4651 return testPropsAll('columnCount');
4652 };
4653
4654
4655 tests['cssgradients'] = function() {
4656 /**
4657 * For CSS Gradients syntax, please see:
4658 * webkit.org/blog/175/introducing-css-gradients/
4659 * developer.mozilla.org/en/CSS/-moz-linear-gradient
4660 * developer.mozilla.org/en/CSS/-moz-radial-gradient
4661 * dev.w3.org/csswg/css3-images/#gradients-
4662 */
4663
4664 var str1 = 'background-image:',
4665 str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));',
4666 str3 = 'linear-gradient(left top,#9f9, white);';
4667
4668 setCss(
4669 // legacy webkit syntax (FIXME: remove when syntax not in use anymore)
4670 (str1 + '-webkit- '.split(' ').join(str2 + str1) +
4671 // standard syntax // trailing 'background-image:'
4672 prefixes.join(str3 + str1)).slice(0, -str1.length)
4673 );
4674
4675 return contains(mStyle.backgroundImage, 'gradient');
4676 };
4677
4678
4679 tests['cssreflections'] = function() {
4680 return testPropsAll('boxReflect');
4681 };
4682
4683
4684 tests['csstransforms'] = function() {
4685 return !!testPropsAll('transform');
4686 };
4687
4688
4689 tests['csstransforms3d'] = function() {
4690
4691 var ret = !!testPropsAll('perspective');
4692
4693 // Webkit's 3D transforms are passed off to the browser's own graphics renderer.
4694 // It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in
4695 // some conditions. As a result, Webkit typically recognizes the syntax but
4696 // will sometimes throw a false positive, thus we must do a more thorough check:
4697 if ( ret && 'webkitPerspective' in docElement.style ) {
4698
4699 // Webkit allows this media query to succeed only if the feature is enabled.
4700 // `@media (transform-3d),(-webkit-transform-3d){ ... }`
4701 injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) {
4702 ret = node.offsetLeft === 9 && node.offsetHeight === 3;
4703 });
4704 }
4705 return ret;
4706 };
4707
4708
4709 tests['csstransitions'] = function() {
4710 return testPropsAll('transition');
4711 };
4712
4713
4714 /*>>fontface*/
4715 // @font-face detection routine by Diego Perini
4716 // javascript.nwbox.com/CSSSupport/
4717
4718 // false positives:
4719 // WebOS github.com/Modernizr/Modernizr/issues/342
4720 // WP7 github.com/Modernizr/Modernizr/issues/538
4721 tests['fontface'] = function() {
4722 var bool;
4723
4724 injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) {
4725 var style = document.getElementById('smodernizr'),
4726 sheet = style.sheet || style.styleSheet,
4727 cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : '';
4728
4729 bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0;
4730 });
4731
4732 return bool;
4733 };
4734 /*>>fontface*/
4735
4736 // CSS generated content detection
4737 tests['generatedcontent'] = function() {
4738 var bool;
4739
4740 injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) {
4741 bool = node.offsetHeight >= 3;
4742 });
4743
4744 return bool;
4745 };
4746
4747
4748
4749 // These tests evaluate support of the video/audio elements, as well as
4750 // testing what types of content they support.
4751 //
4752 // We're using the Boolean constructor here, so that we can extend the value
4753 // e.g. Modernizr.video // true
4754 // Modernizr.video.ogg // 'probably'
4755 //
4756 // Codec values from : github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845
4757 // thx to NielsLeenheer and zcorpan
4758
4759 // Note: in some older browsers, "no" was a return value instead of empty string.
4760 // It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2
4761 // It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5
4762
4763 tests['video'] = function() {
4764 var elem = document.createElement('video'),
4765 bool = false;
4766
4767 // IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224
4768 try {
4769 if ( bool = !!elem.canPlayType ) {
4770 bool = new Boolean(bool);
4771 bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,'');
4772
4773 // Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546
4774 bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
4775
4776 bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
4777 }
4778
4779 } catch(e) { }
4780
4781 return bool;
4782 };
4783
4784 tests['audio'] = function() {
4785 var elem = document.createElement('audio'),
4786 bool = false;
4787
4788 try {
4789 if ( bool = !!elem.canPlayType ) {
4790 bool = new Boolean(bool);
4791 bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
4792 bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,'');
4793
4794 // Mimetypes accepted:
4795 // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements
4796 // bit.ly/iphoneoscodecs
4797 bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,'');
4798 bool.m4a = ( elem.canPlayType('audio/x-m4a;') ||
4799 elem.canPlayType('audio/aac;')) .replace(/^no$/,'');
4800 }
4801 } catch(e) { }
4802
4803 return bool;
4804 };
4805
4806
4807 // In FF4, if disabled, window.localStorage should === null.
4808
4809 // Normally, we could not test that directly and need to do a
4810 // `('localStorage' in window) && ` test first because otherwise Firefox will
4811 // throw bugzil.la/365772 if cookies are disabled
4812
4813 // Also in iOS5 Private Browsing mode, attempting to use localStorage.setItem
4814 // will throw the exception:
4815 // QUOTA_EXCEEDED_ERRROR DOM Exception 22.
4816 // Peculiarly, getItem and removeItem calls do not throw.
4817
4818 // Because we are forced to try/catch this, we'll go aggressive.
4819
4820 // Just FWIW: IE8 Compat mode supports these features completely:
4821 // www.quirksmode.org/dom/html5.html
4822 // But IE8 doesn't support either with local files
4823
4824 tests['localstorage'] = function() {
4825 try {
4826 localStorage.setItem(mod, mod);
4827 localStorage.removeItem(mod);
4828 return true;
4829 } catch(e) {
4830 return false;
4831 }
4832 };
4833
4834 tests['sessionstorage'] = function() {
4835 try {
4836 sessionStorage.setItem(mod, mod);
4837 sessionStorage.removeItem(mod);
4838 return true;
4839 } catch(e) {
4840 return false;
4841 }
4842 };
4843
4844
4845 tests['webworkers'] = function() {
4846 return !!window.Worker;
4847 };
4848
4849
4850 tests['applicationcache'] = function() {
4851 return !!window.applicationCache;
4852 };
4853
4854
4855 // Thanks to Erik Dahlstrom
4856 tests['svg'] = function() {
4857 return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect;
4858 };
4859
4860 // specifically for SVG inline in HTML, not within XHTML
4861 // test page: paulirish.com/demo/inline-svg
4862 tests['inlinesvg'] = function() {
4863 var div = document.createElement('div');
4864 div.innerHTML = '<svg/>';
4865 return (div.firstChild && div.firstChild.namespaceURI) == ns.svg;
4866 };
4867
4868 // SVG SMIL animation
4869 tests['smil'] = function() {
4870 return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate')));
4871 };
4872
4873 // This test is only for clip paths in SVG proper, not clip paths on HTML content
4874 // demo: srufaculty.sru.edu/david.dailey/svg/newstuff/clipPath4.svg
4875
4876 // However read the comments to dig into applying SVG clippaths to HTML content here:
4877 // github.com/Modernizr/Modernizr/issues/213#issuecomment-1149491
4878 tests['svgclippaths'] = function() {
4879 return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));
4880 };
4881
4882 /*>>webforms*/
4883 // input features and input types go directly onto the ret object, bypassing the tests loop.
4884 // Hold this guy to execute in a moment.
4885 function webforms() {
4886 /*>>input*/
4887 // Run through HTML5's new input attributes to see if the UA understands any.
4888 // We're using f which is the <input> element created early on
4889 // Mike Taylr has created a comprehensive resource for testing these attributes
4890 // when applied to all input types:
4891 // miketaylr.com/code/input-type-attr.html
4892 // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
4893
4894 // Only input placeholder is tested while textarea's placeholder is not.
4895 // Currently Safari 4 and Opera 11 have support only for the input placeholder
4896 // Both tests are available in feature-detects/forms-placeholder.js
4897 Modernizr['input'] = (function( props ) {
4898 for ( var i = 0, len = props.length; i < len; i++ ) {
4899 attrs[ props[i] ] = !!(props[i] in inputElem);
4900 }
4901 if (attrs.list){
4902 // safari false positive's on datalist: webk.it/74252
4903 // see also github.com/Modernizr/Modernizr/issues/146
4904 attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);
4905 }
4906 return attrs;
4907 })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
4908 /*>>input*/
4909
4910 /*>>inputtypes*/
4911 // Run through HTML5's new input types to see if the UA understands any.
4912 // This is put behind the tests runloop because it doesn't return a
4913 // true/false like all the other tests; instead, it returns an object
4914 // containing each input type with its corresponding true/false value
4915
4916 // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/
4917 Modernizr['inputtypes'] = (function(props) {
4918
4919 for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {
4920
4921 inputElem.setAttribute('type', inputElemType = props[i]);
4922 bool = inputElem.type !== 'text';
4923
4924 // We first check to see if the type we give it sticks..
4925 // If the type does, we feed it a textual value, which shouldn't be valid.
4926 // If the value doesn't stick, we know there's input sanitization which infers a custom UI
4927 if ( bool ) {
4928
4929 inputElem.value = smile;
4930 inputElem.style.cssText = 'position:absolute;visibility:hidden;';
4931
4932 if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {
4933
4934 docElement.appendChild(inputElem);
4935 defaultView = document.defaultView;
4936
4937 // Safari 2-4 allows the smiley as a value, despite making a slider
4938 bool = defaultView.getComputedStyle &&
4939 defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
4940 // Mobile android web browser has false positive, so must
4941 // check the height to see if the widget is actually there.
4942 (inputElem.offsetHeight !== 0);
4943
4944 docElement.removeChild(inputElem);
4945
4946 } else if ( /^(search|tel)$/.test(inputElemType) ){
4947 // Spec doesn't define any special parsing or detectable UI
4948 // behaviors so we pass these through as true
4949
4950 // Interestingly, opera fails the earlier test, so it doesn't
4951 // even make it here.
4952
4953 } else if ( /^(url|email)$/.test(inputElemType) ) {
4954 // Real url and email support comes with prebaked validation.
4955 bool = inputElem.checkValidity && inputElem.checkValidity() === false;
4956
4957 } else {
4958 // If the upgraded input compontent rejects the :) text, we got a winner
4959 bool = inputElem.value != smile;
4960 }
4961 }
4962
4963 inputs[ props[i] ] = !!bool;
4964 }
4965 return inputs;
4966 })('search tel url email datetime date month week time datetime-local number range color'.split(' '));
4967 /*>>inputtypes*/
4968 }
4969 /*>>webforms*/
4970
4971
4972 // End of test definitions
4973 // -----------------------
4974
4975
4976
4977 // Run through all tests and detect their support in the current UA.
4978 // todo: hypothetically we could be doing an array of tests and use a basic loop here.
4979 for ( var feature in tests ) {
4980 if ( hasOwnProp(tests, feature) ) {
4981 // run the test, throw the return value into the Modernizr,
4982 // then based on that boolean, define an appropriate className
4983 // and push it into an array of classes we'll join later.
4984 featureName = feature.toLowerCase();
4985 Modernizr[featureName] = tests[feature]();
4986
4987 classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
4988 }
4989 }
4990
4991 /*>>webforms*/
4992 // input tests need to run.
4993 Modernizr.input || webforms();
4994 /*>>webforms*/
4995
4996
4997 /**
4998 * addTest allows the user to define their own feature tests
4999 * the result will be added onto the Modernizr object,
5000 * as well as an appropriate className set on the html element
5001 *
5002 * @param feature - String naming the feature
5003 * @param test - Function returning true if feature is supported, false if not
5004 */
5005 Modernizr.addTest = function ( feature, test ) {
5006 if ( typeof feature == 'object' ) {
5007 for ( var key in feature ) {
5008 if ( hasOwnProp( feature, key ) ) {
5009 Modernizr.addTest( key, feature[ key ] );
5010 }
5011 }
5012 } else {
5013
5014 feature = feature.toLowerCase();
5015
5016 if ( Modernizr[feature] !== undefined ) {
5017 // we're going to quit if you're trying to overwrite an existing test
5018 // if we were to allow it, we'd do this:
5019 // var re = new RegExp("\\b(no-)?" + feature + "\\b");
5020 // docElement.className = docElement.className.replace( re, '' );
5021 // but, no rly, stuff 'em.
5022 return Modernizr;
5023 }
5024
5025 test = typeof test == 'function' ? test() : test;
5026
5027 if (typeof enableClasses !== "undefined" && enableClasses) {
5028 docElement.className += ' ' + (test ? '' : 'no-') + feature;
5029 }
5030 Modernizr[feature] = test;
5031
5032 }
5033
5034 return Modernizr; // allow chaining.
5035 };
5036
5037
5038 // Reset modElem.cssText to nothing to reduce memory footprint.
5039 setCss('');
5040 modElem = inputElem = null;
5041
5042 /*>>shiv*/
5043 /**
5044 * @preserve HTML5 Shiv prev3.7.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
5045 */
5046 ;(function(window, document) {
5047 /*jshint evil:true */
5048 /** version */
5049 var version = '3.7.0';
5050
5051 /** Preset options */
5052 var options = window.html5 || {};
5053
5054 /** Used to skip problem elements */
5055 var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
5056
5057 /** Not all elements can be cloned in IE **/
5058 var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
5059
5060 /** Detect whether the browser supports default html5 styles */
5061 var supportsHtml5Styles;
5062
5063 /** Name of the expando, to work with multiple documents or to re-shiv one document */
5064 var expando = '_html5shiv';
5065
5066 /** The id for the the documents expando */
5067 var expanID = 0;
5068
5069 /** Cached data for each document */
5070 var expandoData = {};
5071
5072 /** Detect whether the browser supports unknown elements */
5073 var supportsUnknownElements;
5074
5075 (function() {
5076 try {
5077 var a = document.createElement('a');
5078 a.innerHTML = '<xyz></xyz>';
5079 //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles
5080 supportsHtml5Styles = ('hidden' in a);
5081
5082 supportsUnknownElements = a.childNodes.length == 1 || (function() {
5083 // assign a false positive if unable to shiv
5084 (document.createElement)('a');
5085 var frag = document.createDocumentFragment();
5086 return (
5087 typeof frag.cloneNode == 'undefined' ||
5088 typeof frag.createDocumentFragment == 'undefined' ||
5089 typeof frag.createElement == 'undefined'
5090 );
5091 }());
5092 } catch(e) {
5093 // assign a false positive if detection fails => unable to shiv
5094 supportsHtml5Styles = true;
5095 supportsUnknownElements = true;
5096 }
5097
5098 }());
5099
5100 /*--------------------------------------------------------------------------*/
5101
5102 /**
5103 * Creates a style sheet with the given CSS text and adds it to the document.
5104 * @private
5105 * @param {Document} ownerDocument The document.
5106 * @param {String} cssText The CSS text.
5107 * @returns {StyleSheet} The style element.
5108 */
5109 function addStyleSheet(ownerDocument, cssText) {
5110 var p = ownerDocument.createElement('p'),
5111 parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
5112
5113 p.innerHTML = 'x<style>' + cssText + '</style>';
5114 return parent.insertBefore(p.lastChild, parent.firstChild);
5115 }
5116
5117 /**
5118 * Returns the value of `html5.elements` as an array.
5119 * @private
5120 * @returns {Array} An array of shived element node names.
5121 */
5122 function getElements() {
5123 var elements = html5.elements;
5124 return typeof elements == 'string' ? elements.split(' ') : elements;
5125 }
5126
5127 /**
5128 * Returns the data associated to the given document
5129 * @private
5130 * @param {Document} ownerDocument The document.
5131 * @returns {Object} An object of data.
5132 */
5133 function getExpandoData(ownerDocument) {
5134 var data = expandoData[ownerDocument[expando]];
5135 if (!data) {
5136 data = {};
5137 expanID++;
5138 ownerDocument[expando] = expanID;
5139 expandoData[expanID] = data;
5140 }
5141 return data;
5142 }
5143
5144 /**
5145 * returns a shived element for the given nodeName and document
5146 * @memberOf html5
5147 * @param {String} nodeName name of the element
5148 * @param {Document} ownerDocument The context document.
5149 * @returns {Object} The shived element.
5150 */
5151 function createElement(nodeName, ownerDocument, data){
5152 if (!ownerDocument) {
5153 ownerDocument = document;
5154 }
5155 if(supportsUnknownElements){
5156 return ownerDocument.createElement(nodeName);
5157 }
5158 if (!data) {
5159 data = getExpandoData(ownerDocument);
5160 }
5161 var node;
5162
5163 if (data.cache[nodeName]) {
5164 node = data.cache[nodeName].cloneNode();
5165 } else if (saveClones.test(nodeName)) {
5166 node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
5167 } else {
5168 node = data.createElem(nodeName);
5169 }
5170
5171 // Avoid adding some elements to fragments in IE < 9 because
5172 // * Attributes like `name` or `type` cannot be set/changed once an element
5173 // is inserted into a document/fragment
5174 // * Link elements with `src` attributes that are inaccessible, as with
5175 // a 403 response, will cause the tab/window to crash
5176 // * Script elements appended to fragments will execute when their `src`
5177 // or `text` property is set
5178 return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
5179 }
5180
5181 /**
5182 * returns a shived DocumentFragment for the given document
5183 * @memberOf html5
5184 * @param {Document} ownerDocument The context document.
5185 * @returns {Object} The shived DocumentFragment.
5186 */
5187 function createDocumentFragment(ownerDocument, data){
5188 if (!ownerDocument) {
5189 ownerDocument = document;
5190 }
5191 if(supportsUnknownElements){
5192 return ownerDocument.createDocumentFragment();
5193 }
5194 data = data || getExpandoData(ownerDocument);
5195 var clone = data.frag.cloneNode(),
5196 i = 0,
5197 elems = getElements(),
5198 l = elems.length;
5199 for(;i<l;i++){
5200 clone.createElement(elems[i]);
5201 }
5202 return clone;
5203 }
5204
5205 /**
5206 * Shivs the `createElement` and `createDocumentFragment` methods of the document.
5207 * @private
5208 * @param {Document|DocumentFragment} ownerDocument The document.
5209 * @param {Object} data of the document.
5210 */
5211 function shivMethods(ownerDocument, data) {
5212 if (!data.cache) {
5213 data.cache = {};
5214 data.createElem = ownerDocument.createElement;
5215 data.createFrag = ownerDocument.createDocumentFragment;
5216 data.frag = data.createFrag();
5217 }
5218
5219
5220 ownerDocument.createElement = function(nodeName) {
5221 //abort shiv
5222 if (!html5.shivMethods) {
5223 return data.createElem(nodeName);
5224 }
5225 return createElement(nodeName, ownerDocument, data);
5226 };
5227
5228 ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
5229 'var n=f.cloneNode(),c=n.createElement;' +
5230 'h.shivMethods&&(' +
5231 // unroll the `createElement` calls
5232 getElements().join().replace(/[\w\-]+/g, function(nodeName) {
5233 data.createElem(nodeName);
5234 data.frag.createElement(nodeName);
5235 return 'c("' + nodeName + '")';
5236 }) +
5237 ');return n}'
5238 )(html5, data.frag);
5239 }
5240
5241 /*--------------------------------------------------------------------------*/
5242
5243 /**
5244 * Shivs the given document.
5245 * @memberOf html5
5246 * @param {Document} ownerDocument The document to shiv.
5247 * @returns {Document} The shived document.
5248 */
5249 function shivDocument(ownerDocument) {
5250 if (!ownerDocument) {
5251 ownerDocument = document;
5252 }
5253 var data = getExpandoData(ownerDocument);
5254
5255 if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
5256 data.hasCSS = !!addStyleSheet(ownerDocument,
5257 // corrects block display not defined in IE6/7/8/9
5258 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
5259 // adds styling not present in IE6/7/8/9
5260 'mark{background:#FF0;color:#000}' +
5261 // hides non-rendered elements
5262 'template{display:none}'
5263 );
5264 }
5265 if (!supportsUnknownElements) {
5266 shivMethods(ownerDocument, data);
5267 }
5268 return ownerDocument;
5269 }
5270
5271 /*--------------------------------------------------------------------------*/
5272
5273 /**
5274 * The `html5` object is exposed so that more elements can be shived and
5275 * existing shiving can be detected on iframes.
5276 * @type Object
5277 * @example
5278 *
5279 * // options can be changed before the script is included
5280 * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };
5281 */
5282 var html5 = {
5283
5284 /**
5285 * An array or space separated string of node names of the elements to shiv.
5286 * @memberOf html5
5287 * @type Array|String
5288 */
5289 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video',
5290
5291 /**
5292 * current version of html5shiv
5293 */
5294 'version': version,
5295
5296 /**
5297 * A flag to indicate that the HTML5 style sheet should be inserted.
5298 * @memberOf html5
5299 * @type Boolean
5300 */
5301 'shivCSS': (options.shivCSS !== false),
5302
5303 /**
5304 * Is equal to true if a browser supports creating unknown/HTML5 elements
5305 * @memberOf html5
5306 * @type boolean
5307 */
5308 'supportsUnknownElements': supportsUnknownElements,
5309
5310 /**
5311 * A flag to indicate that the document's `createElement` and `createDocumentFragment`
5312 * methods should be overwritten.
5313 * @memberOf html5
5314 * @type Boolean
5315 */
5316 'shivMethods': (options.shivMethods !== false),
5317
5318 /**
5319 * A string to describe the type of `html5` object ("default" or "default print").
5320 * @memberOf html5
5321 * @type String
5322 */
5323 'type': 'default',
5324
5325 // shivs the document according to the specified `html5` object options
5326 'shivDocument': shivDocument,
5327
5328 //creates a shived element
5329 createElement: createElement,
5330
5331 //creates a shived documentFragment
5332 createDocumentFragment: createDocumentFragment
5333 };
5334
5335 /*--------------------------------------------------------------------------*/
5336
5337 // expose html5
5338 window.html5 = html5;
5339
5340 // shiv the document
5341 shivDocument(document);
5342
5343 }(this, document));
5344 /*>>shiv*/
5345
5346 // Assign private properties to the return object with prefix
5347 Modernizr._version = version;
5348
5349 // expose these for the plugin API. Look in the source for how to join() them against your input
5350 /*>>prefixes*/
5351 Modernizr._prefixes = prefixes;
5352 /*>>prefixes*/
5353 /*>>domprefixes*/
5354 Modernizr._domPrefixes = domPrefixes;
5355 Modernizr._cssomPrefixes = cssomPrefixes;
5356 /*>>domprefixes*/
5357
5358 /*>>mq*/
5359 // Modernizr.mq tests a given media query, live against the current state of the window
5360 // A few important notes:
5361 // * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false
5362 // * A max-width or orientation query will be evaluated against the current state, which may change later.
5363 // * You must specify values. Eg. If you are testing support for the min-width media query use:
5364 // Modernizr.mq('(min-width:0)')
5365 // usage:
5366 // Modernizr.mq('only screen and (max-width:768)')
5367 Modernizr.mq = testMediaQuery;
5368 /*>>mq*/
5369
5370 /*>>hasevent*/
5371 // Modernizr.hasEvent() detects support for a given event, with an optional element to test on
5372 // Modernizr.hasEvent('gesturestart', elem)
5373 Modernizr.hasEvent = isEventSupported;
5374 /*>>hasevent*/
5375
5376 /*>>testprop*/
5377 // Modernizr.testProp() investigates whether a given style property is recognized
5378 // Note that the property names must be provided in the camelCase variant.
5379 // Modernizr.testProp('pointerEvents')
5380 Modernizr.testProp = function(prop){
5381 return testProps([prop]);
5382 };
5383 /*>>testprop*/
5384
5385 /*>>testallprops*/
5386 // Modernizr.testAllProps() investigates whether a given style property,
5387 // or any of its vendor-prefixed variants, is recognized
5388 // Note that the property names must be provided in the camelCase variant.
5389 // Modernizr.testAllProps('boxSizing')
5390 Modernizr.testAllProps = testPropsAll;
5391 /*>>testallprops*/
5392
5393
5394 /*>>teststyles*/
5395 // Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards
5396 // Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... })
5397 Modernizr.testStyles = injectElementWithStyles;
5398 /*>>teststyles*/
5399
5400
5401 /*>>prefixed*/
5402 // Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input
5403 // Modernizr.prefixed('boxSizing') // 'MozBoxSizing'
5404
5405 // Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style.
5406 // Return values will also be the camelCase variant, if you need to translate that to hypenated style use:
5407 //
5408 // str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-');
5409
5410 // If you're trying to ascertain which transition end event to bind to, you might do something like...
5411 //
5412 // var transEndEventNames = {
5413 // 'WebkitTransition' : 'webkitTransitionEnd',
5414 // 'MozTransition' : 'transitionend',
5415 // 'OTransition' : 'oTransitionEnd',
5416 // 'msTransition' : 'MSTransitionEnd',
5417 // 'transition' : 'transitionend'
5418 // },
5419 // transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ];
5420
5421 Modernizr.prefixed = function(prop, obj, elem){
5422 if(!obj) {
5423 return testPropsAll(prop, 'pfx');
5424 } else {
5425 // Testing DOM property e.g. Modernizr.prefixed('requestAnimationFrame', window) // 'mozRequestAnimationFrame'
5426 return testPropsAll(prop, obj, elem);
5427 }
5428 };
5429 /*>>prefixed*/
5430
5431
5432 /*>>cssclasses*/
5433 // Remove "no-js" class from <html> element, if it exists:
5434 docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') +
5435
5436 // Add the new classes to the <html> element.
5437 (enableClasses ? ' js ' + classes.join(' ') : '');
5438 /*>>cssclasses*/
5439
5440 return Modernizr;
5441
5442})(this, this.document);
5443
5444
5445
5446$(document).foundation();
5447
5448
5449 // tweet it form
5450 $('form#tweet').submit(function(event) {
5451 window.open($(this).attr('action') + '?' + $(this).serialize(), '_blank', 'scrollbars=no,menubar=no,height=400,width=500,resizable=yes,toolbar=no,status=no');
5452 event.preventDefault();
5453 });
5454
5455 // substitute @2x images where available
5456 if (window.isRetina()) {
5457 console.log("loading retina images..");
5458 var replacement;
5459 $('img[data-2x]').each(function(i, img) {
5460 replacement = $(img).clone().attr('src', $(img).data('2x')) || img;
5461 // only replace once the replacement is loaded
5462 replacement.load(function() {
5463 $(img).replaceWith($(this));
5464 });
5465 });
5466 }
5467
5468 if (window.isLinux64) {
5469 $('a[data-x64-href]').each(function(i) {
5470 $(this).attr('href', $(this).data('x64-href'));
5471 });
5472 }
5473
5474 $('a[data-delayed-href]').click(function(event) {
5475 window.open($(this).data('delayed-href'), '_blank');
5476 window.location = $(this).attr('href');
5477 event.preventDefault();
5478 });
5479
5480 // FAQ accordions
5481 var panels = $('dl.accordion > dd').hide();
5482 var draws = $('dl.accordion > dt').css('cursor', 'pointer');
5483 draws.click(function() {
5484 panels.slideUp();
5485 var next = $(this).next()
5486 if (next.is(':hidden'))
5487 next.slideDown();
5488 return false;
5489 });
5490
5491 // Show section if anchor provided
5492 var anchor = window.location.hash;
5493 if(anchor !== ''){
5494 $('dl.accordion > dd' + anchor).show();
5495 }
5496});
5497
5498function truncate(text, length) {
5499 length = length || 100;
5500 return $.trim(strip(text)).substring(0, length).trim(this) + "...";
5501}
5502
5503function strip(html) {
5504 var tmp = document.createElement("DIV");
5505 tmp.innerHTML = html;
5506 return tmp.textContent || tmp.innerText || "";
5507}
5508
5509// Retina detection
5510window.isRetina = function() {
5511 var mediaQuery = "(-webkit-min-device-pixel-ratio: 1.5),\
5512 (min--moz-device-pixel-ratio: 1.5),\
5513 (-o-min-device-pixel-ratio: 3/2),\
5514 (min-resolution: 1.5dppx)";
5515
5516 return window.devicePixelRatio > 1 || (window.matchMedia && window.matchMedia(mediaQuery).matches)
5517}
5518
5519// Linux x64 detection
5520window.isLinux64 = function() {
5521 return window.navigator.platform.substr(0, 5) == "Linux" && window.navigator.platform.substr(-2,2) == "64";
5522}
5523;