1/* 2 * Foundation Responsive Library 3 * http://foundation.zurb.com 4 * Copyright 2014, ZURB 5 * Free to use under the MIT license. 6 * http://www.opensource.org/licenses/mit-license.php 7*/ 8 9(function ($, window, document, undefined) { 10 'use strict'; 11 12 var header_helpers = function (class_array) { 13 var i = class_array.length; 14 var head = $('head'); 15 16 while (i--) { 17 if(head.has('.' + class_array[i]).length === 0) { 18 head.append('<meta class="' + class_array[i] + '" />'); 19 } 20 } 21 }; 22 23 header_helpers([ 24 'foundation-mq-small', 25 'foundation-mq-small-only', 26 'foundation-mq-medium', 27 'foundation-mq-medium-only', 28 'foundation-mq-large', 29 'foundation-mq-large-only', 30 'foundation-mq-xlarge', 31 'foundation-mq-xlarge-only', 32 'foundation-mq-xxlarge', 33 'foundation-data-attribute-namespace']); 34 35 // Enable FastClick if present 36 37 $(function() { 38 if (typeof FastClick !== 'undefined') { 39 // Don't attach to body if undefined 40 if (typeof document.body !== 'undefined') { 41 FastClick.attach(document.body); 42 } 43 } 44 }); 45 46 // private Fast Selector wrapper, 47 // returns jQuery object. Only use where 48 // getElementById is not available. 49 var S = function (selector, context) { 50 if (typeof selector === 'string') { 51 if (context) { 52 var cont; 53 if (context.jquery) { 54 cont = context[0]; 55 if (!cont) return context; 56 } else { 57 cont = context; 58 } 59 return $(cont.querySelectorAll(selector)); 60 } 61 62 return $(document.querySelectorAll(selector)); 63 } 64 65 return $(selector, context); 66 }; 67 68 // Namespace functions. 69 70 var attr_name = function (init) { 71 var arr = []; 72 if (!init) arr.push('data'); 73 if (this.namespace.length > 0) arr.push(this.namespace); 74 arr.push(this.name); 75 76 return arr.join('-'); 77 }; 78 79 var add_namespace = function (str) { 80 var parts = str.split('-'), 81 i = parts.length, 82 arr = []; 83 84 while (i--) { 85 if (i !== 0) { 86 arr.push(parts[i]); 87 } else { 88 if (this.namespace.length > 0) { 89 arr.push(this.namespace, parts[i]); 90 } else { 91 arr.push(parts[i]); 92 } 93 } 94 } 95 96 return arr.reverse().join('-'); 97 }; 98 99 // Event binding and data-options updating. 100 101 var bindings = function (method, options) { 102 var self = this, 103 should_bind_events = !S(this).data(this.attr_name(true)); 104 105 if (S(this.scope).is('[' + this.attr_name() +']')) { 106 S(this.scope).data(this.attr_name(true) + '-init', $.extend({}, this.settings, (options || method), this.data_options(S(this.scope)))); 107 108 if (should_bind_events) { 109 this.events(this.scope); 110 } 111 112 } else { 113 S('[' + this.attr_name() +']', this.scope).each(function () { 114 var should_bind_events = !S(this).data(self.attr_name(true) + '-init'); 115 S(this).data(self.attr_name(true) + '-init', $.extend({}, self.settings, (options || method), self.data_options(S(this)))); 116 117 if (should_bind_events) { 118 self.events(this); 119 } 120 }); 121 } 122 // # Patch to fix #5043 to move this *after* the if/else clause in order for Backbone and similar frameworks to have improved control over event binding and data-options updating. 123 if (typeof method === 'string') { 124 return this[method].call(this, options); 125 } 126 127 }; 128 129 var single_image_loaded = function (image, callback) { 130 function loaded () { 131 callback(image[0]); 132 } 133 134 function bindLoad () { 135 this.one('load', loaded); 136 137 if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { 138 var src = this.attr( 'src' ), 139 param = src.match( /\?/ ) ? '&' : '?'; 140 141 param += 'random=' + (new Date()).getTime(); 142 this.attr('src', src + param); 143 } 144 } 145 146 if (!image.attr('src')) { 147 loaded(); 148 return; 149 } 150 151 if (image[0].complete || image[0].readyState === 4) { 152 loaded(); 153 } else { 154 bindLoad.call(image); 155 } 156 }; 157 158 /* 159 https://github.com/paulirish/matchMedia.js 160 */ 161 162 window.matchMedia = window.matchMedia || (function( doc ) { 163 164 'use strict'; 165 166 var bool, 167 docElem = doc.documentElement, 168 refNode = docElem.firstElementChild || docElem.firstChild, 169 // fakeBody required for <FF4 when executed in <head> 170 fakeBody = doc.createElement( 'body' ), 171 div = doc.createElement( 'div' ); 172 173 div.id = 'mq-test-1'; 174 div.style.cssText = 'position:absolute;top:-100em'; 175 fakeBody.style.background = 'none'; 176 fakeBody.appendChild(div); 177 178 return function (q) { 179 180 div.innerHTML = '­<style media="' + q + '"> #mq-test-1 { width: 42px; }</style>'; 181
182 docElem.insertBefore( fakeBody, refNode ); 183 bool = div.offsetWidth === 42; 184 docElem.removeChild( fakeBody ); 185 186 return { 187 matches: bool, 188 media: q 189 }; 190 191 }; 192 193 }( document )); 194 195 /* 196 * jquery.requestAnimationFrame 197 * https://github.com/gnarf37/jquery-requestAnimationFrame 198 * Requires jQuery 1.8+ 199 * 200 * Copyright (c) 2012 Corey Frang 201 * Licensed under the MIT license. 202 */ 203 204 (function($) { 205 206 // requestAnimationFrame polyfill adapted from Erik Möller 207 // fixes from Paul Irish and Tino Zijdel 208 // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 209 // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating 210 211 var animating, 212 lastTime = 0, 213 vendors = ['webkit', 'moz'], 214 requestAnimationFrame = window.requestAnimationFrame, 215 cancelAnimationFrame = window.cancelAnimationFrame, 216 jqueryFxAvailable = 'undefined' !== typeof jQuery.fx; 217 218 for (; lastTime < vendors.length && !requestAnimationFrame; lastTime++) { 219 requestAnimationFrame = window[ vendors[lastTime] + 'RequestAnimationFrame' ]; 220 cancelAnimationFrame = cancelAnimationFrame || 221 window[ vendors[lastTime] + 'CancelAnimationFrame' ] || 222 window[ vendors[lastTime] + 'CancelRequestAnimationFrame' ]; 223 } 224 225 function raf() { 226 if (animating) { 227 requestAnimationFrame(raf); 228 229 if (jqueryFxAvailable) { 230 jQuery.fx.tick(); 231 } 232 } 233 } 234 235 if (requestAnimationFrame) { 236 // use rAF 237 window.requestAnimationFrame = requestAnimationFrame; 238 window.cancelAnimationFrame = cancelAnimationFrame; 239 240 if (jqueryFxAvailable) { 241 jQuery.fx.timer = function (timer) { 242 if (timer() && jQuery.timers.push(timer) && !animating) { 243 animating = true; 244 raf(); 245 } 246 }; 247 248 jQuery.fx.stop = function () { 249 animating = false; 250 }; 251 } 252 } else { 253 // polyfill 254 window.requestAnimationFrame = function (callback) { 255 var currTime = new Date().getTime(), 256 timeToCall = Math.max(0, 16 - (currTime - lastTime)), 257 id = window.setTimeout(function () { 258 callback(currTime + timeToCall); 259 }, timeToCall); 260 lastTime = currTime + timeToCall; 261 return id; 262 }; 263 264 window.cancelAnimationFrame = function (id) { 265 clearTimeout(id); 266 }; 267 268 } 269 270 }( jQuery )); 271 272 273 function removeQuotes (string) { 274 if (typeof string === 'string' || string instanceof String) { 275 string = string.replace(/^['\\/"]+|(;\s?})+|['\\/"]+$/g, ''); 276 } 277 278 return string; 279 } 280 281 window.Foundation = { 282 name : 'Foundation', 283 284 version : '5.5.0', 285 286 media_queries : { 287 'small' : S('.foundation-mq-small').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''), 288 'small-only' : S('.foundation-mq-small-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''), 289 'medium' : S('.foundation-mq-medium').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''), 290 'medium-only' : S('.foundation-mq-medium-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
291 'large' : S('.foundation-mq-large').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''), 292 'large-only' : S('.foundation-mq-large-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''), 293 'xlarge' : S('.foundation-mq-xlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''), 294 'xlarge-only' : S('.foundation-mq-xlarge-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''), 295 'xxlarge' : S('.foundation-mq-xxlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, '') 296 }, 297 298 stylesheet : $('<style></style>').appendTo('head')[0].sheet, 299 300 global: { 301 namespace: undefined 302 }, 303 304 init : function (scope, libraries, method, options, response) { 305 var args = [scope, method, options, response], 306 responses = []; 307 308 // check RTL 309 this.rtl = /rtl/i.test(S('html').attr('dir')); 310 311 // set foundation global scope 312 this.scope = scope || this.scope; 313 314 this.set_namespace(); 315 316 if (libraries && typeof libraries === 'string' && !/reflow/i.test(libraries)) { 317 if (this.libs.hasOwnProperty(libraries)) { 318 responses.push(this.init_lib(libraries, args)); 319 } 320 } else { 321 for (var lib in this.libs) { 322 responses.push(this.init_lib(lib, libraries)); 323 } 324 } 325 326 S(window).load(function(){ 327 S(window) 328 .trigger('resize.fndtn.clearing') 329 .trigger('resize.fndtn.dropdown') 330 .trigger('resize.fndtn.equalizer') 331 .trigger('resize.fndtn.interchange') 332 .trigger('resize.fndtn.joyride') 333 .trigger('resize.fndtn.magellan') 334 .trigger('resize.fndtn.topbar') 335 .trigger('resize.fndtn.slider'); 336 }); 337 338 return scope; 339 }, 340 341 init_lib : function (lib, args) { 342 if (this.libs.hasOwnProperty(lib)) { 343 this.patch(this.libs[lib]); 344 345 if (args && args.hasOwnProperty(lib)) { 346 if (typeof this.libs[lib].settings !== 'undefined') { 347 $.extend(true, this.libs[lib].settings, args[lib]); 348 } 349 else if (typeof this.libs[lib].defaults !== 'undefined') { 350 $.extend(true, this.libs[lib].defaults, args[lib]); 351 } 352 return this.libs[lib].init.apply(this.libs[lib], [this.scope, args[lib]]); 353 } 354 355 args = args instanceof Array ? args : new Array(args); 356 return this.libs[lib].init.apply(this.libs[lib], args); 357 } 358 359 return function () {}; 360 }, 361 362 patch : function (lib) { 363 lib.scope = this.scope; 364 lib.namespace = this.global.namespace; 365 lib.rtl = this.rtl; 366 lib['data_options'] = this.utils.data_options; 367 lib['attr_name'] = attr_name; 368 lib['add_namespace'] = add_namespace; 369 lib['bindings'] = bindings; 370 lib['S'] = this.utils.S; 371 }, 372 373 inherit : function (scope, methods) { 374 var methods_arr = methods.split(' '), 375 i = methods_arr.length; 376 377 while (i--) { 378 if (this.utils.hasOwnProperty(methods_arr[i])) { 379 scope[methods_arr[i]] = this.utils[methods_arr[i]]; 380 } 381 } 382 }, 383 384 set_namespace: function () { 385 386 // Description: 387 // Don't bother reading the namespace out of the meta tag 388 // if the namespace has been set globally in javascript 389 // 390 // Example: 391 // Foundation.global.namespace = 'my-namespace'; 392 // or make it an empty string: 393 // Foundation.global.namespace = ''; 394 // 395 // 396 397 // If the namespace has not been set (is undefined), try to read it out of the meta element. 398 // Otherwise use the globally defined namespace, even if it's empty ('') 399 var namespace = ( this.global.namespace === undefined ) ? $('.foundation-data-attribute-namespace').css('font-family') : this.global.namespace; 400 401 // Finally, if the namsepace is either undefined or false, set it to an empty string. 402 // Otherwise use the namespace value. 403 this.global.namespace = ( namespace === undefined || /false/i.test(namespace) ) ? '' : namespace; 404 }, 405 406 libs : {}, 407 408 // methods that can be inherited in libraries 409 utils : { 410 411 // Description: 412 // Fast Selector wrapper returns jQuery object. Only use where getElementById 413 // is not available. 414 // 415 // Arguments:
416 // Selector (String): CSS selector describing the element(s) to be 417 // returned as a jQuery object. 418 // 419 // Scope (String): CSS selector describing the area to be searched. Default 420 // is document. 421 // 422 // Returns: 423 // Element (jQuery Object): jQuery object containing elements matching the 424 // selector within the scope. 425 S : S, 426 427 // Description: 428 // Executes a function a max of once every n milliseconds 429 // 430 // Arguments: 431 // Func (Function): Function to be throttled. 432 // 433 // Delay (Integer): Function execution threshold in milliseconds. 434 // 435 // Returns: 436 // Lazy_function (Function): Function with throttling applied. 437 throttle : function (func, delay) { 438 var timer = null; 439 440 return function () { 441 var context = this, args = arguments; 442 443 if (timer == null) { 444 timer = setTimeout(function () { 445 func.apply(context, args); 446 timer = null; 447 }, delay); 448 } 449 }; 450 }, 451 452 // Description: 453 // Executes a function when it stops being invoked for n seconds 454 // Modified version of _.debounce() http://underscorejs.org 455 // 456 // Arguments: 457 // Func (Function): Function to be debounced. 458 // 459 // Delay (Integer): Function execution threshold in milliseconds. 460 // 461 // Immediate (Bool): Whether the function should be called at the beginning 462 // of the delay instead of the end. Default is false. 463 // 464 // Returns: 465 // Lazy_function (Function): Function with debouncing applied. 466 debounce : function (func, delay, immediate) { 467 var timeout, result; 468 return function () { 469 var context = this, args = arguments; 470 var later = function () { 471 timeout = null; 472 if (!immediate) result = func.apply(context, args); 473 }; 474 var callNow = immediate && !timeout; 475 clearTimeout(timeout); 476 timeout = setTimeout(later, delay); 477 if (callNow) result = func.apply(context, args); 478 return result; 479 }; 480 }, 481 482 // Description: 483 // Parses data-options attribute 484 // 485 // Arguments: 486 // El (jQuery Object): Element to be parsed. 487 // 488 // Returns: 489 // Options (Javascript Object): Contents of the element's data-options 490 // attribute. 491 data_options : function (el, data_attr_name) { 492 data_attr_name = data_attr_name || 'options'; 493 var opts = {}, ii, p, opts_arr, 494 data_options = function (el) { 495 var namespace = Foundation.global.namespace; 496 497 if (namespace.length > 0) { 498 return el.data(namespace + '-' + data_attr_name); 499 } 500 501 return el.data(data_attr_name); 502 }; 503 504 var cached_options = data_options(el); 505 506 if (typeof cached_options === 'object') { 507 return cached_options; 508 } 509 510 opts_arr = (cached_options || ':').split(';'); 511 ii = opts_arr.length; 512 513 function isNumber (o) { 514 return ! isNaN (o-0) && o !== null && o !== '' && o !== false && o !== true; 515 } 516 517 function trim (str) { 518 if (typeof str === 'string') return $.trim(str); 519 return str; 520 } 521 522 while (ii--) { 523 p = opts_arr[ii].split(':'); 524 p = [p[0], p.slice(1).join(':')]; 525 526 if (/true/i.test(p[1])) p[1] = true; 527 if (/false/i.test(p[1])) p[1] = false; 528 if (isNumber(p[1])) { 529 if (p[1].indexOf('.') === -1) { 530 p[1] = parseInt(p[1], 10); 531 } else { 532 p[1] = parseFloat(p[1]); 533 } 534 } 535 536 if (p.length === 2 && p[0].length > 0) { 537 opts[trim(p[0])] = trim(p[1]); 538 } 539 } 540 541 return opts; 542 }, 543 544 // Description: 545 // Adds JS-recognizable media queries 546 // 547 // Arguments: 548 // Media (String): Key string for the media query to be stored as in 549 // Foundation.media_queries 550 //
551 // Class (String): Class name for the generated <meta> tag 552 register_media : function (media, media_class) { 553 if(Foundation.media_queries[media] === undefined) { 554 $('head').append('<meta class="' + media_class + '"/>'); 555 Foundation.media_queries[media] = removeQuotes($('.' + media_class).css('font-family')); 556 } 557 }, 558 559 // Description: 560 // Add custom CSS within a JS-defined media query 561 // 562 // Arguments: 563 // Rule (String): CSS rule to be appended to the document. 564 // 565 // Media (String): Optional media query string for the CSS rule to be 566 // nested under. 567 add_custom_rule : function (rule, media) { 568 if (media === undefined && Foundation.stylesheet) { 569 Foundation.stylesheet.insertRule(rule, Foundation.stylesheet.cssRules.length); 570 } else { 571 var query = Foundation.media_queries[media]; 572 573 if (query !== undefined) { 574 Foundation.stylesheet.insertRule('@media ' + 575 Foundation.media_queries[media] + '{ ' + rule + ' }'); 576 } 577 } 578 }, 579 580 // Description: 581 // Performs a callback function when an image is fully loaded 582 // 583 // Arguments: 584 // Image (jQuery Object): Image(s) to check if loaded. 585 // 586 // Callback (Function): Function to execute when image is fully loaded. 587 image_loaded : function (images, callback) { 588 var self = this, 589 unloaded = images.length; 590 591 if (unloaded === 0) { 592 callback(images); 593 } 594 595 images.each(function () { 596 single_image_loaded(self.S(this), function () { 597 unloaded -= 1; 598 if (unloaded === 0) { 599 callback(images); 600 } 601 }); 602 }); 603 }, 604 605 // Description: 606 // Returns a random, alphanumeric string 607 // 608 // Arguments: 609 // Length (Integer): Length of string to be generated. Defaults to random 610 // integer. 611 // 612 // Returns: 613 // Rand (String): Pseudo-random, alphanumeric string. 614 random_str : function () { 615 if (!this.fidx) this.fidx = 0; 616 this.prefix = this.prefix || [(this.name || 'F'), (+new Date).toString(36)].join('-'); 617 618 return this.prefix + (this.fidx++).toString(36); 619 }, 620 621 // Description: 622 // Helper for window.matchMedia 623 // 624 // Arguments: 625 // mq (String): Media query 626 // 627 // Returns: 628 // (Boolean): Whether the media query passes or not 629 match : function (mq) { 630 return window.matchMedia(mq).matches; 631 }, 632 633 // Description: 634 // Helpers for checking Foundation default media queries with JS 635 // 636 // Returns: 637 // (Boolean): Whether the media query passes or not 638 639 is_small_up : function () { 640 return this.match(Foundation.media_queries.small); 641 }, 642 643 is_medium_up : function () { 644 return this.match(Foundation.media_queries.medium); 645 }, 646 647 is_large_up : function () { 648 return this.match(Foundation.media_queries.large); 649 }, 650 651 is_xlarge_up : function () { 652 return this.match(Foundation.media_queries.xlarge); 653 }, 654 655 is_xxlarge_up : function () { 656 return this.match(Foundation.media_queries.xxlarge); 657 }, 658 659 is_small_only : function () { 660 return !this.is_medium_up() && !this.is_large_up() && !this.is_xlarge_up() && !this.is_xxlarge_up(); 661 }, 662 663 is_medium_only : function () { 664 return this.is_medium_up() && !this.is_large_up() && !this.is_xlarge_up() && !this.is_xxlarge_up(); 665 }, 666 667 is_large_only : function () { 668 return this.is_medium_up() && this.is_large_up() && !this.is_xlarge_up() && !this.is_xxlarge_up(); 669 }, 670 671 is_xlarge_only : function () { 672 return this.is_medium_up() && this.is_large_up() && this.is_xlarge_up() && !this.is_xxlarge_up(); 673 }, 674 675 is_xxlarge_only : function () { 676 return this.is_medium_up() && this.is_large_up() && this.is_xlarge_up() && this.is_xxlarge_up(); 677 } 678 } 679 }; 680 681 $.fn.foundation = function () { 682 var args = Array.prototype.slice.call(arguments, 0); 683 684 return this.each(function () {
685 Foundation.init.apply(Foundation, [this].concat(args)); 686 return this; 687 }); 688 }; 689 690}(jQuery, window, window.document)); 691 692;(function ($, window, document, undefined) { 693 'use strict'; 694 695 Foundation.libs.abide = { 696 name : 'abide', 697 698 version : '5.5.0', 699 700 settings : { 701 live_validate : true, 702 validate_on_blur: true, 703 focus_on_invalid : true, 704 error_labels: true, // labels with a for="inputId" will recieve an `error` class 705 error_class: 'error', 706 timeout : 1000, 707 patterns : { 708 alpha: /^[a-zA-Z]+$/, 709 alpha_numeric : /^[a-zA-Z0-9]+$/, 710 integer: /^[-+]?\d+$/, 711 number: /^[-+]?\d*(?:[\.\,]\d+)?$/, 712 713 // amex, visa, diners 714 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})$/, 715 cvv : /^([0-9]){3,4}$/, 716 717 // http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address 718 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])?)+$/,
719 720 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})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/, 721 // abc.de 722 domain: /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,8}$/, 723 724 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))$/, 725 // YYYY-MM-DD 726 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))$/, 727 // HH:MM:SS 728 time : /^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/, 729 dateISO: /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/, 730 // MM/DD/YYYY 731 month_day_year : /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/, 732 // DD/MM/YYYY 733 day_month_year : /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/, 734 735 // #FFF or #FFFFFF 736 color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/ 737 }, 738 validators : { 739 equalTo: function(el, required, parent) { 740 var from = document.getElementById(el.getAttribute(this.add_namespace('data-equalto'))).value, 741 to = el.value, 742 valid = (from === to); 743 744 return valid; 745 } 746 } 747 }, 748 749 timer : null, 750 751 init : function (scope, method, options) { 752 this.bindings(method, options); 753 }, 754 755 events : function (scope) { 756 var self = this, 757 form = self.S(scope).attr('novalidate', 'novalidate'), 758 settings = form.data(this.attr_name(true) + '-init') || {}; 759 760 this.invalid_attr = this.add_namespace('data-invalid'); 761 762 form 763 .off('.abide') 764 .on('submit.fndtn.abide validate.fndtn.abide', function (e) { 765 var is_ajax = /ajax/i.test(self.S(this).attr(self.attr_name())); 766 return self.validate(self.S(this).find('input, textarea, select').get(), e, is_ajax); 767 }) 768 .on('reset', function() { 769 return self.reset($(this)); 770 }) 771 .find('input, textarea, select') 772 .off('.abide') 773 .on('blur.fndtn.abide change.fndtn.abide', function (e) { 774 if (settings.validate_on_blur === true) { 775 self.validate([this], e); 776 } 777 }) 778 .on('keydown.fndtn.abide', function (e) { 779 if (settings.live_validate === true && e.which != 9) { 780 clearTimeout(self.timer); 781 self.timer = setTimeout(function () { 782 self.validate([this], e); 783 }.bind(this), settings.timeout); 784 } 785 }); 786 }, 787 788 reset : function (form) { 789 form.removeAttr(this.invalid_attr); 790 $(this.invalid_attr, form).removeAttr(this.invalid_attr); 791 $('.' + this.settings.error_class, form).not('small').removeClass(this.settings.error_class); 792 }, 793 794 validate : function (els, e, is_ajax) { 795 var validations = this.parse_patterns(els), 796 validation_count = validations.length, 797 form = this.S(els[0]).closest('form'), 798 submit_event = /submit/.test(e.type); 799 800 // Has to count up to make sure the focus gets applied to the top error 801 for (var i=0; i < validation_count; i++) { 802 if (!validations[i] && (submit_event || is_ajax)) {
803 if (this.settings.focus_on_invalid) els[i].focus(); 804 form.trigger('invalid').trigger('invalid.fndtn.abide'); 805 this.S(els[i]).closest('form').attr(this.invalid_attr, ''); 806 return false; 807 } 808 } 809 810 if (submit_event || is_ajax) { 811 form.trigger('valid').trigger('valid.fndtn.abide'); 812 } 813 814 form.removeAttr(this.invalid_attr); 815 816 if (is_ajax) return false; 817 818 return true; 819 }, 820 821 parse_patterns : function (els) { 822 var i = els.length, 823 el_patterns = []; 824 825 while (i--) { 826 el_patterns.push(this.pattern(els[i])); 827 } 828 829 return this.check_validation_and_apply_styles(el_patterns); 830 }, 831 832 pattern : function (el) { 833 var type = el.getAttribute('type'), 834 required = typeof el.getAttribute('required') === 'string'; 835 836 var pattern = el.getAttribute('pattern') || ''; 837 838 if (this.settings.patterns.hasOwnProperty(pattern) && pattern.length > 0) { 839 return [el, this.settings.patterns[pattern], required]; 840 } else if (pattern.length > 0) { 841 return [el, new RegExp(pattern), required]; 842 } 843 844 if (this.settings.patterns.hasOwnProperty(type)) { 845 return [el, this.settings.patterns[type], required]; 846 } 847 848 pattern = /.*/; 849 850 return [el, pattern, required]; 851 }, 852 853 // TODO: Break this up into smaller methods, getting hard to read. 854 check_validation_and_apply_styles : function (el_patterns) { 855 var i = el_patterns.length, 856 validations = [], 857 form = this.S(el_patterns[0][0]).closest('[data-' + this.attr_name(true) + ']'), 858 settings = form.data(this.attr_name(true) + '-init') || {}; 859 while (i--) { 860 var el = el_patterns[i][0], 861 required = el_patterns[i][2], 862 value = el.value.trim(), 863 direct_parent = this.S(el).parent(), 864 validator = el.getAttribute(this.add_namespace('data-abide-validator')), 865 is_radio = el.type === "radio", 866 is_checkbox = el.type === "checkbox", 867 label = this.S('label[for="' + el.getAttribute('id') + '"]'), 868 valid_length = (required) ? (el.value.length > 0) : true, 869 el_validations = []; 870 871 var parent, valid; 872 873 // support old way to do equalTo validations 874 if(el.getAttribute(this.add_namespace('data-equalto'))) { validator = "equalTo" } 875 876 if (!direct_parent.is('label')) { 877 parent = direct_parent; 878 } else { 879 parent = direct_parent.parent(); 880 } 881 882 if (validator) { 883 valid = this.settings.validators[validator].apply(this, [el, required, parent]); 884 el_validations.push(valid); 885 } 886 887 if (is_radio && required) { 888 el_validations.push(this.valid_radio(el, required)); 889 } else if (is_checkbox && required) { 890 el_validations.push(this.valid_checkbox(el, required)); 891 } else { 892 893 if (el_patterns[i][1].test(value) && valid_length || 894 !required && el.value.length < 1 || $(el).attr('disabled')) { 895 el_validations.push(true); 896 } else { 897 el_validations.push(false); 898 } 899 900 el_validations = [el_validations.every(function(valid){return valid;})]; 901 902 if(el_validations[0]){ 903 this.S(el).removeAttr(this.invalid_attr); 904 el.setAttribute('aria-invalid', 'false'); 905 el.removeAttribute('aria-describedby'); 906 parent.removeClass(this.settings.error_class); 907 if (label.length > 0 && this.settings.error_labels) { 908 label.removeClass(this.settings.error_class).removeAttr('role'); 909 } 910 $(el).triggerHandler('valid'); 911 } else { 912 this.S(el).attr(this.invalid_attr, ''); 913 el.setAttribute('aria-invalid', 'true'); 914 915 // Try to find the error associated with the input 916 var errorElem = parent.find('small.'+this.settings.error_class, 'span.'+this.settings.error_class); 917 var errorID = errorElem.length > 0 ? errorElem[0].id : ""; 918 if (errorID.length > 0) el.setAttribute('aria-describedby', errorID); 919 920 // el.setAttribute('aria-describedby', $(el).find('.error')[0].id); 921 parent.addClass(this.settings.error_class); 922 if (label.length > 0 && this.settings.error_labels) { 923 label.addClass(this.settings.error_class).attr('role', 'alert'); 924 } 925 $(el).triggerHandler('invalid'); 926 } 927 } 928 validations.push(el_validations[0]); 929 }
930 validations = [validations.every(function(valid){return valid;})]; 931 return validations; 932 }, 933 934 valid_checkbox : function(el, required) { 935 var el = this.S(el), 936 valid = (el.is(':checked') || !required); 937 938 if (valid) { 939 el.removeAttr(this.invalid_attr).parent().removeClass(this.settings.error_class); 940 } else { 941 el.attr(this.invalid_attr, '').parent().addClass(this.settings.error_class); 942 } 943 944 return valid; 945 }, 946 947 valid_radio : function (el, required) { 948 var name = el.getAttribute('name'), 949 group = this.S(el).closest('[data-' + this.attr_name(true) + ']').find("[name='"+name+"']"), 950 count = group.length, 951 valid = false; 952 953 // Has to count up to make sure the focus gets applied to the top error 954 for (var i=0; i < count; i++) { 955 if (group[i].checked) valid = true; 956 } 957 958 // Has to count up to make sure the focus gets applied to the top error 959 for (var i=0; i < count; i++) { 960 if (valid) { 961 this.S(group[i]).removeAttr(this.invalid_attr).parent().removeClass(this.settings.error_class); 962 } else { 963 this.S(group[i]).attr(this.invalid_attr, '').parent().addClass(this.settings.error_class); 964 } 965 } 966 967 return valid; 968 }, 969 970 valid_equal: function(el, required, parent) { 971 var from = document.getElementById(el.getAttribute(this.add_namespace('data-equalto'))).value, 972 to = el.value, 973 valid = (from === to); 974 975 if (valid) { 976 this.S(el).removeAttr(this.invalid_attr); 977 parent.removeClass(this.settings.error_class); 978 if (label.length > 0 && settings.error_labels) label.removeClass(this.settings.error_class); 979 } else { 980 this.S(el).attr(this.invalid_attr, ''); 981 parent.addClass(this.settings.error_class); 982 if (label.length > 0 && settings.error_labels) label.addClass(this.settings.error_class); 983 } 984 985 return valid; 986 }, 987 988 valid_oneof: function(el, required, parent, doNotValidateOthers) { 989 var el = this.S(el), 990 others = this.S('[' + this.add_namespace('data-oneof') + ']'), 991 valid = others.filter(':checked').length > 0; 992 993 if (valid) { 994 el.removeAttr(this.invalid_attr).parent().removeClass(this.settings.error_class); 995 } else { 996 el.attr(this.invalid_attr, '').parent().addClass(this.settings.error_class); 997 } 998 999 if (!doNotValidateOthers) { 1000 var _this = this; 1001 others.each(function() { 1002 _this.valid_oneof.call(_this, this, null, null, true); 1003 }); 1004 } 1005 1006 return valid; 1007 } 1008 }; 1009}(jQuery, window, window.document)); 1010 1011;(function ($, window, document, undefined) { 1012 'use strict'; 1013 1014 Foundation.libs.accordion = { 1015 name : 'accordion', 1016 1017 version : '5.5.0', 1018 1019 settings : { 1020 content_class: 'content', 1021 active_class: 'active', 1022 multi_expand: false, 1023 toggleable: true, 1024 callback : function () {} 1025 }, 1026 1027 init : function (scope, method, options) { 1028 this.bindings(method, options); 1029 }, 1030 1031 events : function () { 1032 var self = this; 1033 var S = this.S; 1034 S(this.scope) 1035 .off('.fndtn.accordion') 1036 .on('click.fndtn.accordion', '[' + this.attr_name() + '] > .accordion-navigation > a', function (e) { 1037 var accordion = S(this).closest('[' + self.attr_name() + ']'), 1038 groupSelector = self.attr_name() + '=' + accordion.attr(self.attr_name()), 1039 settings = accordion.data(self.attr_name(true) + '-init') || self.settings, 1040 target = S('#' + this.href.split('#')[1]), 1041 aunts = $('> .accordion-navigation', accordion), 1042 siblings = aunts.children('.'+settings.content_class), 1043 active_content = siblings.filter('.' + settings.active_class); 1044 1045 e.preventDefault(); 1046 1047 if (accordion.attr(self.attr_name())) { 1048 siblings = siblings.add('[' + groupSelector + '] dd > '+'.'+settings.content_class); 1049 aunts = aunts.add('[' + groupSelector + '] .accordion-navigation'); 1050 } 1051 1052 if (settings.toggleable && target.is(active_content)) { 1053 target.parent('.accordion-navigation').toggleClass(settings.active_class, false); 1054 target.toggleClass(settings.active_class, false); 1055 settings.callback(target); 1056 target.triggerHandler('toggled', [accordion]); 1057 accordion.triggerHandler('toggled', [target]); 1058 return; 1059 } 1060 1061 if (!settings.multi_expand) { 1062 siblings.removeClass(settings.active_class); 1063 aunts.removeClass(settings.active_class); 1064 } 1065 1066 target.addClass(settings.active_class).parent().addClass(settings.active_class); 1067 settings.callback(target); 1068 target.triggerHandler('toggled', [accordion]); 1069 accordion.triggerHandler('toggled', [target]); 1070 }); 1071 }, 1072 1073 off : function () {}, 1074 1075 reflow : function () {} 1076 }; 1077}(jQuery, window, window.document)); 1078 1079;(function ($, window, document, undefined) { 1080 'use strict'; 1081 1082 Foundation.libs.alert = { 1083 name : 'alert', 1084 1085 version : '5.5.0', 1086 1087 settings : { 1088 callback: function (){} 1089 }, 1090 1091 init : function (scope, method, options) { 1092 this.bindings(method, options); 1093 }, 1094 1095 events : function () { 1096 var self = this, 1097 S = this.S; 1098 1099 $(this.scope).off('.alert').on('click.fndtn.alert', '[' + this.attr_name() + '] .close', function (e) { 1100 var alertBox = S(this).closest('[' + self.attr_name() + ']'), 1101 settings = alertBox.data(self.attr_name(true) + '-init') || self.settings; 1102 1103 e.preventDefault(); 1104 if (Modernizr.csstransitions) { 1105 alertBox.addClass('alert-close'); 1106 alertBox.on('transitionend webkitTransitionEnd oTransitionEnd', function(e) { 1107 S(this).trigger('close').trigger('close.fndtn.alert').remove(); 1108 settings.callback(); 1109 }); 1110 } else { 1111 alertBox.fadeOut(300, function () { 1112 S(this).trigger('close').trigger('close.fndtn.alert').remove(); 1113 settings.callback(); 1114 }); 1115 } 1116 }); 1117 }, 1118 1119 reflow : function () {} 1120 }; 1121}(jQuery, window, window.document)); 1122 1123;(function ($, window, document, undefined) { 1124 'use strict'; 1125 1126 Foundation.libs.clearing = { 1127 name : 'clearing', 1128 1129 version: '5.5.0', 1130 1131 settings : { 1132 templates : { 1133 viewing : '<a href="#" class="clearing-close">×</a>' + 1134 '<div class="visible-img" style="display: none"><div class="clearing-touch-label"></div><img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D" alt="" />' + 1135 '<p class="clearing-caption"></p><a href="#" class="clearing-main-prev"><span></span></a>' + 1136 '<a href="#" class="clearing-main-next"><span></span></a></div>' 1137 }, 1138 1139 // comma delimited list of selectors that, on click, will close clearing, 1140 // add 'div.clearing-blackout, div.visible-img' to close on background click 1141 close_selectors : '.clearing-close, div.clearing-blackout', 1142 1143 // Default to the entire li element. 1144 open_selectors : '', 1145 1146 // Image will be skipped in carousel. 1147 skip_selector : '', 1148 1149 touch_label : '', 1150
1151 // event initializers and locks 1152 init : false, 1153 locked : false 1154 }, 1155 1156 init : function (scope, method, options) { 1157 var self = this; 1158 Foundation.inherit(this, 'throttle image_loaded'); 1159 1160 this.bindings(method, options); 1161 1162 if (self.S(this.scope).is('[' + this.attr_name() + ']')) { 1163 this.assemble(self.S('li', this.scope)); 1164 } else { 1165 self.S('[' + this.attr_name() + ']', this.scope).each(function () { 1166 self.assemble(self.S('li', this)); 1167 }); 1168 } 1169 }, 1170 1171 events : function (scope) { 1172 var self = this, 1173 S = self.S, 1174 $scroll_container = $('.scroll-container'); 1175 1176 if ($scroll_container.length > 0) { 1177 this.scope = $scroll_container; 1178 } 1179 1180 S(this.scope) 1181 .off('.clearing') 1182 .on('click.fndtn.clearing', 'ul[' + this.attr_name() + '] li ' + this.settings.open_selectors, 1183 function (e, current, target) { 1184 var current = current || S(this), 1185 target = target || current, 1186 next = current.next('li'), 1187 settings = current.closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init'), 1188 image = S(e.target); 1189 1190 e.preventDefault(); 1191 1192 if (!settings) { 1193 self.init(); 1194 settings = current.closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init'); 1195 } 1196 1197 // if clearing is open and the current image is 1198 // clicked, go to the next image in sequence 1199 if (target.hasClass('visible') && 1200 current[0] === target[0] && 1201 next.length > 0 && self.is_open(current)) { 1202 target = next; 1203 image = S('img', target); 1204 } 1205 1206 // set current and target to the clicked li if not otherwise defined. 1207 self.open(image, current, target); 1208 self.update_paddles(target); 1209 }) 1210 1211 .on('click.fndtn.clearing', '.clearing-main-next', 1212 function (e) { self.nav(e, 'next') }) 1213 .on('click.fndtn.clearing', '.clearing-main-prev', 1214 function (e) { self.nav(e, 'prev') }) 1215 .on('click.fndtn.clearing', this.settings.close_selectors, 1216 function (e) { Foundation.libs.clearing.close(e, this) }); 1217 1218 $(document).on('keydown.fndtn.clearing', 1219 function (e) { self.keydown(e) }); 1220 1221 S(window).off('.clearing').on('resize.fndtn.clearing', 1222 function () { self.resize() }); 1223 1224 this.swipe_events(scope); 1225 }, 1226 1227 swipe_events : function (scope) { 1228 var self = this, 1229 S = self.S; 1230 1231 S(this.scope) 1232 .on('touchstart.fndtn.clearing', '.visible-img', function(e) { 1233 if (!e.touches) { e = e.originalEvent; } 1234 var data = { 1235 start_page_x: e.touches[0].pageX, 1236 start_page_y: e.touches[0].pageY, 1237 start_time: (new Date()).getTime(), 1238 delta_x: 0, 1239 is_scrolling: undefined 1240 }; 1241 1242 S(this).data('swipe-transition', data); 1243 e.stopPropagation(); 1244 }) 1245 .on('touchmove.fndtn.clearing', '.visible-img', function(e) { 1246 if (!e.touches) { e = e.originalEvent; } 1247 // Ignore pinch/zoom events 1248 if(e.touches.length > 1 || e.scale && e.scale !== 1) return; 1249 1250 var data = S(this).data('swipe-transition'); 1251 1252 if (typeof data === 'undefined') { 1253 data = {}; 1254 } 1255 1256 data.delta_x = e.touches[0].pageX - data.start_page_x; 1257 1258 if (Foundation.rtl) { 1259 data.delta_x = -data.delta_x; 1260 } 1261 1262 if (typeof data.is_scrolling === 'undefined') { 1263 data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) ); 1264 } 1265 1266 if (!data.is_scrolling && !data.active) { 1267 e.preventDefault(); 1268 var direction = (data.delta_x < 0) ? 'next' : 'prev'; 1269 data.active = true; 1270 self.nav(e, direction); 1271 } 1272 }) 1273 .on('touchend.fndtn.clearing', '.visible-img', function(e) { 1274 S(this).data('swipe-transition', {}); 1275 e.stopPropagation(); 1276 }); 1277 }, 1278 1279 assemble : function ($li) { 1280 var $el = $li.parent(); 1281 1282 if ($el.parent().hasClass('carousel')) { 1283 return; 1284 } 1285 1286 $el.after('<div id="foundationClearingHolder"></div>'); 1287 1288 var grid = $el.detach(), 1289 grid_outerHTML = ''; 1290 1291 if (grid[0] == null) { 1292 return; 1293 } else {
1294 grid_outerHTML = grid[0].outerHTML; 1295 } 1296 1297 var holder = this.S('#foundationClearingHolder'), 1298 settings = $el.data(this.attr_name(true) + '-init'), 1299 data = { 1300 grid: '<div class="carousel">' + grid_outerHTML + '</div>', 1301 viewing: settings.templates.viewing 1302 }, 1303 wrapper = '<div class="clearing-assembled"><div>' + data.viewing + 1304 data.grid + '</div></div>', 1305 touch_label = this.settings.touch_label; 1306 1307 if (Modernizr.touch) { 1308 wrapper = $(wrapper).find('.clearing-touch-label').html(touch_label).end(); 1309 } 1310 1311 holder.after(wrapper).remove(); 1312 }, 1313 1314 open : function ($image, current, target) { 1315 var self = this, 1316 body = $(document.body), 1317 root = target.closest('.clearing-assembled'), 1318 container = self.S('div', root).first(), 1319 visible_image = self.S('.visible-img', container), 1320 image = self.S('img', visible_image).not($image), 1321 label = self.S('.clearing-touch-label', container), 1322 error = false; 1323 1324 // Event to disable scrolling on touch devices when Clearing is activated 1325 $('body').on('touchmove',function(e){ 1326 e.preventDefault(); 1327 }); 1328 1329 image.error(function () { 1330 error = true; 1331 }); 1332 1333 function startLoad() { 1334 setTimeout(function () { 1335 this.image_loaded(image, function () { 1336 if (image.outerWidth() === 1 && !error) { 1337 startLoad.call(this); 1338 } else { 1339 cb.call(this, image); 1340 } 1341 }.bind(this)); 1342 }.bind(this), 100); 1343 } 1344 1345 function cb (image) { 1346 var $image = $(image); 1347 $image.css('visibility', 'visible'); 1348 // toggle the gallery 1349 body.css('overflow', 'hidden'); 1350 root.addClass('clearing-blackout'); 1351 container.addClass('clearing-container'); 1352 visible_image.show(); 1353 this.fix_height(target) 1354 .caption(self.S('.clearing-caption', visible_image), self.S('img', target)) 1355 .center_and_label(image, label) 1356 .shift(current, target, function () { 1357 target.closest('li').siblings().removeClass('visible'); 1358 target.closest('li').addClass('visible'); 1359 }); 1360 visible_image.trigger('opened.fndtn.clearing') 1361 } 1362 1363 if (!this.locked()) { 1364 visible_image.trigger('open.fndtn.clearing'); 1365 // set the image to the selected thumbnail 1366 image 1367 .attr('src', this.load($image)) 1368 .css('visibility', 'hidden'); 1369 1370 startLoad.call(this); 1371 } 1372 }, 1373 1374 close : function (e, el) { 1375 e.preventDefault(); 1376 1377 var root = (function (target) { 1378 if (/blackout/.test(target.selector)) { 1379 return target; 1380 } else { 1381 return target.closest('.clearing-blackout'); 1382 } 1383 }($(el))), 1384 body = $(document.body), container, visible_image; 1385 1386 if (el === e.target && root) { 1387 body.css('overflow', ''); 1388 container = $('div', root).first(); 1389 visible_image = $('.visible-img', container); 1390 visible_image.trigger('close.fndtn.clearing'); 1391 this.settings.prev_index = 0; 1392 $('ul[' + this.attr_name() + ']', root) 1393 .attr('style', '').closest('.clearing-blackout') 1394 .removeClass('clearing-blackout'); 1395 container.removeClass('clearing-container'); 1396 visible_image.hide(); 1397 visible_image.trigger('closed.fndtn.clearing'); 1398 } 1399 1400 // Event to re-enable scrolling on touch devices 1401 $('body').off('touchmove'); 1402 1403 return false; 1404 }, 1405 1406 is_open : function (current) { 1407 return current.parent().prop('style').length > 0; 1408 }, 1409 1410 keydown : function (e) { 1411 var clearing = $('.clearing-blackout ul[' + this.attr_name() + ']'), 1412 NEXT_KEY = this.rtl ? 37 : 39, 1413 PREV_KEY = this.rtl ? 39 : 37, 1414 ESC_KEY = 27; 1415 1416 if (e.which === NEXT_KEY) this.go(clearing, 'next'); 1417 if (e.which === PREV_KEY) this.go(clearing, 'prev'); 1418 if (e.which === ESC_KEY) this.S('a.clearing-close').trigger('click').trigger('click.fndtn.clearing'); 1419 }, 1420 1421 nav : function (e, direction) { 1422 var clearing = $('ul[' + this.attr_name() + ']', '.clearing-blackout'); 1423 1424 e.preventDefault(); 1425 this.go(clearing, direction); 1426 }, 1427 1428 resize : function () { 1429 var image = $('img', '.clearing-blackout .visible-img'), 1430 label = $('.clearing-touch-label', '.clearing-blackout'); 1431 1432 if (image.length) { 1433 this.center_and_label(image, label); 1434 image.trigger('resized.fndtn.clearing') 1435 } 1436 }, 1437 1438 // visual adjustments 1439 fix_height : function (target) { 1440 var lis = target.parent().children(), 1441 self = this; 1442 1443 lis.each(function () { 1444 var li = self.S(this), 1445 image = li.find('img'); 1446 1447 if (li.height() > image.outerHeight()) { 1448 li.addClass('fix-height'); 1449 } 1450 }) 1451 .closest('ul') 1452 .width(lis.length * 100 + '%'); 1453 1454 return this; 1455 }, 1456 1457 update_paddles : function (target) { 1458 target = target.closest('li'); 1459 var visible_image = target 1460 .closest('.carousel') 1461 .siblings('.visible-img'); 1462 1463 if (target.next().length > 0) { 1464 this.S('.clearing-main-next', visible_image).removeClass('disabled'); 1465 } else { 1466 this.S('.clearing-main-next', visible_image).addClass('disabled'); 1467 } 1468 1469 if (target.prev().length > 0) { 1470 this.S('.clearing-main-prev', visible_image).removeClass('disabled'); 1471 } else { 1472 this.S('.clearing-main-prev', visible_image).addClass('disabled'); 1473 } 1474 }, 1475 1476 center_and_label : function (target, label) { 1477 if (!this.rtl) { 1478 target.css({ 1479 marginLeft : -(target.outerWidth() / 2), 1480 marginTop : -(target.outerHeight() / 2) 1481 }); 1482 1483 if (label.length > 0) { 1484 label.css({ 1485 marginLeft : -(label.outerWidth() / 2), 1486 marginTop : -(target.outerHeight() / 2)-label.outerHeight()-10 1487 }); 1488 } 1489 } else { 1490 target.css({ 1491 marginRight : -(target.outerWidth() / 2), 1492 marginTop : -(target.outerHeight() / 2), 1493 left: 'auto', 1494 right: '50%' 1495 }); 1496 1497 if (label.length > 0) { 1498 label.css({ 1499 marginRight : -(label.outerWidth() / 2), 1500 marginTop : -(target.outerHeight() / 2)-label.outerHeight()-10, 1501 left: 'auto', 1502 right: '50%' 1503 }); 1504 } 1505 } 1506 return this; 1507 }, 1508 1509 // image loading and preloading 1510 1511 load : function ($image) { 1512 var href; 1513 1514 if ($image[0].nodeName === 'A') { 1515 href = $image.attr('href'); 1516 } else { 1517 href = $image.closest('a').attr('href'); 1518 } 1519 1520 this.preload($image); 1521 1522 if (href) return href; 1523 return $image.attr('src'); 1524 }, 1525 1526 preload : function ($image) { 1527 this 1528 .img($image.closest('li').next()) 1529 .img($image.closest('li').prev()); 1530 }, 1531 1532 img : function (img) { 1533 if (img.length) { 1534 var new_img = new Image(), 1535 new_a = this.S('a', img); 1536 1537 if (new_a.length) { 1538 new_img.src = new_a.attr('href'); 1539 } else { 1540 new_img.src = this.S('img', img).attr('src'); 1541 } 1542 } 1543 return this; 1544 }, 1545 1546 // image caption 1547 1548 caption : function (container, $image) { 1549 var caption = $image.attr('data-caption'); 1550 1551 if (caption) { 1552 container 1553 .html(caption) 1554 .show(); 1555 } else { 1556 container 1557 .text('') 1558 .hide(); 1559 } 1560 return this; 1561 }, 1562 1563 // directional methods 1564 1565 go : function ($ul, direction) { 1566 var current = this.S('.visible', $ul), 1567 target = current[direction](); 1568 1569 // Check for skip selector. 1570 if (this.settings.skip_selector && target.find(this.settings.skip_selector).length != 0) { 1571 target = target[direction](); 1572 } 1573 1574 if (target.length) { 1575 this.S('img', target) 1576 .trigger('click', [current, target]).trigger('click.fndtn.clearing', [current, target]) 1577 .trigger('change.fndtn.clearing'); 1578 } 1579 }, 1580 1581 shift : function (current, target, callback) { 1582 var clearing = target.parent(), 1583 old_index = this.settings.prev_index || target.index(), 1584 direction = this.direction(clearing, current, target), 1585 dir = this.rtl ? 'right' : 'left', 1586 left = parseInt(clearing.css('left'), 10), 1587 width = target.outerWidth(), 1588 skip_shift; 1589 1590 var dir_obj = {}; 1591 1592 // we use jQuery animate instead of CSS transitions because we 1593 // need a callback to unlock the next animation
1594 // needs support for RTL ** 1595 if (target.index() !== old_index && !/skip/.test(direction)){ 1596 if (/left/.test(direction)) { 1597 this.lock(); 1598 dir_obj[dir] = left + width; 1599 clearing.animate(dir_obj, 300, this.unlock()); 1600 } else if (/right/.test(direction)) { 1601 this.lock(); 1602 dir_obj[dir] = left - width; 1603 clearing.animate(dir_obj, 300, this.unlock()); 1604 } 1605 } else if (/skip/.test(direction)) { 1606 // the target image is not adjacent to the current image, so 1607 // do we scroll right or not 1608 skip_shift = target.index() - this.settings.up_count; 1609 this.lock(); 1610 1611 if (skip_shift > 0) { 1612 dir_obj[dir] = -(skip_shift * width); 1613 clearing.animate(dir_obj, 300, this.unlock()); 1614 } else { 1615 dir_obj[dir] = 0; 1616 clearing.animate(dir_obj, 300, this.unlock()); 1617 } 1618 } 1619 1620 callback(); 1621 }, 1622 1623 direction : function ($el, current, target) { 1624 var lis = this.S('li', $el), 1625 li_width = lis.outerWidth() + (lis.outerWidth() / 4), 1626 up_count = Math.floor(this.S('.clearing-container').outerWidth() / li_width) - 1, 1627 target_index = lis.index(target), 1628 response; 1629 1630 this.settings.up_count = up_count; 1631 1632 if (this.adjacent(this.settings.prev_index, target_index)) { 1633 if ((target_index > up_count) && target_index > this.settings.prev_index) { 1634 response = 'right'; 1635 } else if ((target_index > up_count - 1) && target_index <= this.settings.prev_index) { 1636 response = 'left'; 1637 } else { 1638 response = false; 1639 } 1640 } else { 1641 response = 'skip'; 1642 } 1643 1644 this.settings.prev_index = target_index; 1645 1646 return response; 1647 }, 1648 1649 adjacent : function (current_index, target_index) { 1650 for (var i = target_index + 1; i >= target_index - 1; i--) { 1651 if (i === current_index) return true; 1652 } 1653 return false; 1654 }, 1655 1656 // lock management 1657 1658 lock : function () { 1659 this.settings.locked = true; 1660 }, 1661 1662 unlock : function () { 1663 this.settings.locked = false; 1664 }, 1665 1666 locked : function () { 1667 return this.settings.locked; 1668 }, 1669 1670 off : function () { 1671 this.S(this.scope).off('.fndtn.clearing'); 1672 this.S(window).off('.fndtn.clearing'); 1673 }, 1674 1675 reflow : function () { 1676 this.init(); 1677 } 1678 }; 1679 1680}(jQuery, window, window.document)); 1681 1682;(function ($, window, document, undefined) { 1683 'use strict'; 1684 1685 Foundation.libs.dropdown = { 1686 name : 'dropdown', 1687 1688 version : '5.5.0', 1689 1690 settings : { 1691 active_class: 'open', 1692 disabled_class: 'disabled', 1693 mega_class: 'mega', 1694 align: 'bottom', 1695 is_hover: false, 1696 hover_timeout: 150, 1697 opened: function(){}, 1698 closed: function(){} 1699 }, 1700 1701 init : function (scope, method, options) { 1702 Foundation.inherit(this, 'throttle'); 1703 1704 $.extend(true, this.settings, method, options); 1705 this.bindings(method, options); 1706 }, 1707 1708 events : function (scope) { 1709 var self = this, 1710 S = self.S; 1711 1712 S(this.scope) 1713 .off('.dropdown') 1714 .on('click.fndtn.dropdown', '[' + this.attr_name() + ']', function (e) { 1715 var settings = S(this).data(self.attr_name(true) + '-init') || self.settings; 1716 if (!settings.is_hover || Modernizr.touch) { 1717 e.preventDefault(); 1718 if (S(this).parent('[data-reveal-id]')) { 1719 e.stopPropagation(); 1720 } 1721 self.toggle($(this)); 1722 } 1723 }) 1724 .on('mouseenter.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) { 1725 var $this = S(this), 1726 dropdown, 1727 target; 1728 1729 clearTimeout(self.timeout); 1730 1731 if ($this.data(self.data_attr())) { 1732 dropdown = S('#' + $this.data(self.data_attr())); 1733 target = $this; 1734 } else { 1735 dropdown = $this; 1736 target = S('[' + self.attr_name() + '="' + dropdown.attr('id') + '"]'); 1737 } 1738 1739 var settings = target.data(self.attr_name(true) + '-init') || self.settings; 1740 1741 if(S(e.currentTarget).data(self.data_attr()) && settings.is_hover) { 1742 self.closeall.call(self); 1743 } 1744 1745 if (settings.is_hover) self.open.apply(self, [dropdown, target]); 1746 }) 1747 .on('mouseleave.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) { 1748 var $this = S(this); 1749 var settings; 1750 1751 if ($this.data(self.data_attr())) { 1752 settings = $this.data(self.data_attr(true) + '-init') || self.settings; 1753 } 1754 else { 1755 var target = S('[' + self.attr_name() + '="' + S(this).attr('id') + '"]'), 1756 settings = target.data(self.attr_name(true) + '-init') || self.settings; 1757 } 1758 1759 self.timeout = setTimeout(function () { 1760 if ($this.data(self.data_attr())) { 1761 if (settings.is_hover) self.close.call(self, S('#' + $this.data(self.data_attr()))); 1762 } else { 1763 if (settings.is_hover) self.close.call(self, $this); 1764 } 1765 }.bind(this), settings.hover_timeout); 1766 }) 1767 .on('click.fndtn.dropdown', function (e) { 1768 var parent = S(e.target).closest('[' + self.attr_name() + '-content]'); 1769 var links = parent.find('a'); 1770 1771 if (links.length >
1771 0 && parent.attr('aria-autoclose') !== "false") { 1772 self.close.call(self, S('[' + self.attr_name() + '-content]')); 1773 } 1774 1775 if (S(e.target).closest('[' + self.attr_name() + ']').length > 0) { 1776 return; 1777 } 1778 1779 if (!(S(e.target).data('revealId')) && 1780 (parent.length > 0 && (S(e.target).is('[' + self.attr_name() + '-content]') || 1781 $.contains(parent.first()[0], e.target)))) { 1782 e.stopPropagation(); 1783 return; 1784 } 1785 1786 self.close.call(self, S('[' + self.attr_name() + '-content]')); 1787 }) 1788 .on('opened.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () { 1789 self.settings.opened.call(this); 1790 }) 1791 .on('closed.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () { 1792 self.settings.closed.call(this); 1793 }); 1794 1795 S(window) 1796 .off('.dropdown') 1797 .on('resize.fndtn.dropdown', self.throttle(function () { 1798 self.resize.call(self); 1799 }, 50)); 1800 1801 this.resize(); 1802 }, 1803 1804 close: function (dropdown) { 1805 var self = this; 1806 dropdown.each(function () { 1807 var original_target = $('[' + self.attr_name() + '=' + dropdown[0].id + ']') || $('aria-controls=' + dropdown[0].id+ ']'); 1808 original_target.attr('aria-expanded', 'false'); 1809 if (self.S(this).hasClass(self.settings.active_class)) { 1810 self.S(this) 1811 .css(Foundation.rtl ? 'right':'left', '-99999px') 1812 .attr('aria-hidden', 'true') 1813 .removeClass(self.settings.active_class) 1814 .prev('[' + self.attr_name() + ']') 1815 .removeClass(self.settings.active_class) 1816 .removeData('target'); 1817 1818 self.S(this).trigger('closed').trigger('closed.fndtn.dropdown', [dropdown]); 1819 } 1820 }); 1821 dropdown.removeClass('f-open-' + this.attr_name(true)); 1822 }, 1823 1824 closeall: function() { 1825 var self = this; 1826 $.each(self.S('.f-open-' + this.attr_name(true)), function() { 1827 self.close.call(self, self.S(this)); 1828 }); 1829 }, 1830 1831 open: function (dropdown, target) { 1832 this 1833 .css(dropdown 1834 .addClass(this.settings.active_class), target); 1835 dropdown.prev('[' + this.attr_name() + ']').addClass(this.settings.active_class); 1836 dropdown.data('target', target.get(0)).trigger('opened').trigger('opened.fndtn.dropdown', [dropdown, target]); 1837 dropdown.attr('aria-hidden', 'false'); 1838 target.attr('aria-expanded', 'true'); 1839 dropdown.focus(); 1840 dropdown.addClass('f-open-' + this.attr_name(true)); 1841 }, 1842 1843 data_attr: function () { 1844 if (this.namespace.length > 0) { 1845 return this.namespace + '-' + this.name; 1846 } 1847 1848 return this.name; 1849 }, 1850 1851 toggle : function (target) { 1852 if (target.hasClass(this.settings.disabled_class)) { 1853 return; 1854 } 1855 var dropdown = this.S('#' + target.data(this.data_attr())); 1856 if (dropdown.length === 0) { 1857 // No dropdown found, not continuing 1858 return; 1859 } 1860 1861 this.close.call(this, this.S('[' + this.attr_name() + '-content]').not(dropdown)); 1862 1863 if (dropdown.hasClass(this.settings.active_class)) { 1864 this.close.call(this, dropdown); 1865 if (dropdown.data('target') !== target.get(0)) 1866 this.open.call(this, dropdown, target); 1867 } else { 1868 this.open.call(this, dropdown, target); 1869 } 1870 }, 1871 1872 resize : function () { 1873 var dropdown = this.S('[' + this.attr_name() + '-content].open'), 1874 target = this.S('[' + this.attr_name() + '="' + dropdown.attr('id') + '"]'); 1875 1876 if (dropdown.length && target.length) { 1877 this.css(dropdown, target); 1878 } 1879 }, 1880 1881 css : function (dropdown, target) { 1882 var left_offset = Math.max((target.width() - dropdown.width()) / 2, 8), 1883 settings = target.data(this.attr_name(true) + '-init') || this.settings; 1884 1885 this.clear_idx(); 1886 1887 if (this.small()) { 1888 var p = this.dirs.bottom.call(dropdown, target, settings); 1889 1890 dropdown.attr('style', '').removeClass('drop-left drop-right drop-top').css({ 1891 position : 'absolute', 1892 width: '95%', 1893 'max-width': 'none', 1894 top: p.top 1895 }); 1896 1897 dropdown.css(Foundation.rtl ? 'right':'left', left_offset); 1898 } else { 1899 1900 this.style(dropdown, target, settings); 1901 } 1902 1903 return dropdown; 1904 }, 1905 1906 style : function (dropdown, target, settings) { 1907 var css = $.extend({position: 'absolute'}, 1908 this.dirs[settings.align].call(dropdown, target, settings)); 1909 1910 dropdown.attr('style', '').css(css); 1911 }, 1912 1913 // return CSS property object 1914 // `this` is the dropdown 1915 dirs : { 1916 // Calculate target offset 1917 _base : function (t) { 1918 var o_p = this.offsetParent(), 1919 o = o_p.offset(), 1920 p = t.offset(); 1921 1922 p.top -= o.top; 1923 p.left -= o.left; 1924 1925 //set some flags on the p object to pass along 1926 p.missRight = false;
1927 p.missTop = false; 1928 p.missLeft = false; 1929 p.leftRightFlag = false; 1930 1931 //lets see if the panel will be off the screen 1932 //get the actual width of the page and store it 1933 var actualBodyWidth; 1934 if (document.getElementsByClassName('row')[0]) { 1935 actualBodyWidth = document.getElementsByClassName('row')[0].clientWidth; 1936 } else { 1937 actualBodyWidth = window.outerWidth; 1938 } 1939 1940 var actualMarginWidth = (window.outerWidth - actualBodyWidth) / 2; 1941 var actualBoundary = actualBodyWidth; 1942 1943 if (!this.hasClass('mega')) { 1944 //miss top 1945 if (t.offset().top <= this.outerHeight()) { 1946 p.missTop = true; 1947 actualBoundary = window.outerWidth - actualMarginWidth; 1948 p.leftRightFlag = true; 1949 } 1950 1951 //miss right 1952 if (t.offset().left + this.outerWidth() > t.offset().left + actualMarginWidth && t.offset().left - actualMarginWidth > this.outerWidth()) { 1953 p.missRight = true; 1954 p.missLeft = false; 1955 } 1956 1957 //miss left 1958 if (t.offset().left - this.outerWidth() <= 0) { 1959 p.missLeft = true; 1960 p.missRight = false; 1961 } 1962 } 1963 1964 return p; 1965 }, 1966 1967 top: function (t, s) { 1968 var self = Foundation.libs.dropdown, 1969 p = self.dirs._base.call(this, t); 1970 1971 this.addClass('drop-top'); 1972 1973 if (p.missTop == true) { 1974 p.top = p.top + t.outerHeight() + this.outerHeight(); 1975 this.removeClass('drop-top'); 1976 } 1977 1978 if (p.missRight == true) { 1979 p.left = p.left - this.outerWidth() + t.outerWidth(); 1980 } 1981 1982 if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) { 1983 self.adjust_pip(this,t,s,p); 1984 } 1985 1986 if (Foundation.rtl) { 1987 return {left: p.left - this.outerWidth() + t.outerWidth(), 1988 top: p.top - this.outerHeight()}; 1989 } 1990 1991 return {left: p.left, top: p.top - this.outerHeight()}; 1992 }, 1993 1994 bottom: function (t,s) { 1995 var self = Foundation.libs.dropdown, 1996 p = self.dirs._base.call(this, t); 1997 1998 if (p.missRight == true) { 1999 p.left = p.left - this.outerWidth() + t.outerWidth(); 2000 } 2001 2002 if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) { 2003 self.adjust_pip(this,t,s,p); 2004 } 2005 2006 if (self.rtl) { 2007 return {left: p.left - this.outerWidth() + t.outerWidth(), top: p.top + t.outerHeight()}; 2008 } 2009 2010 return {left: p.left, top: p.top + t.outerHeight()}; 2011 }, 2012 2013 left: function (t, s) { 2014 var p = Foundation.libs.dropdown.dirs._base.call(this, t); 2015 2016 this.addClass('drop-left'); 2017 2018 if (p.missLeft == true) { 2019 p.left = p.left + this.outerWidth(); 2020 p.top = p.top + t.outerHeight(); 2021 this.removeClass('drop-left'); 2022 } 2023 2024 return {left: p.left - this.outerWidth(), top: p.top}; 2025 }, 2026 2027 right: function (t, s) { 2028 var p = Foundation.libs.dropdown.dirs._base.call(this, t); 2029 2030 this.addClass('drop-right'); 2031 2032 if (p.missRight == true) { 2033 p.left = p.left - this.outerWidth(); 2034 p.top = p.top + t.outerHeight(); 2035 this.removeClass('drop-right'); 2036 } else { 2037 p.triggeredRight = true; 2038 } 2039 2040 var self = Foundation.libs.dropdown; 2041 2042 if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) { 2043 self.adjust_pip(this,t,s,p); 2044 } 2045 2046 return {left: p.left + t.outerWidth(), top: p.top}; 2047 } 2048 }, 2049 2050 // Insert rule to style psuedo elements 2051 adjust_pip : function (dropdown,target,settings,position) { 2052 var sheet = Foundation.stylesheet, 2053 pip_offset_base = 8; 2054 2055 if (dropdown.hasClass(settings.mega_class)) { 2056 pip_offset_base = position.left + (target.outerWidth()/2) - 8; 2057 } 2058 else if (this.small()) { 2059 pip_offset_base += position.left - 8; 2060 } 2061 2062 this.rule_idx = sheet.cssRules.length; 2063 2064 //default 2065 var sel_before = '.f-dropdown.open:before', 2066 sel_after = '.f-dropdown.open:after', 2067 css_before = 'left: ' + pip_offset_base + 'px;', 2068 css_after = 'left: ' + (pip_offset_base - 1) + 'px;'; 2069 2070 if (position.missRight == true) { 2071 pip_offset_base = dropdown.outerWidth() - 23; 2072 sel_before = '.f-dropdown.open:before', 2073 sel_after = '.f-dropdown.open:after', 2074 css_before = 'left: ' + pip_offset_base + 'px;', 2075 css_after = 'left: ' + (pip_offset_base - 1) + 'px;'; 2076 } 2077 2078 //just a case where right is fired, but its not missing right 2079 if (position.triggeredRight == true) { 2080 sel_before = '.f-dropdown.open:before', 2081 sel_after = '.f-dropdown.open:after', 2082 css_before = 'left:-12px;', 2083 css_after = 'left:-14px;'; 2084 } 2085 2086 if (sheet.insertRule) { 2087 sheet.insertRule([sel_before, '{', css_before, '}'].join(' '), this.rule_idx); 2088 sheet.insertRule([sel_after, '{', css_after, '}'].join(' '), this.rule_idx + 1); 2089 } else { 2090 sheet.addRule(sel_before, css_before, this.rule_idx); 2091 sheet.addRule(sel_after, css_after, this.rule_idx + 1); 2092 } 2093 }, 2094 2095 // Remove old dropdown rule index 2096 clear_idx : function () { 2097 var sheet = Foundation.stylesheet; 2098 2099 if (typeof this.rule_idx !== 'undefined') { 2100 sheet.deleteRule(this.rule_idx); 2101 sheet.deleteRule(this.rule_idx); 2102 delete this.rule_idx; 2103 } 2104 }, 2105 2106 small : function () { 2107 return matchMedia(Foundation.media_queries.small).matches && 2108 !matchMedia(Foundation.media_queries.medium).matches; 2109 }, 2110 2111 off: function () { 2112 this.S(this.scope).off('.fndtn.dropdown'); 2113 this.S('html, body').off('.fndtn.dropdown'); 2114 this.S(window).off('.fndtn.dropdown'); 2115 this.S('[data-dropdown-content]').off('.fndtn.dropdown'); 2116 }, 2117 2118 reflow : function () {} 2119 }; 2120}(jQuery, window, window.document)); 2121 2122;(function ($, window, document, undefined) { 2123 'use strict'; 2124 2125 Foundation.libs.equalizer = { 2126 name : 'equalizer', 2127 2128 version : '5.5.0', 2129 2130 settings : { 2131 use_tallest: true, 2132 before_height_change: $.noop, 2133 after_height_change: $.noop, 2134 equalize_on_stack: false 2135 }, 2136 2137 init : function (scope, method, options) { 2138 Foundation.inherit(this, 'image_loaded'); 2139 this.bindings(method, options); 2140 this.reflow(); 2141 }, 2142 2143 events : function () { 2144 this.S(window).off('.equalizer').on('resize.fndtn.equalizer', function(e){ 2145 this.reflow(); 2146 }.bind(this)); 2147 }, 2148 2149 equalize: function(equalizer) { 2150 var isStacked = false, 2151 vals = equalizer.find('[' + this.attr_name() + '-watch]:visible'), 2152 settings = equalizer.data(this.attr_name(true)+'-init'); 2153 2154 if (vals.length === 0) return; 2155 var firstTopOffset = vals.first().offset().top; 2156 settings.before_height_change(); 2157 equalizer.trigger('before-height-change').trigger('before-height-change.fndth.equalizer'); 2158 vals.height('inherit'); 2159 vals.each(function(){ 2160 var el = $(this); 2161 if (el.offset().top !== firstTopOffset) { 2162 isStacked = true; 2163 } 2164 }); 2165 2166 if (settings.equalize_on_stack === false) { 2167 if (isStacked) return; 2168 }; 2169 2170 var heights = vals.map(function(){ return $(this).outerHeight(false) }).get(); 2171 2172 if (settings.use_tallest) { 2173 var max = Math.max.apply(null, heights); 2174 vals.css('height', max); 2175 } else { 2176 var min = Math.min.apply(null, heights); 2177 vals.css('height', min); 2178 } 2179 settings.after_height_change(); 2180 equalizer.trigger('after-height-change').trigger('after-height-change.fndtn.equalizer'); 2181 }, 2182 2183 reflow : function () { 2184 var self = this; 2185 2186 this.S('[' + this.attr_name() + ']', this.scope).each(function(){ 2187 var $eq_target = $(this); 2188 self.image_loaded(self.S('img', this), function(){ 2189 self.equalize($eq_target) 2190 }); 2191 }); 2192 } 2193 }; 2194})(jQuery, window, window.document); 2195 2196;(function ($, window, document, undefined) { 2197 'use strict'; 2198 2199 Foundation.libs.interchange = { 2200 name : 'interchange', 2201 2202 version : '5.5.0', 2203 2204 cache : {}, 2205 2206 images_loaded : false, 2207 nodes_loaded : false, 2208 2209 settings : { 2210 load_attr : 'interchange', 2211 2212 named_queries : { 2213 'default' : 'only screen', 2214 'small' : Foundation.media_queries['small'], 2215 'small-only' : Foundation.media_queries['small-only'], 2216 'medium' : Foundation.media_queries['medium'], 2217 'medium-only' : Foundation.media_queries['medium-only'], 2218 'large' : Foundation.media_queries['large'], 2219 'large-only' : Foundation.media_queries['large-only'], 2220 'xlarge' : Foundation.media_queries['xlarge'], 2221 'xlarge-only' : Foundation.media_queries['xlarge-only'], 2222 'xxlarge' : Foundation.media_queries['xxlarge'], 2223 'landscape' : 'only screen and (orientation: landscape)', 2224 'portrait' : 'only screen and (orientation: portrait)', 2225 'retina' : 'only screen and (-webkit-min-device-pixel-ratio: 2),' + 2226 'only screen and (min--moz-device-pixel-ratio: 2),' + 2227 'only screen and (-o-min-device-pixel-ratio: 2/1),' + 2228 'only screen and (min-device-pixel-ratio: 2),' + 2229 'only screen and (min-resolution: 192dpi),' + 2230 'only screen and (min-resolution: 2dppx)' 2231 }, 2232 2233 directives : { 2234 replace: function (el, path, trigger) { 2235 // The trigger argument, if called within the directive, fires 2236 // an event named after the directive on the element, passing 2237 // any parameters along to the event that you pass to trigger. 2238 // 2239 // ex. trigger(), trigger([a, b, c]), or trigger(a, b, c) 2240 // 2241 // This allows you to bind a callback like so: 2242 // $('#interchangeContainer').on('replace', function (e, a, b, c) { 2243 // console.log($(this).html(), a, b, c); 2244 // }); 2245 2246 if (/IMG/.test(el[0].nodeName)) { 2247 var orig_path = el[0].src; 2248 2249 if (new RegExp(path, 'i').test(orig_path)) return; 2250 2251 el[0].src = path; 2252 2253 return trigger(el[0].src); 2254 } 2255 var last_path = el.data(this.data_attr + '-last-path'), 2256 self = this; 2257 2258 if (last_path == path) return; 2259 2260 if (/\.(gif|jpg|jpeg|tiff|png)([?#].*)?/i.test(path)) { 2261 $(el).css('background-image', 'url('+path+')'); 2262 el.data('interchange-last-path', path); 2263 return trigger(path); 2264 } 2265 2266 return $.get(path, function (response) { 2267 el.html(response); 2268 el.data(self.data_attr + '-last-path', path); 2269 trigger(); 2270 }); 2271 2272 } 2273 } 2274 }, 2275 2276 init : function (scope, method, options) { 2277 Foundation.inherit(this, 'throttle random_str'); 2278 2279 this.data_attr = this.set_data_attr(); 2280 $.extend(true, this.settings, method, options); 2281 this.bindings(method, options); 2282 this.load('images'); 2283 this.load('nodes'); 2284 }, 2285 2286 get_media_hash : function() { 2287 var mediaHash=''; 2288 for (var queryName in this.settings.named_queries ) { 2289 mediaHash += matchMedia(this.settings.named_queries[queryName]).matches.toString(); 2290 } 2291 return mediaHash; 2292 }, 2293 2294 events : function () { 2295 var self = this, prevMediaHash; 2296 2297 $(window) 2298 .off('.interchange') 2299 .on('resize.fndtn.interchange', self.throttle(function () { 2300 var currMediaHash = self.get_media_hash(); 2301 if (currMediaHash !== prevMediaHash) { 2302 self.resize(); 2303 } 2304 prevMediaHash = currMediaHash; 2305 }, 50)); 2306 2307 return this; 2308 }, 2309 2310 resize : function () { 2311 var cache = this.cache; 2312 2313 if(!this.images_loaded || !this.nodes_loaded) { 2314 setTimeout($.proxy(this.resize, this), 50); 2315 return; 2316 } 2317 2318 for (var uuid in cache) { 2319 if (cache.hasOwnProperty(uuid)) { 2320 var passed = this.results(uuid, cache[uuid]); 2321 2322 if (passed) { 2323 this.settings.directives[passed 2324 .scenario[1]].call(this, passed.el, passed.scenario[0], function () { 2325 if (arguments[0] instanceof Array) { 2326 var args = arguments[0]; 2327 } else { 2328 var args = Array.prototype.slice.call(arguments, 0); 2329 } 2330 2331 passed.el.trigger(passed.scenario[1], args); 2332 }); 2333 } 2334 } 2335 } 2336 2337 }, 2338 2339 results : function (uuid, scenarios) { 2340 var count = scenarios.length; 2341 2342 if (count > 0) { 2343 var el = this.S('[' + this.add_namespace('data-uuid') + '="' + uuid + '"]'); 2344 2345 while (count--) { 2346 var mq, rule = scenarios[count][2]; 2347 if (this.settings.named_queries.hasOwnProperty(rule)) { 2348 mq = matchMedia(this.settings.named_queries[rule]); 2349 } else { 2350 mq = matchMedia(rule); 2351 } 2352 if (mq.matches) { 2353 return {el: el, scenario: scenarios[count]}; 2354 } 2355 } 2356 } 2357 2358 return false;
2359 }, 2360 2361 load : function (type, force_update) { 2362 if (typeof this['cached_' + type] === 'undefined' || force_update) { 2363 this['update_' + type](); 2364 } 2365 2366 return this['cached_' + type]; 2367 }, 2368 2369 update_images : function () { 2370 var images = this.S('img[' + this.data_attr + ']'), 2371 count = images.length, 2372 i = count, 2373 loaded_count = 0, 2374 data_attr = this.data_attr; 2375 2376 this.cache = {}; 2377 this.cached_images = []; 2378 this.images_loaded = (count === 0); 2379 2380 while (i--) { 2381 loaded_count++; 2382 if (images[i]) { 2383 var str = images[i].getAttribute(data_attr) || ''; 2384 2385 if (str.length > 0) { 2386 this.cached_images.push(images[i]); 2387 } 2388 } 2389 2390 if (loaded_count === count) { 2391 this.images_loaded = true; 2392 this.enhance('images'); 2393 } 2394 } 2395 2396 return this; 2397 }, 2398 2399 update_nodes : function () { 2400 var nodes = this.S('[' + this.data_attr + ']').not('img'), 2401 count = nodes.length, 2402 i = count, 2403 loaded_count = 0, 2404 data_attr = this.data_attr; 2405 2406 this.cached_nodes = []; 2407 this.nodes_loaded = (count === 0); 2408 2409 2410 while (i--) { 2411 loaded_count++; 2412 var str = nodes[i].getAttribute(data_attr) || ''; 2413 2414 if (str.length > 0) { 2415 this.cached_nodes.push(nodes[i]); 2416 } 2417 2418 if(loaded_count === count) { 2419 this.nodes_loaded = true; 2420 this.enhance('nodes'); 2421 } 2422 } 2423 2424 return this; 2425 }, 2426 2427 enhance : function (type) { 2428 var i = this['cached_' + type].length; 2429 2430 while (i--) { 2431 this.object($(this['cached_' + type][i])); 2432 } 2433 2434 return $(window).trigger('resize').trigger('resize.fndtn.interchange'); 2435 }, 2436 2437 convert_directive : function (directive) { 2438 2439 var trimmed = this.trim(directive); 2440 2441 if (trimmed.length > 0) { 2442 return trimmed; 2443 } 2444 2445 return 'replace'; 2446 }, 2447 2448 parse_scenario : function (scenario) { 2449 // This logic had to be made more complex since some users were using commas in the url path 2450 // So we cannot simply just split on a comma 2451 var directive_match = scenario[0].match(/(.+),\s*(\w+)\s*$/), 2452 media_query = scenario[1]; 2453 2454 if (directive_match) { 2455 var path = directive_match[1], 2456 directive = directive_match[2]; 2457 } 2458 else { 2459 var cached_split = scenario[0].split(/,\s*$/), 2460 path = cached_split[0], 2461 directive = ''; 2462 } 2463 2464 return [this.trim(path), this.convert_directive(directive), this.trim(media_query)]; 2465 }, 2466 2467 object : function(el) { 2468 var raw_arr = this.parse_data_attr(el), 2469 scenarios = [], 2470 i = raw_arr.length; 2471 2472 if (i > 0) { 2473 while (i--) { 2474 var split = raw_arr[i].split(/\((.*?)(\))$/); 2475 2476 if (split.length > 1) { 2477 var params = this.parse_scenario(split); 2478 scenarios.push(params); 2479 } 2480 } 2481 } 2482 2483 return this.store(el, scenarios); 2484 }, 2485 2486 store : function (el, scenarios) { 2487 var uuid = this.random_str(), 2488 current_uuid = el.data(this.add_namespace('uuid', true)); 2489 2490 if (this.cache[current_uuid]) return this.cache[current_uuid]; 2491 2492 el.attr(this.add_namespace('data-uuid'), uuid); 2493 2494 return this.cache[uuid] = scenarios; 2495 }, 2496 2497 trim : function(str) { 2498 2499 if (typeof str === 'string') { 2500 return $.trim(str); 2501 } 2502 2503 return str; 2504 }, 2505 2506 set_data_attr: function (init) { 2507 if (init) { 2508 if (this.namespace.length > 0) { 2509 return this.namespace + '-' + this.settings.load_attr; 2510 } 2511 2512 return this.settings.load_attr; 2513 } 2514 2515 if (this.namespace.length > 0) { 2516 return 'data-' + this.namespace + '-' + this.settings.load_attr; 2517 } 2518 2519 return 'data-' + this.settings.load_attr; 2520 }, 2521 2522 parse_data_attr : function (el) { 2523 var raw = el.attr(this.attr_name()).split(/\[(.*?)\]/), 2524 i = raw.length, 2525 output = []; 2526 2527 while (i--) { 2528 if (raw[i].replace(/[\W\d]+/, '').length > 4) { 2529 output.push(raw[i]); 2530 } 2531 } 2532 2533 return output; 2534 }, 2535 2536 reflow : function () { 2537 this.load('images', true); 2538 this.load('nodes', true); 2539 } 2540 2541 }; 2542 2543}(jQuery, window, window.document)); 2544 2545;(function ($, window, document, undefined) { 2546 'use strict'; 2547 2548 var Modernizr = Modernizr || false; 2549 2550 Foundation.libs.joyride = { 2551 name : 'joyride', 2552 2553 version : '5.5.0', 2554 2555 defaults : { 2556 expose : false, // turn on or off the expose feature 2557 modal : true, // Whether to cover page with modal during the tour 2558 keyboard : true, // enable left, right and esc keystrokes 2559 tip_location : 'bottom', // 'top' or 'bottom' in relation to parent 2560 nub_position : 'auto', // override on a per tooltip bases 2561 scroll_speed : 1500, // Page scrolling speed in milliseconds, 0 = no scroll animation 2562 scroll_animation : 'linear', // supports 'swing' and 'linear', extend with jQuery UI. 2563 timer : 0, // 0 = no timer , all other numbers = timer in milliseconds 2564 start_timer_on_click : true, // true or false - true requires clicking the first button start the timer 2565 start_offset : 0, // the index of the tooltip you want to start on (index of the li) 2566 next_button : true, // true or false to control whether a next button is used 2567 prev_button : true, // true or false to control whether a prev button is used 2568 tip_animation : 'fade', // 'pop' or 'fade' in each tip 2569 pause_after : [], // array of indexes where to pause the tour after 2570 exposed : [], // array of expose elements 2571 tip_animation_fade_speed : 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition 2572 cookie_monster : false, // true or false to control whether cookies are used 2573 cookie_name : 'joyride', // Name the cookie you'll use
2574 cookie_domain : false, // Will this cookie be attached to a domain, ie. '.notableapp.com' 2575 cookie_expires : 365, // set when you would like the cookie to expire. 2576 tip_container : 'body', // Where will the tip be attached 2577 abort_on_close : true, // When true, the close event will not fire any callback 2578 tip_location_patterns : { 2579 top: ['bottom'], 2580 bottom: [], // bottom should not need to be repositioned 2581 left: ['right', 'top', 'bottom'], 2582 right: ['left', 'top', 'bottom'] 2583 }, 2584 post_ride_callback : function (){}, // A method to call once the tour closes (canceled or complete) 2585 post_step_callback : function (){}, // A method to call after each step 2586 pre_step_callback : function (){}, // A method to call before each step 2587 pre_ride_callback : function (){}, // A method to call before the tour starts (passed index, tip, and cloned exposed element) 2588 post_expose_callback : function (){}, // A method to call after an element has been exposed 2589 template : { // HTML segments for tip layout 2590 link : '<a href="#close" class="joyride-close-tip">×</a>', 2591 timer : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>', 2592 tip : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>', 2593 wrapper : '<div class="joyride-content-wrapper"></div>', 2594 button : '<a href="#" class="small button joyride-next-tip"></a>', 2595 prev_button : '<a href="#" class="small button joyride-prev-tip"></a>', 2596 modal : '<div class="joyride-modal-bg"></div>', 2597 expose : '<div class="joyride-expose-wrapper"></div>', 2598 expose_cover : '<div class="joyride-expose-cover"></div>' 2599 }, 2600 expose_add_class : '' // One or more space-separated class names to be added to exposed element 2601 }, 2602 2603 init : function (scope, method, options) { 2604 Foundation.inherit(this, 'throttle random_str'); 2605 2606 this.settings = this.settings || $.extend({}, this.defaults, (options || method)); 2607 2608 this.bindings(method, options) 2609 }, 2610 2611 go_next : function() { 2612 if (this.settings.$li.next().length < 1) { 2613 this.end(); 2614 } else if (this.settings.timer > 0) { 2615 clearTimeout(this.settings.automate); 2616 this.hide(); 2617 this.show(); 2618 this.startTimer(); 2619 } else { 2620 this.hide(); 2621 this.show(); 2622 } 2623 }, 2624 2625 go_prev : function() { 2626 if (this.settings.$li.prev().length < 1) { 2627 // Do nothing if there are no prev element 2628 } else if (this.settings.timer > 0) { 2629 clearTimeout(this.settings.automate); 2630 this.hide(); 2631 this.show(null, true); 2632 this.startTimer(); 2633 } else { 2634 this.hide(); 2635 this.show(null, true); 2636 } 2637 }, 2638 2639 events : function () { 2640 var self = this; 2641 2642 $(this.scope) 2643 .off('.joyride') 2644 .on('click.fndtn.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) { 2645 e.preventDefault(); 2646 this.go_next() 2647 }.bind(this)) 2648 .on('click.fndtn.joyride', '.joyride-prev-tip', function (e) { 2649 e.preventDefault(); 2650 this.go_prev(); 2651 }.bind(this)) 2652 2653 .on('click.fndtn.joyride', '.joyride-close-tip', function (e) { 2654 e.preventDefault(); 2655 this.end(this.settings.abort_on_close); 2656 }.bind(this)) 2657 2658 .on('keyup.fndtn.joyride', function(e) { 2659 // Don't do anything if keystrokes are disabled 2660 // or if the joyride is not being shown 2661 if (!this.settings.keyboard || !this.settings.riding) return; 2662 2663 switch (e.which) { 2664 case 39: // right arrow 2665 e.preventDefault(); 2666 this.go_next(); 2667 break; 2668 case 37: // left arrow 2669 e.preventDefault(); 2670 this.go_prev(); 2671 break; 2672 case 27: // escape 2673 e.preventDefault(); 2674 this.end(this.settings.abort_on_close); 2675 } 2676 }.bind(this)); 2677 2678 $(window) 2679 .off('.joyride') 2680 .on('resize.fndtn.joyride', self.throttle(function () { 2681 if ($('[' + self.attr_name() + ']').length >
2681 0 && self.settings.$next_tip && self.settings.riding) { 2682 if (self.settings.exposed.length > 0) { 2683 var $els = $(self.settings.exposed); 2684 2685 $els.each(function () { 2686 var $this = $(this); 2687 self.un_expose($this); 2688 self.expose($this); 2689 }); 2690 } 2691 2692 if (self.is_phone()) { 2693 self.pos_phone(); 2694 } else { 2695 self.pos_default(false); 2696 } 2697 } 2698 }, 100)); 2699 }, 2700 2701 start : function () { 2702 var self = this, 2703 $this = $('[' + this.attr_name() + ']', this.scope), 2704 integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'], 2705 int_settings_count = integer_settings.length; 2706 2707 if (!$this.length > 0) return; 2708 2709 if (!this.settings.init) this.events(); 2710 2711 this.settings = $this.data(this.attr_name(true) + '-init'); 2712 2713 // non configureable settings 2714 this.settings.$content_el = $this; 2715 this.settings.$body = $(this.settings.tip_container); 2716 this.settings.body_offset = $(this.settings.tip_container).position(); 2717 this.settings.$tip_content = this.settings.$content_el.find('> li'); 2718 this.settings.paused = false; 2719 this.settings.attempts = 0; 2720 this.settings.riding = true; 2721 2722 // can we create cookies? 2723 if (typeof $.cookie !== 'function') { 2724 this.settings.cookie_monster = false; 2725 } 2726 2727 // generate the tips and insert into dom. 2728 if (!this.settings.cookie_monster || this.settings.cookie_monster && !$.cookie(this.settings.cookie_name)) { 2729 this.settings.$tip_content.each(function (index) { 2730 var $this = $(this); 2731 this.settings = $.extend({}, self.defaults, self.data_options($this)); 2732 2733 // Make sure that settings parsed from data_options are integers where necessary 2734 var i = int_settings_count; 2735 while (i--) { 2736 self.settings[integer_settings[i]] = parseInt(self.settings[integer_settings[i]], 10); 2737 } 2738 self.create({$li : $this, index : index}); 2739 }); 2740 2741 // show first tip 2742 if (!this.settings.start_timer_on_click && this.settings.timer > 0) { 2743 this.show('init'); 2744 this.startTimer(); 2745 } else { 2746 this.show('init'); 2747 } 2748 2749 } 2750 }, 2751 2752 resume : function () { 2753 this.set_li(); 2754 this.show(); 2755 }, 2756 2757 tip_template : function (opts) { 2758 var $blank, content; 2759 2760 opts.tip_class = opts.tip_class || ''; 2761 2762 $blank = $(this.settings.template.tip).addClass(opts.tip_class); 2763 content = $.trim($(opts.li).html()) + 2764 this.prev_button_text(opts.prev_button_text, opts.index) + 2765 this.button_text(opts.button_text) + 2766 this.settings.template.link + 2767 this.timer_instance(opts.index); 2768 2769 $blank.append($(this.settings.template.wrapper)); 2770 $blank.first().attr(this.add_namespace('data-index'), opts.index); 2771 $('.joyride-content-wrapper', $blank).append(content); 2772 2773 return $blank[0]; 2774 }, 2775 2776 timer_instance : function (index) { 2777 var txt; 2778 2779 if ((index === 0 && this.settings.start_timer_on_click && this.settings.timer > 0) || this.settings.timer === 0) { 2780 txt = ''; 2781 } else { 2782 txt = $(this.settings.template.timer)[0].outerHTML; 2783 } 2784 return txt; 2785 }, 2786 2787 button_text : function (txt) { 2788 if (this.settings.tip_settings.next_button) { 2789 txt = $.trim(txt) || 'Next'; 2790 txt = $(this.settings.template.button).append(txt)[0].outerHTML; 2791 } else { 2792 txt = ''; 2793 } 2794 return txt; 2795 }, 2796 2797 prev_button_text : function (txt, idx) { 2798 if (this.settings.tip_settings.prev_button) { 2799 txt = $.trim(txt) || 'Previous'; 2800 2801 // Add the disabled class to the button if it's the first element 2802 if (idx == 0) 2803 txt = $(this.settings.template.prev_button).append(txt).addClass('disabled')[0].outerHTML; 2804 else 2805 txt = $(this.settings.template.prev_button).append(txt)[0].outerHTML; 2806 } else { 2807 txt = ''; 2808 } 2809 return txt; 2810 }, 2811 2812 create : function (opts) { 2813 this.settings.tip_settings = $.extend({}, this.settings, this.data_options(opts.$li)); 2814 var buttonText = opts.$li.attr(this.add_namespace('data-button')) 2815 || opts.$li.attr(this.add_namespace('data-text')), 2816 prevButtonText = opts.$li.attr(this.add_namespace('data-button-prev')) 2817 || opts.$li.attr(this.add_namespace('data-prev-text')), 2818 tipClass = opts.$li.attr('class'), 2819 $tip_content = $(this.tip_template({ 2820 tip_class : tipClass, 2821 index : opts.index, 2822 button_text : buttonText, 2823 prev_button_text : prevButtonText, 2824 li : opts.$li 2825 })); 2826 2827 $(this.settings.tip_container).append($tip_content); 2828 }, 2829 2830 show : function (init, is_prev) { 2831 var $timer = null; 2832 2833 // are we paused? 2834 if (this.settings.$li === undefined 2835 || ($.inArray(this.settings.$li.index(), this.settings.pause_after) === -1)) { 2836 2837 // don't go to the next li if the tour was paused 2838 if (this.settings.paused) { 2839 this.settings.paused = false;
2840 } else { 2841 this.set_li(init, is_prev); 2842 } 2843 2844 this.settings.attempts = 0; 2845 2846 if (this.settings.$li.length && this.settings.$target.length > 0) { 2847 if (init) { //run when we first start 2848 this.settings.pre_ride_callback(this.settings.$li.index(), this.settings.$next_tip); 2849 if (this.settings.modal) { 2850 this.show_modal(); 2851 } 2852 } 2853 2854 this.settings.pre_step_callback(this.settings.$li.index(), this.settings.$next_tip); 2855 2856 if (this.settings.modal && this.settings.expose) { 2857 this.expose(); 2858 } 2859 2860 this.settings.tip_settings = $.extend({}, this.settings, this.data_options(this.settings.$li)); 2861 2862 this.settings.timer = parseInt(this.settings.timer, 10); 2863 2864 this.settings.tip_settings.tip_location_pattern = this.settings.tip_location_patterns[this.settings.tip_settings.tip_location]; 2865 2866 // scroll and hide bg if not modal 2867 if (!/body/i.test(this.settings.$target.selector)) { 2868 var joyridemodalbg = $('.joyride-modal-bg'); 2869 if (/pop/i.test(this.settings.tipAnimation)) { 2870 joyridemodalbg.hide(); 2871 } else { 2872 joyridemodalbg.fadeOut(this.settings.tipAnimationFadeSpeed); 2873 } 2874 this.scroll_to(); 2875 } 2876 2877 if (this.is_phone()) { 2878 this.pos_phone(true); 2879 } else { 2880 this.pos_default(true); 2881 } 2882 2883 $timer = this.settings.$next_tip.find('.joyride-timer-indicator'); 2884 2885 if (/pop/i.test(this.settings.tip_animation)) { 2886 2887 $timer.width(0); 2888 2889 if (this.settings.timer > 0) { 2890 2891 this.settings.$next_tip.show(); 2892 2893 setTimeout(function () { 2894 $timer.animate({ 2895 width: $timer.parent().width() 2896 }, this.settings.timer, 'linear'); 2897 }.bind(this), this.settings.tip_animation_fade_speed); 2898 2899 } else { 2900 this.settings.$next_tip.show(); 2901 2902 } 2903 2904 2905 } else if (/fade/i.test(this.settings.tip_animation)) { 2906 2907 $timer.width(0); 2908 2909 if (this.settings.timer > 0) { 2910 2911 this.settings.$next_tip 2912 .fadeIn(this.settings.tip_animation_fade_speed) 2913 .show(); 2914 2915 setTimeout(function () { 2916 $timer.animate({ 2917 width: $timer.parent().width() 2918 }, this.settings.timer, 'linear'); 2919 }.bind(this), this.settings.tip_animation_fade_speed); 2920 2921 } else { 2922 this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed); 2923 } 2924 } 2925 2926 this.settings.$current_tip = this.settings.$next_tip; 2927 2928 // skip non-existant targets 2929 } else if (this.settings.$li && this.settings.$target.length < 1) { 2930 2931 this.show(init, is_prev); 2932 2933 } else { 2934 2935 this.end(); 2936 2937 } 2938 } else { 2939 2940 this.settings.paused = true; 2941 2942 } 2943 2944 }, 2945 2946 is_phone : function () { 2947 return matchMedia(Foundation.media_queries.small).matches && 2948 !matchMedia(Foundation.media_queries.medium).matches; 2949 }, 2950 2951 hide : function () { 2952 if (this.settings.modal && this.settings.expose) { 2953 this.un_expose(); 2954 } 2955 2956 if (!this.settings.modal) { 2957 $('.joyride-modal-bg').hide(); 2958 } 2959 2960 // Prevent scroll bouncing...wait to remove from layout 2961 this.settings.$current_tip.css('visibility', 'hidden'); 2962 setTimeout($.proxy(function() { 2963 this.hide(); 2964 this.css('visibility', 'visible'); 2965 }, this.settings.$current_tip), 0); 2966 this.settings.post_step_callback(this.settings.$li.index(), 2967 this.settings.$current_tip); 2968 }, 2969 2970 set_li : function (init, is_prev) { 2971 if (init) { 2972 this.settings.$li = this.settings.$tip_content.eq(this.settings.start_offset); 2973 this.set_next_tip(); 2974 this.settings.$current_tip = this.settings.$next_tip; 2975 } else { 2976 if (is_prev) 2977 this.settings.$li = this.settings.$li.prev(); 2978 else 2979 this.settings.$li = this.settings.$li.next(); 2980 this.set_next_tip(); 2981 } 2982 2983 this.set_target(); 2984 }, 2985 2986 set_next_tip : function () { 2987 this.settings.$next_tip = $('.joyride-tip-guide').eq(this.settings.$li.index()); 2988 this.settings.$next_tip.data('closed', ''); 2989 }, 2990 2991 set_target : function () { 2992 var cl = this.settings.$li.attr(this.add_namespace('data-class')), 2993 id = this.settings.$li.attr(this.add_namespace('data-id')), 2994 $sel = function () { 2995 if (id) { 2996 return $(document.getElementById(id)); 2997 } else if (cl) { 2998 return $('.' + cl).first(); 2999 } else { 3000 return $('body'); 3001 } 3002 }; 3003 3004 this.settings.$target = $sel(); 3005 }, 3006 3007 scroll_to : function () { 3008 var window_half, tipOffset; 3009 3010 window_half = $(window).height() / 2;
3011 tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()); 3012 3013 if (tipOffset != 0) { 3014 $('html, body').stop().animate({ 3015 scrollTop: tipOffset 3016 }, this.settings.scroll_speed, 'swing'); 3017 } 3018 }, 3019 3020 paused : function () { 3021 return ($.inArray((this.settings.$li.index() + 1), this.settings.pause_after) === -1); 3022 }, 3023 3024 restart : function () { 3025 this.hide(); 3026 this.settings.$li = undefined; 3027 this.show('init'); 3028 }, 3029 3030 pos_default : function (init) { 3031 var $nub = this.settings.$next_tip.find('.joyride-nub'), 3032 nub_width = Math.ceil($nub.outerWidth() / 2), 3033 nub_height = Math.ceil($nub.outerHeight() / 2), 3034 toggle = init || false; 3035 3036 // tip must not be "display: none" to calculate position 3037 if (toggle) { 3038 this.settings.$next_tip.css('visibility', 'hidden'); 3039 this.settings.$next_tip.show(); 3040 } 3041 3042 if (!/body/i.test(this.settings.$target.selector)) { 3043 var topAdjustment = this.settings.tip_settings.tipAdjustmentY ? parseInt(this.settings.tip_settings.tipAdjustmentY) : 0, 3044 leftAdjustment = this.settings.tip_settings.tipAdjustmentX ? parseInt(this.settings.tip_settings.tipAdjustmentX) : 0; 3045 3046 if (this.bottom()) { 3047 if (this.rtl) { 3048 this.settings.$next_tip.css({ 3049 top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight() + topAdjustment), 3050 left: this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth() + leftAdjustment}); 3051 } else { 3052 this.settings.$next_tip.css({ 3053 top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight() + topAdjustment), 3054 left: this.settings.$target.offset().left + leftAdjustment}); 3055 } 3056 3057 this.nub_position($nub, this.settings.tip_settings.nub_position, 'top'); 3058 3059 } else if (this.top()) { 3060 if (this.rtl) { 3061 this.settings.$next_tip.css({ 3062 top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height + topAdjustment), 3063 left: this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth()}); 3064 } else { 3065 this.settings.$next_tip.css({ 3066 top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height + topAdjustment), 3067 left: this.settings.$target.offset().left + leftAdjustment}); 3068 } 3069 3070 this.nub_position($nub, this.settings.tip_settings.nub_position, 'bottom'); 3071 3072 } else if (this.right()) { 3073 3074 this.settings.$next_tip.css({ 3075 top: this.settings.$target.offset().top + topAdjustment, 3076 left: (this.settings.$target.outerWidth() + this.settings.$target.offset().left + nub_width + leftAdjustment)}); 3077 3078 this.nub_position($nub, this.settings.tip_settings.nub_position, 'left'); 3079 3080 } else if (this.left()) { 3081 3082 this.settings.$next_tip.css({ 3083 top: this.settings.$target.offset().top + topAdjustment, 3084 left: (this.settings.$target.offset().left - this.settings.$next_tip.outerWidth() - nub_width + leftAdjustment)}); 3085 3086 this.nub_position($nub, this.settings.tip_settings.nub_position, 'right'); 3087 3088 } 3089 3090 if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tip_settings.tip_location_pattern.length) { 3091 3092 $nub.removeClass('bottom') 3093 .removeClass('top') 3094 .removeClass('right') 3095 .removeClass('left'); 3096 3097 this.settings.tip_settings.tip_location = this.settings.tip_settings.tip_location_pattern[this.settings.attempts]; 3098 3099 this.settings.attempts++; 3100 3101 this.pos_default(); 3102 3103 } 3104 3105 } else if (this.settings.$li.length) { 3106 3107 this.pos_modal($nub); 3108 3109 } 3110 3111 if (toggle) { 3112 this.settings.$next_tip.hide(); 3113 this.settings.$next_tip.css('visibility', 'visible'); 3114 } 3115 3116 }, 3117 3118 pos_phone : function (init) { 3119 var tip_height = this.settings.$next_tip.outerHeight(), 3120 tip_offset = this.settings.$next_tip.offset(), 3121 target_height = this.settings.$target.outerHeight(), 3122 $nub = $('.joyride-nub', this.settings.$next_tip),
3123 nub_height = Math.ceil($nub.outerHeight() / 2), 3124 toggle = init || false; 3125 3126 $nub.removeClass('bottom') 3127 .removeClass('top') 3128 .removeClass('right') 3129 .removeClass('left'); 3130 3131 if (toggle) { 3132 this.settings.$next_tip.css('visibility', 'hidden'); 3133 this.settings.$next_tip.show(); 3134 } 3135 3136 if (!/body/i.test(this.settings.$target.selector)) { 3137 3138 if (this.top()) { 3139 3140 this.settings.$next_tip.offset({top: this.settings.$target.offset().top - tip_height - nub_height}); 3141 $nub.addClass('bottom'); 3142 3143 } else { 3144 3145 this.settings.$next_tip.offset({top: this.settings.$target.offset().top + target_height + nub_height}); 3146 $nub.addClass('top'); 3147 3148 } 3149 3150 } else if (this.settings.$li.length) { 3151 this.pos_modal($nub); 3152 } 3153 3154 if (toggle) { 3155 this.settings.$next_tip.hide(); 3156 this.settings.$next_tip.css('visibility', 'visible'); 3157 } 3158 }, 3159 3160 pos_modal : function ($nub) { 3161 this.center(); 3162 $nub.hide(); 3163 3164 this.show_modal(); 3165 }, 3166 3167 show_modal : function () { 3168 if (!this.settings.$next_tip.data('closed')) { 3169 var joyridemodalbg = $('.joyride-modal-bg'); 3170 if (joyridemodalbg.length < 1) { 3171 var joyridemodalbg = $(this.settings.template.modal); 3172 joyridemodalbg.appendTo('body'); 3173 } 3174 3175 if (/pop/i.test(this.settings.tip_animation)) { 3176 joyridemodalbg.show(); 3177 } else { 3178 joyridemodalbg.fadeIn(this.settings.tip_animation_fade_speed); 3179 } 3180 } 3181 }, 3182 3183 expose : function () { 3184 var expose, 3185 exposeCover, 3186 el, 3187 origCSS, 3188 origClasses, 3189 randId = 'expose-' + this.random_str(6); 3190 3191 if (arguments.length > 0 && arguments[0] instanceof $) { 3192 el = arguments[0]; 3193 } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){ 3194 el = this.settings.$target; 3195 } else { 3196 return false; 3197 } 3198 3199 if(el.length < 1){ 3200 if(window.console){ 3201 console.error('element not valid', el); 3202 } 3203 return false; 3204 } 3205 3206 expose = $(this.settings.template.expose); 3207 this.settings.$body.append(expose); 3208 expose.css({ 3209 top: el.offset().top, 3210 left: el.offset().left, 3211 width: el.outerWidth(true), 3212 height: el.outerHeight(true) 3213 }); 3214 3215 exposeCover = $(this.settings.template.expose_cover); 3216 3217 origCSS = { 3218 zIndex: el.css('z-index'), 3219 position: el.css('position') 3220 }; 3221 3222 origClasses = el.attr('class') == null ? '' : el.attr('class'); 3223 3224 el.css('z-index',parseInt(expose.css('z-index'))+1); 3225 3226 if (origCSS.position == 'static') { 3227 el.css('position','relative'); 3228 } 3229 3230 el.data('expose-css',origCSS); 3231 el.data('orig-class', origClasses); 3232 el.attr('class', origClasses + ' ' + this.settings.expose_add_class); 3233 3234 exposeCover.css({ 3235 top: el.offset().top, 3236 left: el.offset().left, 3237 width: el.outerWidth(true), 3238 height: el.outerHeight(true) 3239 }); 3240 3241 if (this.settings.modal) this.show_modal(); 3242 3243 this.settings.$body.append(exposeCover); 3244 expose.addClass(randId); 3245 exposeCover.addClass(randId); 3246 el.data('expose', randId); 3247 this.settings.post_expose_callback(this.settings.$li.index(), this.settings.$next_tip, el); 3248 this.add_exposed(el); 3249 }, 3250 3251 un_expose : function () { 3252 var exposeId, 3253 el, 3254 expose , 3255 origCSS, 3256 origClasses, 3257 clearAll = false; 3258 3259 if (arguments.length > 0 && arguments[0] instanceof $) { 3260 el = arguments[0]; 3261 } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){ 3262 el = this.settings.$target; 3263 } else { 3264 return false; 3265 } 3266 3267 if(el.length < 1){ 3268 if (window.console) { 3269 console.error('element not valid', el); 3270 } 3271 return false; 3272 } 3273 3274 exposeId = el.data('expose'); 3275 expose = $('.' + exposeId); 3276 3277 if (arguments.length > 1) { 3278 clearAll = arguments[1]; 3279 } 3280 3281 if (clearAll === true) { 3282 $('.joyride-expose-wrapper,.joyride-expose-cover').remove(); 3283 } else { 3284 expose.remove(); 3285 } 3286 3287 origCSS = el.data('expose-css'); 3288 3289 if (origCSS.zIndex == 'auto') { 3290 el.css('z-index', ''); 3291 } else { 3292 el.css('z-index', origCSS.zIndex); 3293 } 3294 3295 if (origCSS.position != el.css('position')) { 3296 if(origCSS.position == 'static') {// this is default, no need to set it. 3297 el.css('position', ''); 3298 } else { 3299 el.css('position', origCSS.position); 3300 } 3301 } 3302 3303 origClasses = el.data('orig-class'); 3304 el.attr('class', origClasses); 3305 el.removeData('orig-classes'); 3306 3307 el.removeData('expose'); 3308 el.removeData('expose-z-index'); 3309 this.remove_exposed(el); 3310 }, 3311
3312 add_exposed: function(el){ 3313 this.settings.exposed = this.settings.exposed || []; 3314 if (el instanceof $ || typeof el === 'object') { 3315 this.settings.exposed.push(el[0]); 3316 } else if (typeof el == 'string') { 3317 this.settings.exposed.push(el); 3318 } 3319 }, 3320 3321 remove_exposed: function(el){ 3322 var search, i; 3323 if (el instanceof $) { 3324 search = el[0] 3325 } else if (typeof el == 'string'){ 3326 search = el; 3327 } 3328 3329 this.settings.exposed = this.settings.exposed || []; 3330 i = this.settings.exposed.length; 3331 3332 while (i--) { 3333 if (this.settings.exposed[i] == search) { 3334 this.settings.exposed.splice(i, 1); 3335 return; 3336 } 3337 } 3338 }, 3339 3340 center : function () { 3341 var $w = $(window); 3342 3343 this.settings.$next_tip.css({ 3344 top : ((($w.height() - this.settings.$next_tip.outerHeight()) / 2) + $w.scrollTop()), 3345 left : ((($w.width() - this.settings.$next_tip.outerWidth()) / 2) + $w.scrollLeft()) 3346 }); 3347 3348 return true; 3349 }, 3350 3351 bottom : function () { 3352 return /bottom/i.test(this.settings.tip_settings.tip_location); 3353 }, 3354 3355 top : function () { 3356 return /top/i.test(this.settings.tip_settings.tip_location); 3357 }, 3358 3359 right : function () { 3360 return /right/i.test(this.settings.tip_settings.tip_location); 3361 }, 3362 3363 left : function () { 3364 return /left/i.test(this.settings.tip_settings.tip_location); 3365 }, 3366 3367 corners : function (el) { 3368 var w = $(window), 3369 window_half = w.height() / 2, 3370 //using this to calculate since scroll may not have finished yet. 3371 tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()), 3372 right = w.width() + w.scrollLeft(), 3373 offsetBottom = w.height() + tipOffset, 3374 bottom = w.height() + w.scrollTop(), 3375 top = w.scrollTop(); 3376 3377 if (tipOffset < top) { 3378 if (tipOffset < 0) { 3379 top = 0; 3380 } else { 3381 top = tipOffset; 3382 } 3383 } 3384 3385 if (offsetBottom > bottom) { 3386 bottom = offsetBottom; 3387 } 3388 3389 return [ 3390 el.offset().top < top, 3391 right < el.offset().left + el.outerWidth(), 3392 bottom < el.offset().top + el.outerHeight(), 3393 w.scrollLeft() > el.offset().left 3394 ]; 3395 }, 3396 3397 visible : function (hidden_corners) { 3398 var i = hidden_corners.length; 3399 3400 while (i--) { 3401 if (hidden_corners[i]) return false; 3402 } 3403 3404 return true; 3405 }, 3406 3407 nub_position : function (nub, pos, def) { 3408 if (pos === 'auto') { 3409 nub.addClass(def); 3410 } else { 3411 nub.addClass(pos); 3412 } 3413 }, 3414 3415 startTimer : function () { 3416 if (this.settings.$li.length) { 3417 this.settings.automate = setTimeout(function () { 3418 this.hide(); 3419 this.show(); 3420 this.startTimer(); 3421 }.bind(this), this.settings.timer); 3422 } else { 3423 clearTimeout(this.settings.automate); 3424 } 3425 }, 3426 3427 end : function (abort) { 3428 if (this.settings.cookie_monster) { 3429 $.cookie(this.settings.cookie_name, 'ridden', { expires: this.settings.cookie_expires, domain: this.settings.cookie_domain }); 3430 } 3431 3432 if (this.settings.timer > 0) { 3433 clearTimeout(this.settings.automate); 3434 } 3435 3436 if (this.settings.modal && this.settings.expose) { 3437 this.un_expose(); 3438 } 3439 3440 // Unplug keystrokes listener 3441 $(this.scope).off('keyup.joyride') 3442 3443 this.settings.$next_tip.data('closed', true); 3444 this.settings.riding = false; 3445 3446 $('.joyride-modal-bg').hide(); 3447 this.settings.$current_tip.hide(); 3448 3449 if (typeof abort === 'undefined' || abort === false) { 3450 this.settings.post_step_callback(this.settings.$li.index(), this.settings.$current_tip); 3451 this.settings.post_ride_callback(this.settings.$li.index(), this.settings.$current_tip); 3452 } 3453 3454 $('.joyride-tip-guide').remove(); 3455 }, 3456 3457 off : function () { 3458 $(this.scope).off('.joyride'); 3459 $(window).off('.joyride'); 3460 $('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride'); 3461 $('.joyride-tip-guide, .joyride-modal-bg').remove(); 3462 clearTimeout(this.settings.automate); 3463 this.settings = {}; 3464 }, 3465 3466 reflow : function () {} 3467 }; 3468}(jQuery, window, window.document)); 3469 3470;(function ($, window, document, undefined) { 3471 'use strict'; 3472 3473 Foundation.libs['magellan-expedition'] = { 3474 name : 'magellan-expedition', 3475 3476 version : '5.5.0', 3477 3478 settings : { 3479 active_class: 'active', 3480 threshold: 0, // pixels from the top of the expedition for it to become fixes 3481 destination_threshold: 20, // pixels from the top of destination for it to be considered active 3482 throttle_delay: 30, // calculation throttling to increase framerate 3483 fixed_top: 0, // top distance in pixels assigend to the fixed element on scroll 3484 offset_by_height: true, // whether to offset the destination by the expedition height. Usually you want this to be true, unless your expedition is on the side. 3485 duration: 700, // animation duration time 3486 easing: 'swing' // animation easing 3487 }, 3488 3489 init : function (scope, method, options) { 3490 Foundation.inherit(this, 'throttle'); 3491 this.bindings(method, options); 3492 }, 3493 3494 events : function () { 3495 var self = this, 3496 S = self.S, 3497 settings = self.settings; 3498 3499 // initialize expedition offset 3500 self.set_expedition_position(); 3501 3502 S(self.scope) 3503 .off('.magellan') 3504 .on('click.fndtn.magellan', '[' + self.add_namespace('data-magellan-arrival') + '] a[href^="#"]', function (e) { 3505 e.preventDefault(); 3506 var expedition = $(this).closest('[' + self.attr_name() + ']'), 3507 settings = expedition.data('magellan-expedition-init'), 3508 hash = this.hash.split('#').join(''), 3509 target = $('a[name="'+hash+'"]'); 3510 3511 if (target.length === 0) { 3512 target = $('#'+hash); 3513 3514 } 3515 3516 3517 // Account for expedition height if fixed position 3518 var scroll_top = target.offset().top - settings.destination_threshold + 1; 3519 if (settings.offset_by_height) { 3520 scroll_top = scroll_top - expedition.outerHeight(); 3521 } 3522 3523 $('html, body').stop().animate({ 3524 'scrollTop': scroll_top 3525 }, settings.duration, settings.easing, function () { 3526 if(history.pushState) { 3527 history.pushState(null, null, '#'+hash); 3528 } 3529 else { 3530 location.hash = '#'+hash; 3531 } 3532 }); 3533 }) 3534 .on('scroll.fndtn.magellan', self.throttle(this.check_for_arrivals.bind(this), settings.throttle_delay)); 3535 3536 $(window) 3537 .on('resize.fndtn.magellan', self.throttle(this.set_expedition_position.bind(this), settings.throttle_delay)); 3538 }, 3539 3540 check_for_arrivals : function() { 3541 var self = this; 3542 self.update_arrivals(); 3543 self.update_expedition_positions(); 3544 }, 3545 3546 set_expedition_position : function() { 3547 var self = this; 3548 $('[' + this.attr_name() + '=fixed]', self.scope).each(function(idx, el) { 3549 var expedition = $(this), 3550 settings = expedition.data('magellan-expedition-init'), 3551 styles = expedition.attr('styles'), // save styles 3552 top_offset, fixed_top; 3553 3554 expedition.attr('style', ''); 3555 top_offset = expedition.offset().top + settings.threshold; 3556 3557 //set fixed-top by attribute 3558 fixed_top = parseInt(expedition.data('magellan-fixed-top')); 3559 if(!isNaN(fixed_top)) 3560 self.settings.fixed_top = fixed_top; 3561 3562 expedition.data(self.data_attr('magellan-top-offset'), top_offset); 3563 expedition.attr('style', styles); 3564 }); 3565 }, 3566 3567 update_expedition_positions : function() { 3568 var self = this, 3569 window_top_offset = $(window).scrollTop(); 3570 3571 $('[' + this.attr_name() + '=fixed]', self.scope).each(function() { 3572 var expedition = $(this), 3573 settings = expedition.data('magellan-expedition-init'), 3574 styles = expedition.attr('style'), // save styles 3575 top_offset = expedition.data('magellan-top-offset'); 3576 3577 //scroll to the top distance 3578 if (window_top_offset+self.settings.fixed_top >= top_offset) { 3579 // Placeholder allows height calculations to be consistent even when 3580 // appearing to switch between fixed/non-fixed placement 3581 var placeholder = expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']'); 3582 if (placeholder.length === 0) { 3583 placeholder = expedition.clone(); 3584 placeholder.removeAttr(self.attr_name()); 3585 placeholder.attr(self.add_namespace('data-magellan-expedition-clone'),''); 3586 expedition.before(placeholder); 3587 } 3588 expedition.css({position:'fixed', top: settings.fixed_top}).addClass('fixed'); 3589 } else { 3590 expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']').remove(); 3591 expedition.attr('style',styles).css('position','').css('top','').removeClass('fixed'); 3592 } 3593 }); 3594 }, 3595 3596 update_arrivals : function() { 3597 var self = this, 3598 window_top_offset = $(window).scrollTop(); 3599 3600 $('[' + this.attr_name() + ']', self.scope).each(function() { 3601 var expedition = $(this), 3602 settings = expedition.data(self.attr_name(true) + '-init'), 3603 offsets = self.offsets(expedition, window_top_offset), 3604 arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']'), 3605 active_item = false;
3606 offsets.each(function(idx, item) { 3607 if (item.viewport_offset >= item.top_offset) { 3608 var arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']'); 3609 arrivals.not(item.arrival).removeClass(settings.active_class); 3610 item.arrival.addClass(settings.active_class); 3611 active_item = true; 3612 return true; 3613 } 3614 }); 3615 3616 if (!active_item) arrivals.removeClass(settings.active_class); 3617 }); 3618 }, 3619 3620 offsets : function(expedition, window_offset) { 3621 var self = this, 3622 settings = expedition.data(self.attr_name(true) + '-init'), 3623 viewport_offset = window_offset; 3624 3625 return expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']').map(function(idx, el) { 3626 var name = $(this).data(self.data_attr('magellan-arrival')), 3627 dest = $('[' + self.add_namespace('data-magellan-destination') + '=' + name + ']'); 3628 if (dest.length > 0) { 3629 var top_offset = dest.offset().top - settings.destination_threshold; 3630 if (settings.offset_by_height) { 3631 top_offset = top_offset - expedition.outerHeight(); 3632 } 3633 top_offset = Math.floor(top_offset); 3634 return { 3635 destination : dest, 3636 arrival : $(this), 3637 top_offset : top_offset, 3638 viewport_offset : viewport_offset 3639 } 3640 } 3641 }).sort(function(a, b) { 3642 if (a.top_offset < b.top_offset) return -1; 3643 if (a.top_offset > b.top_offset) return 1; 3644 return 0; 3645 }); 3646 }, 3647 3648 data_attr: function (str) { 3649 if (this.namespace.length > 0) { 3650 return this.namespace + '-' + str; 3651 } 3652 3653 return str; 3654 }, 3655 3656 off : function () { 3657 this.S(this.scope).off('.magellan'); 3658 this.S(window).off('.magellan'); 3659 }, 3660 3661 reflow : function () { 3662 var self = this; 3663 // remove placeholder expeditions used for height calculation purposes 3664 $('[' + self.add_namespace('data-magellan-expedition-clone') + ']', self.scope).remove(); 3665 } 3666 }; 3667}(jQuery, window, window.document)); 3668 3669;(function ($, window, document, undefined) { 3670 'use strict'; 3671 3672 Foundation.libs.offcanvas = { 3673 name : 'offcanvas', 3674 3675 version : '5.5.0', 3676 3677 settings : { 3678 open_method: 'move', 3679 close_on_click: false 3680 }, 3681 3682 init : function (scope, method, options) { 3683 this.bindings(method, options); 3684 }, 3685 3686 events : function () { 3687 var self = this, 3688 S = self.S, 3689 move_class = '', 3690 right_postfix = '', 3691 left_postfix = ''; 3692 3693 if (this.settings.open_method === 'move') { 3694 move_class = 'move-'; 3695 right_postfix = 'right'; 3696 left_postfix = 'left'; 3697 } else if (this.settings.open_method === 'overlap_single') { 3698 move_class = 'offcanvas-overlap-'; 3699 right_postfix = 'right'; 3700 left_postfix = 'left'; 3701 } else if (this.settings.open_method === 'overlap') { 3702 move_class = 'offcanvas-overlap'; 3703 } 3704 3705 S(this.scope).off('.offcanvas') 3706 .on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) { 3707 self.click_toggle_class(e, move_class + right_postfix); 3708 if (self.settings.open_method !== 'overlap'){ 3709 S('.left-submenu').removeClass(move_class + right_postfix); 3710 } 3711 $('.left-off-canvas-toggle').attr('aria-expanded', 'true'); 3712 }) 3713 .on('click.fndtn.offcanvas', '.left-off-canvas-menu a', function (e) { 3714 var settings = self.get_settings(e); 3715 var parent = S(this).parent(); 3716 3717 if(settings.close_on_click && !parent.hasClass('has-submenu') && !parent.hasClass('back')){ 3718 self.hide.call(self, move_class + right_postfix, self.get_wrapper(e)); 3719 parent.parent().removeClass(move_class + right_postfix); 3720 }else if(S(this).parent().hasClass('has-submenu')){ 3721 e.preventDefault(); 3722 S(this).siblings('.left-submenu').toggleClass(move_class + right_postfix); 3723 }else if(parent.hasClass('back')){ 3724 e.preventDefault(); 3725 parent.parent().removeClass(move_class + right_postfix); 3726 } 3727 $('.left-off-canvas-toggle').attr('aria-expanded', 'true'); 3728 }) 3729 .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) { 3730 self.click_toggle_class(e, move_class + left_postfix); 3731 if (self.settings.open_method !== 'overlap'){ 3732 S('.right-submenu').removeClass(move_class + left_postfix); 3733 } 3734 $('.right-off-canvas-toggle').attr('aria-expanded', 'true'); 3735 }) 3736 .on('click.fndtn.offcanvas', '.right-off-canvas-menu a', function (e) { 3737 var settings = self.get_settings(e); 3738 var parent = S(this).parent(); 3739 3740 if(settings.close_on_click && !parent.hasClass('has-submenu') && !parent.hasClass('back')){ 3741 self.hide.call(self, move_class + left_postfix, self.get_wrapper(e)); 3742 parent.parent().removeClass(move_class + left_postfix); 3743 }else if(S(this).parent().hasClass('has-submenu')){ 3744 e.preventDefault(); 3745 S(this).siblings('.right-submenu').toggleClass(move_class + left_postfix); 3746 }else if(parent.hasClass('back')){ 3747 e.preventDefault(); 3748 parent.parent().removeClass(move_class + left_postfix); 3749 } 3750 $('.right-off-canvas-toggle').attr('aria-expanded', 'true'); 3751 }) 3752 .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) { 3753 self.click_remove_class(e, move_class + left_postfix); 3754 S('.right-submenu').removeClass(move_class + left_postfix); 3755 if (right_postfix){ 3756 self.click_remove_class(e, move_class + right_postfix); 3757 S('.left-submenu').removeClass(move_class + left_postfix); 3758 } 3759 $('.right-off-canvas-toggle').attr('aria-expanded', 'true'); 3760 }) 3761 .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) { 3762 self.click_remove_class(e, move_class + left_postfix); 3763 $('.left-off-canvas-toggle').attr('aria-expanded', 'false'); 3764 if (right_postfix) { 3765 self.click_remove_class(e, move_class + right_postfix); 3766 $('.right-off-canvas-toggle').attr('aria-expanded', 'false'); 3767 } 3768 }); 3769 }, 3770 3771 toggle: function(class_name, $off_canvas) { 3772 $off_canvas = $off_canvas || this.get_wrapper(); 3773 if ($off_canvas.is('.' + class_name)) { 3774 this.hide(class_name, $off_canvas); 3775 } else { 3776 this.show(class_name, $off_canvas); 3777 } 3778 }, 3779 3780 show: function(class_name, $off_canvas) { 3781 $off_canvas = $off_canvas || this.get_wrapper(); 3782 $off_canvas.trigger('open').trigger('open.fndtn.offcanvas'); 3783 $off_canvas.addClass(class_name); 3784 }, 3785 3786 hide: function(class_name, $off_canvas) { 3787 $off_canvas = $off_canvas || this.get_wrapper(); 3788 $off_canvas.trigger('close').trigger('close.fndtn.offcanvas'); 3789 $off_canvas.removeClass(class_name); 3790 }, 3791
3792 click_toggle_class: function(e, class_name) { 3793 e.preventDefault(); 3794 var $off_canvas = this.get_wrapper(e); 3795 this.toggle(class_name, $off_canvas); 3796 }, 3797 3798 click_remove_class: function(e, class_name) { 3799 e.preventDefault(); 3800 var $off_canvas = this.get_wrapper(e); 3801 this.hide(class_name, $off_canvas); 3802 }, 3803 3804 get_settings: function(e) { 3805 var offcanvas = this.S(e.target).closest('[' + this.attr_name() + ']'); 3806 return offcanvas.data(this.attr_name(true) + '-init') || this.settings; 3807 }, 3808 3809 get_wrapper: function(e) { 3810 var $off_canvas = this.S(e ? e.target : this.scope).closest('.off-canvas-wrap'); 3811 3812 if ($off_canvas.length === 0) { 3813 $off_canvas = this.S('.off-canvas-wrap'); 3814 } 3815 return $off_canvas; 3816 }, 3817 3818 reflow : function () {} 3819 }; 3820}(jQuery, window, window.document)); 3821 3822;(function ($, window, document, undefined) { 3823 'use strict'; 3824 3825 var noop = function() {}; 3826 3827 var Orbit = function(el, settings) { 3828 // Don't reinitialize plugin 3829 if (el.hasClass(settings.slides_container_class)) { 3830 return this; 3831 } 3832 3833 var self = this, 3834 container, 3835 slides_container = el, 3836 number_container, 3837 bullets_container, 3838 timer_container, 3839 idx = 0, 3840 animate, 3841 timer, 3842 locked = false, 3843 adjust_height_after = false; 3844 3845 3846 self.slides = function() { 3847 return slides_container.children(settings.slide_selector); 3848 }; 3849 3850 self.slides().first().addClass(settings.active_slide_class); 3851 3852 self.update_slide_number = function(index) { 3853 if (settings.slide_number) { 3854 number_container.find('span:first').text(parseInt(index)+1); 3855 number_container.find('span:last').text(self.slides().length); 3856 } 3857 if (settings.bullets) { 3858 bullets_container.children().removeClass(settings.bullets_active_class); 3859 $(bullets_container.children().get(index)).addClass(settings.bullets_active_class); 3860 } 3861 }; 3862 3863 self.update_active_link = function(index) { 3864 var link = $('[data-orbit-link="'+self.slides().eq(index).attr('data-orbit-slide')+'"]'); 3865 link.siblings().removeClass(settings.bullets_active_class); 3866 link.addClass(settings.bullets_active_class); 3867 }; 3868 3869 self.build_markup = function() {
3870 slides_container.wrap('<div class="'+settings.container_class+'"></div>'); 3871 container = slides_container.parent(); 3872 slides_container.addClass(settings.slides_container_class); 3873 3874 if (settings.stack_on_small) { 3875 container.addClass(settings.stack_on_small_class); 3876 } 3877 3878 if (settings.navigation_arrows) { 3879 container.append($('<a href="#"><span></span></a>').addClass(settings.prev_class)); 3880 container.append($('<a href="#"><span></span></a>').addClass(settings.next_class)); 3881 } 3882 3883 if (settings.timer) { 3884 timer_container = $('<div>').addClass(settings.timer_container_class); 3885 timer_container.append('<span>'); 3886 timer_container.append($('<div>').addClass(settings.timer_progress_class)); 3887 timer_container.addClass(settings.timer_paused_class); 3888 container.append(timer_container); 3889 } 3890 3891 if (settings.slide_number) { 3892 number_container = $('<div>').addClass(settings.slide_number_class); 3893 number_container.append('<span></span> ' + settings.slide_number_text + ' <span></span>'); 3894 container.append(number_container); 3895 } 3896 3897 if (settings.bullets) { 3898 bullets_container = $('<ol>').addClass(settings.bullets_container_class); 3899 container.append(bullets_container); 3900 bullets_container.wrap('<div class="orbit-bullets-container"></div>'); 3901 self.slides().each(function(idx, el) { 3902 var bullet = $('<li>').attr('data-orbit-slide', idx).on('click', self.link_bullet);; 3903 bullets_container.append(bullet); 3904 }); 3905 } 3906 3907 }; 3908 3909 self._goto = function(next_idx, start_timer) { 3910 // if (locked) {return false;} 3911 if (next_idx === idx) {return false;} 3912 if (typeof timer === 'object') {timer.restart();} 3913 var slides = self.slides(); 3914 3915 var dir = 'next'; 3916 locked = true; 3917 if (next_idx < idx) {dir = 'prev';} 3918 if (next_idx >= slides.length) { 3919 if (!settings.circular) return false; 3920 next_idx = 0; 3921 } else if (next_idx < 0) { 3922 if (!settings.circular) return false; 3923 next_idx = slides.length - 1; 3924 } 3925 3926 var current = $(slides.get(idx)); 3927 var next = $(slides.get(next_idx)); 3928 3929 current.css('zIndex', 2); 3930 current.removeClass(settings.active_slide_class); 3931 next.css('zIndex', 4).addClass(settings.active_slide_class); 3932
3933 slides_container.trigger('before-slide-change.fndtn.orbit'); 3934 settings.before_slide_change(); 3935 self.update_active_link(next_idx); 3936 3937 var callback = function() { 3938 var unlock = function() { 3939 idx = next_idx; 3940 locked = false; 3941 if (start_timer === true) {timer = self.create_timer(); timer.start();} 3942 self.update_slide_number(idx); 3943 slides_container.trigger('after-slide-change.fndtn.orbit',[{slide_number: idx, total_slides: slides.length}]); 3944 settings.after_slide_change(idx, slides.length); 3945 }; 3946 if (slides_container.height() != next.height() && settings.variable_height) { 3947 slides_container.animate({'height': next.height()}, 250, 'linear', unlock); 3948 } else { 3949 unlock(); 3950 } 3951 }; 3952 3953 if (slides.length === 1) {callback(); return false;} 3954 3955 var start_animation = function() { 3956 if (dir === 'next') {animate.next(current, next, callback);} 3957 if (dir === 'prev') {animate.prev(current, next, callback);} 3958 }; 3959 3960 if (next.height() > slides_container.height() && settings.variable_height) { 3961 slides_container.animate({'height': next.height()}, 250, 'linear', start_animation); 3962 } else { 3963 start_animation(); 3964 } 3965 }; 3966 3967 self.next = function(e) { 3968 e.stopImmediatePropagation(); 3969 e.preventDefault(); 3970 self._goto(idx + 1); 3971 }; 3972 3973 self.prev = function(e) { 3974 e.stopImmediatePropagation(); 3975 e.preventDefault(); 3976 self._goto(idx - 1); 3977 }; 3978 3979 self.link_custom = function(e) { 3980 e.preventDefault(); 3981 var link = $(this).attr('data-orbit-link'); 3982 if ((typeof link === 'string') && (link = $.trim(link)) != '') { 3983 var slide = container.find('[data-orbit-slide='+link+']'); 3984 if (slide.index() != -1) {self._goto(slide.index());} 3985 } 3986 }; 3987 3988 self.link_bullet = function(e) { 3989 var index = $(this).attr('data-orbit-slide'); 3990 if ((typeof index === 'string') && (index = $.trim(index)) != '') { 3991 if(isNaN(parseInt(index))) 3992 { 3993 var slide = container.find('[data-orbit-slide='+index+']'); 3994 if (slide.index() != -1) {self._goto(slide.index() + 1);} 3995 } 3996 else 3997 { 3998 self._goto(parseInt(index)); 3999 } 4000 } 4001 4002 } 4003 4004 self.timer_callback = function() { 4005 self._goto(idx + 1, true); 4006 } 4007 4008 self.compute_dimensions = function() { 4009 var current = $(self.slides().get(idx)); 4010 var h = current.height(); 4011 if (!settings.variable_height) { 4012 self.slides().each(function(){ 4013 if ($(this).height() > h) { h = $(this).height(); } 4014 }); 4015 } 4016 slides_container.height(h); 4017 }; 4018 4019 self.create_timer = function() { 4020 var t = new Timer( 4021 container.find('.'+settings.timer_container_class), 4022 settings, 4023 self.timer_callback 4024 ); 4025 return t; 4026 }; 4027 4028 self.stop_timer = function() { 4029 if (typeof timer === 'object') timer.stop(); 4030 }; 4031 4032 self.toggle_timer = function() { 4033 var t = container.find('.'+settings.timer_container_class); 4034 if (t.hasClass(settings.timer_paused_class)) { 4035 if (typeof timer === 'undefined') {timer = self.create_timer();} 4036 timer.start(); 4037 } 4038 else { 4039 if (typeof timer === 'object') {timer.stop();} 4040 } 4041 }; 4042 4043 self.init = function() { 4044 self.build_markup(); 4045 if (settings.timer) { 4046 timer = self.create_timer(); 4047 Foundation.utils.image_loaded(this.slides().children('img'), timer.start); 4048 } 4049 animate = new FadeAnimation(settings, slides_container); 4050 if (settings.animation === 'slide') 4051 animate = new SlideAnimation(settings, slides_container); 4052 4053 container.on('click', '.'+settings.next_class, self.next); 4054 container.on('click', '.'+settings.prev_class, self.prev); 4055 4056 if (settings.next_on_click) { 4057 container.on('click', '.'+settings.slides_container_class+' [data-orbit-slide]', self.link_bullet); 4058 } 4059 4060 container.on('click', self.toggle_timer); 4061 if (settings.swipe) { 4062 container.on('touchstart.fndtn.orbit', function(e) { 4063 if (!e.touches) {e = e.originalEvent;} 4064 var data = { 4065 start_page_x: e.touches[0].pageX, 4066 start_page_y: e.touches[0].pageY, 4067 start_time: (new Date()).getTime(), 4068 delta_x: 0, 4069 is_scrolling: undefined 4070 }; 4071 container.data('swipe-transition', data); 4072 e.stopPropagation(); 4073 }) 4074 .on('touchmove.fndtn.orbit', function(e) { 4075 if (!e.touches) { e = e.originalEvent; } 4076 // Ignore pinch/zoom events 4077 if(e.touches.length > 1 || e.scale && e.scale !== 1) return; 4078 4079 var data = container.data('swipe-transition'); 4080 if (typeof data === 'undefined') {data = {};} 4081 4082 data.delta_x = e.touches[0].pageX - data.start_page_x; 4083 4084 if ( typeof data.is_scrolling === 'undefined') { 4085 data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) ); 4086 } 4087 4088 if (!data.is_scrolling && !data.active) { 4089 e.preventDefault(); 4090 var direction = (data.delta_x < 0) ? (idx+1) : (idx-1); 4091 data.active = true; 4092 self._goto(direction); 4093 } 4094 }) 4095 .on('touchend.fndtn.orbit', function(e) { 4096 container.data('swipe-transition', {}); 4097 e.stopPropagation(); 4098 }) 4099 } 4100 container.on('mouseenter.fndtn.orbit', function(e) { 4101 if (settings.timer && settings.pause_on_hover) { 4102 self.stop_timer(); 4103 } 4104 }) 4105 .on('mouseleave.fndtn.orbit', function(e) { 4106 if (settings.timer && settings.resume_on_mouseout) { 4107 timer.start(); 4108 } 4109 }); 4110 4111 $(document).on('click', '[data-orbit-link]', self.link_custom); 4112 $(window).on('load resize', self.compute_dimensions); 4113 Foundation.utils.image_loaded(this.slides().children('img'), self.compute_dimensions); 4114 Foundation.utils.image_loaded(this.slides().children('img'), function() { 4115 container.prev('.'+settings.preloader_class).css('display', 'none'); 4116 self.update_slide_number(0); 4117 self.update_active_link(0); 4118 slides_container.trigger('ready.fndtn.orbit'); 4119 }); 4120 }; 4121 4122 self.init(); 4123 }; 4124
4125 var Timer = function(el, settings, callback) { 4126 var self = this, 4127 duration = settings.timer_speed, 4128 progress = el.find('.'+settings.timer_progress_class), 4129 start, 4130 timeout, 4131 left = -1; 4132 4133 this.update_progress = function(w) { 4134 var new_progress = progress.clone(); 4135 new_progress.attr('style', ''); 4136 new_progress.css('width', w+'%'); 4137 progress.replaceWith(new_progress); 4138 progress = new_progress; 4139 }; 4140 4141 this.restart = function() { 4142 clearTimeout(timeout); 4143 el.addClass(settings.timer_paused_class); 4144 left = -1; 4145 self.update_progress(0); 4146 }; 4147 4148 this.start = function() { 4149 if (!el.hasClass(settings.timer_paused_class)) {return true;} 4150 left = (left === -1) ? duration : left; 4151 el.removeClass(settings.timer_paused_class); 4152 start = new Date().getTime(); 4153 progress.animate({'width': '100%'}, left, 'linear'); 4154 timeout = setTimeout(function() { 4155 self.restart(); 4156 callback(); 4157 }, left); 4158 el.trigger('timer-started.fndtn.orbit') 4159 }; 4160 4161 this.stop = function() { 4162 if (el.hasClass(settings.timer_paused_class)) {return true;} 4163 clearTimeout(timeout); 4164 el.addClass(settings.timer_paused_class); 4165 var end = new Date().getTime(); 4166 left = left - (end - start); 4167 var w = 100 - ((left / duration) * 100); 4168 self.update_progress(w); 4169 el.trigger('timer-stopped.fndtn.orbit'); 4170 }; 4171 }; 4172 4173 var SlideAnimation = function(settings, container) { 4174 var duration = settings.animation_speed; 4175 var is_rtl = ($('html[dir=rtl]').length === 1); 4176 var margin = is_rtl ? 'marginRight' : 'marginLeft'; 4177 var animMargin = {}; 4178 animMargin[margin] = '0%'; 4179 4180 this.next = function(current, next, callback) { 4181 current.animate({marginLeft:'-100%'}, duration); 4182 next.animate(animMargin, duration, function() { 4183 current.css(margin, '100%'); 4184 callback(); 4185 }); 4186 }; 4187 4188 this.prev = function(current, prev, callback) { 4189 current.animate({marginLeft:'100%'}, duration); 4190 prev.css(margin, '-100%'); 4191 prev.animate(animMargin, duration, function() { 4192 current.css(margin, '100%'); 4193 callback(); 4194 }); 4195 }; 4196 }; 4197 4198 var FadeAnimation = function(settings, container) { 4199 var duration = settings.animation_speed; 4200 var is_rtl = ($('html[dir=rtl]').length === 1); 4201 var margin = is_rtl ? 'marginRight' : 'marginLeft'; 4202 4203 this.next = function(current, next, callback) { 4204 next.css({'margin':'0%', 'opacity':'0.01'}); 4205 next.animate({'opacity':'1'}, duration, 'linear', function() { 4206 current.css('margin', '100%'); 4207 callback(); 4208 }); 4209 }; 4210 4211 this.prev = function(current, prev, callback) { 4212 prev.css({'margin':'0%', 'opacity':'0.01'}); 4213 prev.animate({'opacity':'1'}, duration, 'linear', function() { 4214 current.css('margin', '100%'); 4215 callback(); 4216 }); 4217 }; 4218 }; 4219 4220 4221 Foundation.libs = Foundation.libs || {}; 4222 4223 Foundation.libs.orbit = { 4224 name: 'orbit', 4225 4226 version: '5.5.0', 4227 4228 settings: { 4229 animation: 'slide', 4230 timer_speed: 10000, 4231 pause_on_hover: true, 4232 resume_on_mouseout: false, 4233 next_on_click: true, 4234 animation_speed: 500, 4235 stack_on_small: false, 4236 navigation_arrows: true, 4237 slide_number: true, 4238 slide_number_text: 'of',
4239 container_class: 'orbit-container', 4240 stack_on_small_class: 'orbit-stack-on-small', 4241 next_class: 'orbit-next', 4242 prev_class: 'orbit-prev', 4243 timer_container_class: 'orbit-timer', 4244 timer_paused_class: 'paused', 4245 timer_progress_class: 'orbit-progress', 4246 slides_container_class: 'orbit-slides-container', 4247 preloader_class: 'preloader', 4248 slide_selector: '*', 4249 bullets_container_class: 'orbit-bullets', 4250 bullets_active_class: 'active', 4251 slide_number_class: 'orbit-slide-number', 4252 caption_class: 'orbit-caption', 4253 active_slide_class: 'active', 4254 orbit_transition_class: 'orbit-transitioning', 4255 bullets: true, 4256 circular: true, 4257 timer: true, 4258 variable_height: false, 4259 swipe: true, 4260 before_slide_change: noop, 4261 after_slide_change: noop 4262 }, 4263 4264 init : function (scope, method, options) { 4265 var self = this; 4266 this.bindings(method, options); 4267 }, 4268 4269 events : function (instance) { 4270 var orbit_instance = new Orbit(this.S(instance), this.S(instance).data('orbit-init')); 4271 this.S(instance).data(this.name + '-instance', orbit_instance); 4272 }, 4273 4274 reflow : function () { 4275 var self = this; 4276 4277 if (self.S(self.scope).is('[data-orbit]')) { 4278 var $el = self.S(self.scope); 4279 var instance = $el.data(self.name + '-instance'); 4280 instance.compute_dimensions(); 4281 } else { 4282 self.S('[data-orbit]', self.scope).each(function(idx, el) { 4283 var $el = self.S(el); 4284 var opts = self.data_options($el); 4285 var instance = $el.data(self.name + '-instance'); 4286 instance.compute_dimensions(); 4287 }); 4288 } 4289 } 4290 }; 4291 4292 4293}(jQuery, window, window.document)); 4294 4295;(function ($, window, document, undefined) { 4296 'use strict'; 4297 4298 Foundation.libs.reveal = { 4299 name : 'reveal', 4300 4301 version : '5.5.0', 4302 4303 locked : false, 4304 4305 settings : { 4306 animation: 'fadeAndPop', 4307 animation_speed: 250, 4308 close_on_background_click: true, 4309 close_on_esc: true,
4310 dismiss_modal_class: 'close-reveal-modal', 4311 bg_class: 'reveal-modal-bg', 4312 bg_root_element: 'body', 4313 root_element: 'body', 4314 open: function(){}, 4315 opened: function(){}, 4316 close: function(){}, 4317 closed: function(){}, 4318 bg : $('.reveal-modal-bg'), 4319 css : { 4320 open : { 4321 'opacity': 0, 4322 'visibility': 'visible', 4323 'display' : 'block' 4324 }, 4325 close : { 4326 'opacity': 1, 4327 'visibility': 'hidden', 4328 'display': 'none' 4329 } 4330 } 4331 }, 4332 4333 init : function (scope, method, options) { 4334 $.extend(true, this.settings, method, options); 4335 this.bindings(method, options); 4336 }, 4337 4338 events : function (scope) { 4339 var self = this, 4340 S = self.S; 4341 4342 S(this.scope) 4343 .off('.reveal') 4344 .on('click.fndtn.reveal', '[' + this.add_namespace('data-reveal-id') + ']:not([disabled])', function (e) { 4345 e.preventDefault(); 4346 4347 if (!self.locked) { 4348 var element = S(this), 4349 ajax = element.data(self.data_attr('reveal-ajax')); 4350 4351 self.locked = true; 4352 4353 if (typeof ajax === 'undefined') { 4354 self.open.call(self, element); 4355 } else { 4356 var url = ajax === true ? element.attr('href') : ajax; 4357 4358 self.open.call(self, element, {url: url}); 4359 } 4360 } 4361 }); 4362 4363 S(document) 4364 .on('click.fndtn.reveal', this.close_targets(), function (e) { 4365 4366 e.preventDefault(); 4367 4368 if (!self.locked) { 4369 var settings = S('[' + self.attr_name() + '].open').data(self.attr_name(true) + '-init') || self.settings, 4370 bg_clicked = S(e.target)[0] === S('.' + settings.bg_class)[0]; 4371 4372 if (bg_clicked) { 4373 if (settings.close_on_background_click) { 4374 e.stopPropagation(); 4375 } else { 4376 return; 4377 } 4378 } 4379 4380 self.locked = true; 4381 self.close.call(self, bg_clicked ? S('[' + self.attr_name() + '].open') : S(this).closest('[' + self.attr_name() + ']')); 4382 } 4383 }); 4384 4385 if(S('[' + self.attr_name() + ']', this.scope).length > 0) { 4386 S(this.scope) 4387 // .off('.reveal') 4388 .on('open.fndtn.reveal', this.settings.open) 4389 .on('opened.fndtn.reveal', this.settings.opened) 4390 .on('opened.fndtn.reveal', this.open_video) 4391 .on('close.fndtn.reveal', this.settings.close) 4392 .on('closed.fndtn.reveal', this.settings.closed) 4393 .on('closed.fndtn.reveal', this.close_video); 4394 } else { 4395 S(this.scope) 4396 // .off('.reveal') 4397 .on('open.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.open) 4398 .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.opened) 4399 .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.open_video) 4400 .on('close.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.close) 4401 .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.closed) 4402 .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.close_video); 4403 } 4404 4405 return true; 4406 }, 4407 4408 // PATCH #3: turning on key up capture only when a reveal window is open 4409 key_up_on : function (scope) { 4410 var self = this; 4411 4412 // PATCH #1: fixing multiple keyup event trigger from single key press 4413 self.S('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function ( event ) { 4414 var open_modal = self.S('[' + self.attr_name() + '].open'), 4415 settings = open_modal.data(self.attr_name(true) + '-init') || self.settings ; 4416 // PATCH #2: making sure that the close event can be called only while unlocked, 4417 // so that multiple keyup.fndtn.reveal events don't prevent clean closing of the reveal window. 4418 if ( settings && event.which === 27 && settings.close_on_esc && !self.locked) { // 27 is the keycode for the Escape key 4419 self.close.call(self, open_modal); 4420 } 4421 }); 4422 4423 return true; 4424 }, 4425 4426 // PATCH #3: turning on key up capture only when a reveal window is open 4427 key_up_off : function (scope) { 4428 this.S('body').off('keyup.fndtn.reveal'); 4429 return true; 4430 }, 4431 4432 4433 open : function (target, ajax_settings) { 4434 var self = this, 4435 modal; 4436 4437 if (target) { 4438 if (typeof target.selector !== 'undefined') { 4439 // Find the named node; only use the first one found, since the rest of the code assumes there's only one node 4440 modal = self.S('#' + target.data(self.data_attr('reveal-id'))).first(); 4441 } else { 4442 modal = self.S(this.scope); 4443 4444 ajax_settings = target; 4445 } 4446 } else { 4447 modal = self.S(this.scope); 4448 } 4449 4450 var settings = modal.data(self.attr_name(true) + '-init'); 4451 settings = settings || this.settings; 4452 4453 4454 if (modal.hasClass('open') && target.attr('data-reveal-id') == modal.attr('id')) { 4455 return self.close(modal); 4456 } 4457 4458 if (!modal.hasClass('open')) { 4459 var open_modal = self.S('[' + self.attr_name() + '].open'); 4460 4461 if (typeof modal.data('css-top') === 'undefined') { 4462 modal.data('css-top', parseInt(modal.css('top'), 10)) 4463 .data('offset', this.cache_offset(modal)); 4464 } 4465 4466 this.key_up_on(modal); // PATCH #3: turning on key up capture only when a reveal window is open 4467 modal.trigger('open').trigger('open.fndtn.reveal'); 4468 4469 if (open_modal.length < 1) { 4470 this.toggle_bg(modal, true); 4471 } 4472 4473 if (typeof ajax_settings === 'string') { 4474 ajax_settings = { 4475 url: ajax_settings 4476 }; 4477 } 4478 4479 if (typeof ajax_settings === 'undefined' || !ajax_settings.url) { 4480 if (open_modal.length > 0) { 4481 this.hide(open_modal, settings.css.close); 4482 } 4483 4484 this.show(modal, settings.css.open); 4485 } else { 4486 var old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null; 4487 4488 $.extend(ajax_settings, { 4489 success: function (data, textStatus, jqXHR) { 4490 if ( $.isFunction(old_success) ) { 4491 var result = old_success(data, textStatus, jqXHR); 4492 if (typeof result == 'string') data = result; 4493 } 4494 4495 modal.html(data); 4496 self.S(modal).foundation('section', 'reflow'); 4497 self.S(modal).children().foundation(); 4498 4499 if (open_modal.length > 0) { 4500 self.hide(open_modal, settings.css.close); 4501 } 4502 self.show(modal, settings.css.open); 4503 } 4504 }); 4505 4506 $.ajax(ajax_settings); 4507 } 4508 } 4509 self.S(window).trigger('resize'); 4510 }, 4511 4512 close : function (modal) { 4513 var modal = modal && modal.length ? modal : this.S(this.scope), 4514 open_modals = this.S('[' + this.attr_name() + '].open'), 4515 settings = modal.data(this.attr_name(true) + '-init') || this.settings; 4516 4517 if (open_modals.length > 0) { 4518 this.locked = true; 4519 this.key_up_off(modal); // PATCH #3: turning on key up capture only when a reveal window is open 4520 modal.trigger('close').trigger('close.fndtn.reveal'); 4521 this.toggle_bg(modal, false); 4522 this.hide(open_modals, settings.css.close, settings); 4523 } 4524 }, 4525 4526 close_targets : function () { 4527 var base = '.' + this.settings.dismiss_modal_class; 4528 4529 if (this.settings.close_on_background_click) { 4530 return base + ', .' + this.settings.bg_class; 4531 } 4532 4533 return base; 4534 }, 4535 4536 toggle_bg : function (el, modal, state) { 4537 var settings = el.data(this.attr_name(true) + '-init') || this.settings, 4538 bg_root_element = settings.bg_root_element; // Adding option to specify the background root element fixes scrolling issue 4539 4540 if (this.S('.' + this.settings.bg_class).length === 0) {
4541 this.settings.bg = $('<div />', {'class': this.settings.bg_class}) 4542 .appendTo(bg_root_element).hide(); 4543 } 4544 4545 var visible = this.settings.bg.filter(':visible').length > 0; 4546 if ( state != visible ) { 4547 if ( state == undefined ? visible : !state ) { 4548 this.hide(this.settings.bg); 4549 } else { 4550 this.show(this.settings.bg); 4551 } 4552 } 4553 }, 4554 4555 show : function (el, css) { 4556 // is modal 4557 if (css) { 4558 var settings = el.data(this.attr_name(true) + '-init') || this.settings, 4559 root_element = settings.root_element; 4560 4561 if (el.parent(root_element).length === 0) { 4562 var placeholder = el.wrap('<div style="display: none;" />').parent(); 4563 4564 el.on('closed.fndtn.reveal.wrapped', function() { 4565 el.detach().appendTo(placeholder); 4566 el.unwrap().unbind('closed.fndtn.reveal.wrapped'); 4567 }); 4568 4569 el.detach().appendTo(root_element); 4570 } 4571 4572 var animData = getAnimationData(settings.animation); 4573 if (!animData.animate) { 4574 this.locked = false; 4575 } 4576 if (animData.pop) { 4577 css.top = $(root_element).scrollTop() - el.data('offset') + 'px'; //adding root_element instead of window for scrolling offset if modal trigger is below the fold 4578 var end_css = { 4579 top: $(root_element).scrollTop() + el.data('css-top') + 'px', //adding root_element instead of window for scrolling offset if modal trigger is below the fold 4580 opacity: 1 4581 }; 4582 4583 return setTimeout(function () { 4584 return el 4585 .css(css) 4586 .animate(end_css, settings.animation_speed, 'linear', function () { 4587 this.locked = false; 4588 el.trigger('opened').trigger('opened.fndtn.reveal'); 4589 }.bind(this)) 4590 .addClass('open'); 4591 }.bind(this), settings.animation_speed / 2); 4592 } 4593 4594 if (animData.fade) { 4595 css.top = $(root_element).scrollTop() + el.data('css-top') + 'px'; //adding root_element instead of window for scrolling offset if modal trigger is below the fold 4596 var end_css = {opacity: 1}; 4597 4598 return setTimeout(function () { 4599 return el 4600 .css(css) 4601 .animate(end_css, settings.animation_speed, 'linear', function () { 4602 this.locked = false; 4603 el.trigger('opened').trigger('opened.fndtn.reveal'); 4604 }.bind(this)) 4605 .addClass('open'); 4606 }.bind(this), settings.animation_speed / 2); 4607 } 4608 4609 return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened').trigger('opened.fndtn.reveal'); 4610 } 4611 4612 var settings = this.settings; 4613 4614 // should we animate the background? 4615 if (getAnimationData(settings.animation).fade) { 4616 return el.fadeIn(settings.animation_speed / 2); 4617 } 4618 4619 this.locked = false; 4620 4621 return el.show(); 4622 }, 4623 4624 hide : function (el, css) { 4625 // is modal 4626 if (css) { 4627 var settings = el.data(this.attr_name(true) + '-init') || this.settings, 4628 root_element = settings.root_element; 4629 4630 var animData = getAnimationData(settings.animation); 4631 if (!animData.animate) { 4632 this.locked = false; 4633 } 4634 if (animData.pop) { 4635 var end_css = { 4636 top: - $(root_element).scrollTop() - el.data('offset') + 'px', //adding root_element instead of window for scrolling offset if modal trigger is below the fold 4637 opacity: 0 4638 }; 4639 4640 return setTimeout(function () { 4641 return el 4642 .animate(end_css, settings.animation_speed, 'linear', function () { 4643 this.locked = false; 4644 el.css(css).trigger('closed').trigger('closed.fndtn.reveal'); 4645 }.bind(this)) 4646 .removeClass('open'); 4647 }.bind(this), settings.animation_speed / 2); 4648 } 4649 4650 if (animData.fade) { 4651 var end_css = {opacity: 0}; 4652 4653 return setTimeout(function () { 4654 return el 4655 .animate(end_css, settings.animation_speed, 'linear', function () { 4656 this.locked = false;
4657 el.css(css).trigger('closed').trigger('closed.fndtn.reveal'); 4658 }.bind(this)) 4659 .removeClass('open'); 4660 }.bind(this), settings.animation_speed / 2); 4661 } 4662 4663 return el.hide().css(css).removeClass('open').trigger('closed').trigger('closed.fndtn.reveal'); 4664 } 4665 4666 var settings = this.settings; 4667 4668 // should we animate the background? 4669 if (getAnimationData(settings.animation).fade) { 4670 return el.fadeOut(settings.animation_speed / 2); 4671 } 4672 4673 return el.hide(); 4674 }, 4675 4676 close_video : function (e) { 4677 var video = $('.flex-video', e.target), 4678 iframe = $('iframe', video); 4679 4680 if (iframe.length > 0) { 4681 iframe.attr('data-src', iframe[0].src); 4682 iframe.attr('src', iframe.attr('src')); 4683 video.hide(); 4684 } 4685 }, 4686 4687 open_video : function (e) { 4688 var video = $('.flex-video', e.target), 4689 iframe = video.find('iframe'); 4690 4691 if (iframe.length > 0) { 4692 var data_src = iframe.attr('data-src'); 4693 if (typeof data_src === 'string') { 4694 iframe[0].src = iframe.attr('data-src'); 4695 } else { 4696 var src = iframe[0].src; 4697 iframe[0].src = undefined; 4698 iframe[0].src = src; 4699 } 4700 video.show(); 4701 } 4702 }, 4703 4704 data_attr: function (str) { 4705 if (this.namespace.length > 0) { 4706 return this.namespace + '-' + str; 4707 } 4708 4709 return str; 4710 }, 4711 4712 cache_offset : function (modal) { 4713 var offset = modal.show().height() + parseInt(modal.css('top'), 10); 4714 4715 modal.hide(); 4716 4717 return offset; 4718 }, 4719 4720 off : function () { 4721 $(this.scope).off('.fndtn.reveal'); 4722 }, 4723 4724 reflow : function () {} 4725 }; 4726 4727 /* 4728 * getAnimationData('popAndFade') // {animate: true, pop: true, fade: true} 4729 * getAnimationData('fade') // {animate: true, pop: false, fade: true} 4730 * getAnimationData('pop') // {animate: true, pop: true, fade: false} 4731 * getAnimationData('foo') // {animate: false, pop: false, fade: false} 4732 * getAnimationData(null) // {animate: false, pop: false, fade: false} 4733 */ 4734 function getAnimationData(str) { 4735 var fade = /fade/i.test(str); 4736 var pop = /pop/i.test(str); 4737 return { 4738 animate: fade || pop, 4739 pop: pop, 4740 fade: fade 4741 }; 4742 } 4743}(jQuery, window, window.document)); 4744 4745;(function ($, window, document, undefined) { 4746 'use strict'; 4747 4748 Foundation.libs.slider = { 4749 name : 'slider', 4750 4751 version : '5.5.0', 4752 4753 settings: { 4754 start: 0, 4755 end: 100, 4756 step: 1, 4757 precision: null, 4758 initial: null, 4759 display_selector: '', 4760 vertical: false, 4761 trigger_input_change: false, 4762 on_change: function(){} 4763 }, 4764 4765 cache : {}, 4766 4767 init : function (scope, method, options) { 4768 Foundation.inherit(this,'throttle'); 4769 this.bindings(method, options); 4770 this.reflow(); 4771 }, 4772 4773 events : function() { 4774 var self = this; 4775 4776 $(this.scope) 4777 .off('.slider') 4778 .on('mousedown.fndtn.slider touchstart.fndtn.slider pointerdown.fndtn.slider', 4779 '[' + self.attr_name() + ']:not(.disabled, [disabled]) .range-slider-handle', function(e) { 4780 if (!self.cache.active) { 4781 e.preventDefault(); 4782 self.set_active_slider($(e.target)); 4783 } 4784 }) 4785 .on('mousemove.fndtn.slider touchmove.fndtn.slider pointermove.fndtn.slider', function(e) { 4786 if (!!self.cache.active) { 4787 e.preventDefault(); 4788 if ($.data(self.cache.active[0], 'settings').vertical) { 4789 var scroll_offset = 0; 4790 if (!e.pageY) { 4791 scroll_offset = window.scrollY; 4792 } 4793 self.calculate_position(self.cache.active, self.get_cursor_position(e, 'y') + scroll_offset); 4794 } else { 4795 self.calculate_position(self.cache.active, self.get_cursor_position(e, 'x')); 4796 } 4797 } 4798 }) 4799 .on('mouseup.fndtn.slider touchend.fndtn.slider pointerup.fndtn.slider', function(e) { 4800 self.remove_active_slider(); 4801 }) 4802 .on('change.fndtn.slider', function(e) { 4803 self.settings.on_change(); 4804 }); 4805 4806 self.S(window) 4807 .on('resize.fndtn.slider', self.throttle(function(e) { 4808 self.reflow(); 4809 }, 300)); 4810 }, 4811 4812 get_cursor_position : function(e, xy) { 4813 var pageXY = 'page' + xy.toUpperCase(), 4814 clientXY = 'client' + xy.toUpperCase(), 4815 position; 4816 4817 if (typeof e[pageXY] !== 'undefined') { 4818 position = e[pageXY]; 4819 } 4820 else if (typeof e.originalEvent[clientXY] !== 'undefined') { 4821 position = e.originalEvent[clientXY]; 4822 } 4823 else if (e.originalEvent.touches && e.originalEvent.touches[0] && typeof e.originalEvent.touches[0][clientXY] !== 'undefined') { 4824 position = e.originalEvent.touches[0][clientXY]; 4825 } 4826 else if(e.currentPoint && typeof e.currentPoint[xy] !== 'undefined') { 4827 position = e.currentPoint[xy]; 4828 } 4829 return position; 4830 }, 4831 4832 set_active_slider : function($handle) { 4833 this.cache.active = $handle; 4834 }, 4835 4836 remove_active_slider : function() { 4837 this.cache.active = null; 4838 }, 4839 4840 calculate_position : function($handle, cursor_x) { 4841 var self = this, 4842 settings = $.data($handle[0], 'settings'), 4843 handle_l = $.data($handle[0], 'handle_l'), 4844 handle_o = $.data($handle[0], 'handle_o'), 4845 bar_l = $.data($handle[0], 'bar_l'), 4846 bar_o = $.data($handle[0], 'bar_o'); 4847 4848 requestAnimationFrame(function(){ 4849 var pct; 4850
4851 if (Foundation.rtl && !settings.vertical) { 4852 pct = self.limit_to(((bar_o+bar_l-cursor_x)/bar_l),0,1); 4853 } else { 4854 pct = self.limit_to(((cursor_x-bar_o)/bar_l),0,1); 4855 } 4856 4857 pct = settings.vertical ? 1-pct : pct; 4858 4859 var norm = self.normalized_value(pct, settings.start, settings.end, settings.step, settings.precision); 4860 4861 self.set_ui($handle, norm); 4862 }); 4863 }, 4864 4865 set_ui : function($handle, value) { 4866 var settings = $.data($handle[0], 'settings'), 4867 handle_l = $.data($handle[0], 'handle_l'), 4868 bar_l = $.data($handle[0], 'bar_l'), 4869 norm_pct = this.normalized_percentage(value, settings.start, settings.end), 4870 handle_offset = norm_pct*(bar_l-handle_l)-1, 4871 progress_bar_length = norm_pct*100, 4872 $handle_parent = $handle.parent(), 4873 $hidden_inputs = $handle.parent().children('input[type=hidden]'); 4874 4875 if (Foundation.rtl && !settings.vertical) { 4876 handle_offset = -handle_offset; 4877 } 4878 4879 handle_offset = settings.vertical ? -handle_offset + bar_l - handle_l + 1 : handle_offset; 4880 this.set_translate($handle, handle_offset, settings.vertical); 4881 4882 if (settings.vertical) { 4883 $handle.siblings('.range-slider-active-segment').css('height', progress_bar_length + '%'); 4884 } else { 4885 $handle.siblings('.range-slider-active-segment').css('width', progress_bar_length + '%'); 4886 } 4887 4888 $handle_parent.attr(this.attr_name(), value).trigger('change').trigger('change.fndtn.slider'); 4889 4890 $hidden_inputs.val(value); 4891 if (settings.trigger_input_change) { 4892 $hidden_inputs.trigger('change'); 4893 } 4894 4895 if (!$handle[0].hasAttribute('aria-valuemin')) { 4896 $handle.attr({ 4897 'aria-valuemin': settings.start, 4898 'aria-valuemax': settings.end 4899 }); 4900 } 4901 $handle.attr('aria-valuenow', value); 4902 4903 if (settings.display_selector != '') { 4904 $(settings.display_selector).each(function(){ 4905 if (this.hasOwnProperty('value')) { 4906 $(this).val(value); 4907 } else { 4908 $(this).text(value); 4909 } 4910 }); 4911 } 4912 4913 }, 4914 4915 normalized_percentage : function(val, start, end) { 4916 return Math.min(1, (val - start)/(end - start)); 4917 }, 4918 4919 normalized_value : function(val, start, end, step, precision) { 4920 var range = end - start, 4921 point = val*range, 4922 mod = (point-(point%step)) / step, 4923 rem = point % step, 4924 round = ( rem >= step*0.5 ? step : 0); 4925 return ((mod*step + round) + start).toFixed(precision); 4926 }, 4927 4928 set_translate : function(ele, offset, vertical) { 4929 if (vertical) { 4930 $(ele) 4931 .css('-webkit-transform', 'translateY('+offset+'px)') 4932 .css('-moz-transform', 'translateY('+offset+'px)') 4933 .css('-ms-transform', 'translateY('+offset+'px)') 4934 .css('-o-transform', 'translateY('+offset+'px)') 4935 .css('transform', 'translateY('+offset+'px)'); 4936 } else { 4937 $(ele) 4938 .css('-webkit-transform', 'translateX('+offset+'px)') 4939 .css('-moz-transform', 'translateX('+offset+'px)') 4940 .css('-ms-transform', 'translateX('+offset+'px)') 4941 .css('-o-transform', 'translateX('+offset+'px)') 4942 .css('transform', 'translateX('+offset+'px)'); 4943 } 4944 }, 4945 4946 limit_to : function(val, min, max) { 4947 return Math.min(Math.max(val, min), max); 4948 }, 4949 4950 4951 4952 initialize_settings : function(handle) { 4953 var settings = $.extend({}, this.settings, this.data_options($(handle).parent())), 4954 decimal_places_match_result; 4955 4956 if (settings.precision === null) { 4957 decimal_places_match_result = ('' + settings.step).match(/\.([\d]*)/); 4958 settings.precision = decimal_places_match_result && decimal_places_match_result[1] ? decimal_places_match_result[1].length : 0; 4959 } 4960 4961 if (settings.vertical) { 4962 $.data(handle, 'bar_o', $(handle).parent().offset().top); 4963 $.data(handle, 'bar_l', $(handle).parent().outerHeight()); 4964 $.data(handle, 'handle_o', $(handle).offset().top); 4965 $.data(handle, 'handle_l', $(handle).outerHeight()); 4966 } else { 4967 $.data(handle, 'bar_o', $(handle).parent().offset().left); 4968 $.data(handle, 'bar_l', $(handle).parent().outerWidth()); 4969 $.data(handle, 'handle_o', $(handle).offset().left); 4970 $.data(handle, 'handle_l', $(handle).outerWidth()); 4971 } 4972 4973 $.data(handle, 'bar', $(handle).parent()); 4974 $.data(handle, 'settings', settings); 4975 }, 4976 4977 set_initial_position : function($ele) { 4978 var settings = $.data($ele.children('.range-slider-handle')[0], 'settings'), 4979 initial = ((typeof settings.initial == 'number' && !isNaN(settings.initial)) ? settings.initial : Math.floor((settings.end-settings.start)*0.5/settings.step)*settings.step+settings.start), 4980 $handle = $ele.children('.range-slider-handle'); 4981 this.set_ui($handle, initial); 4982 }, 4983 4984 set_value : function(value) { 4985 var self = this; 4986 $('[' + self.attr_name() + ']', this.scope).each(function(){ 4987 $(this).attr(self.attr_name(), value); 4988 }); 4989 if (!!$(this.scope).attr(self.attr_name())) { 4990 $(this.scope).attr(self.attr_name(), value); 4991 } 4992 self.reflow(); 4993 }, 4994 4995 reflow : function() { 4996 var self = this; 4997 self.S('[' + this.attr_name() + ']').each(function() { 4998 var handle = $(this).children('.range-slider-handle')[0], 4999 val = $(this).attr(self.attr_name()); 5000 self.initialize_settings(handle); 5001 5002 if (val) { 5003 self.set_ui($(handle), parseFloat(val)); 5004 } else { 5005 self.set_initial_position($(this)); 5006 } 5007 }); 5008 } 5009 }; 5010 5011}(jQuery, window, window.document)); 5012 5013;(function ($, window, document, undefined) { 5014 'use strict'; 5015 5016 Foundation.libs.tab = { 5017 name : 'tab', 5018 5019 version : '5.5.0', 5020 5021 settings : { 5022 active_class: 'active', 5023 callback : function () {}, 5024 deep_linking: false, 5025 scroll_to_content: true, 5026 is_hover: false 5027 }, 5028 5029 default_tab_hashes: [], 5030 5031 init : function (scope, method, options) { 5032 var self = this, 5033 S = this.S; 5034 5035 this.bindings(method, options); 5036 this.handle_location_hash_change(); 5037 5038 // Store the default active tabs which will be referenced when the 5039 // location hash is absent, as in the case of navigating the tabs and 5040 // returning to the first viewing via the browser Back button. 5041 S('[' + this.attr_name() + '] > .active > a', this.scope).each(function () { 5042 self.default_tab_hashes.push(this.hash); 5043 }); 5044 }, 5045 5046 events : function () { 5047 var self = this, 5048 S = this.S; 5049 5050 var usual_tab_behavior = function (e) { 5051 var settings = S(this).closest('[' + self.attr_name() +']').data(self.attr_name(true) + '-init'); 5052 if (!settings.is_hover || Modernizr.touch) { 5053 e.preventDefault(); 5054 e.stopPropagation(); 5055 self.toggle_active_tab(S(this).parent()); 5056 } 5057 }; 5058 5059 S(this.scope) 5060 .off('.tab') 5061 // Click event: tab title 5062 .on('focus.fndtn.tab', '[' + this.attr_name() + '] > * > a', usual_tab_behavior ) 5063 .on('click.fndtn.tab', '[' + this.attr_name() + '] > * > a', usual_tab_behavior ) 5064 // Hover event: tab title 5065 .on('mouseenter.fndtn.tab', '[' + this.attr_name() + '] > * > a', function (e) { 5066 var settings = S(this).closest('[' + self.attr_name() +']').data(self.attr_name(true) + '-init'); 5067 if (settings.is_hover) self.toggle_active_tab(S(this).parent()); 5068 }); 5069 5070 // Location hash change event 5071 S(window).on('hashchange.fndtn.tab', function (e) { 5072 e.preventDefault(); 5073 self.handle_location_hash_change(); 5074 }); 5075 }, 5076 5077 handle_location_hash_change : function () { 5078 5079 var self = this, 5080 S = this.S; 5081 5082 S('[' + this.attr_name() + ']', this.scope).each(function () { 5083 var settings = S(this).data(self.attr_name(true) + '-init'); 5084 if (settings.deep_linking) { 5085 // Match the location hash to a label 5086 var hash; 5087 if (settings.scroll_to_content) { 5088 hash = self.scope.location.hash; 5089 } else { 5090 // prefix the hash to prevent anchor scrolling 5091 hash = self.scope.location.hash.replace('fndtn-', ''); 5092 } 5093 if (hash != '') { 5094 // Check whether the location hash references a tab content div or 5095 // another element on the page (inside or outside the tab content div) 5096 var hash_element = S(hash); 5097 if (hash_element.hasClass('content') && hash_element.parent().hasClass('tabs-content')) { 5098 // Tab content div 5099 self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + hash + ']').parent()); 5100 } else { 5101 // Not the tab content div. If inside the tab content, find the 5102 // containing tab and toggle it as active. 5103 var hash_tab_container_id = hash_element.closest('.content').attr('id'); 5104 if (hash_tab_container_id != undefined) { 5105 self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=#' + hash_tab_container_id + ']').parent(), hash); 5106 } 5107 } 5108 } else { 5109 // Reference the default tab hashes which were initialized in the init function 5110 for (var ind = 0; ind < self.default_tab_hashes.length; ind++) { 5111 self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + self.default_tab_hashes[ind] + ']').parent()); 5112 } 5113 } 5114 } 5115 }); 5116 }, 5117 5118 toggle_active_tab: function (tab, location_hash) { 5119 var S = this.S, 5120 tabs = tab.closest('[' + this.attr_name() + ']'), 5121 tab_link = tab.find('a'), 5122 anchor = tab.children('a').first(), 5123 target_hash = '#' + anchor.attr('href').split('#')[1], 5124 target = S(target_hash), 5125 siblings = tab.siblings(), 5126 settings = tabs.data(this.attr_name(true) + '-init'), 5127 interpret_keyup_action = function(e) { 5128 // Light modification of Heydon Pickering's Practical ARIA Examples: http://heydonworks.com/practical_aria_examples/js/a11y.js 5129 5130 // define current, previous and next (possible) tabs 5131 5132 var $original = $(this); 5133 var $prev = $(this).parents('li').prev().children('[role="tab"]'); 5134 var $next = $(this).parents('li').next().children('[role="tab"]'); 5135 var $target; 5136 5137 // find the direction (prev or next) 5138 5139 switch (e.keyCode) { 5140 case 37: 5141 $target = $prev; 5142 break; 5143 case 39: 5144 $target = $next; 5145 break; 5146 default: 5147 $target = false 5148 break; 5149 } 5150 5151 if ($target.length) { 5152 $original.attr({ 5153 'tabindex' : '-1', 5154 'aria-selected' : null 5155 }); 5156 $target.attr({ 5157 'tabindex' : '0', 5158 'aria-selected' : true 5159 }).focus(); 5160 } 5161 5162 // Hide panels 5163 5164 $('[role="tabpanel"]') 5165 .attr('aria-hidden', 'true'); 5166 5167 // Show panel which corresponds to target 5168 5169 $('#' + $(document.activeElement).attr('href').substring(1)) 5170 .attr('aria-hidden', null); 5171 5172 }; 5173 5174 // allow usage of data-tab-content attribute instead of href 5175 if (S(this).data(this.data_attr('tab-content'))) { 5176 target_hash = '#' + S(this).data(this.data_attr('tab-content')).split('#')[1]; 5177 target = S(target_hash); 5178 } 5179 5180 if (settings.deep_linking) { 5181 5182 if (settings.scroll_to_content) { 5183 // retain current hash to scroll to content 5184 window.location.hash = location_hash || target_hash; 5185 if (location_hash == undefined || location_hash == target_hash) { 5186 tab.parent()[0].scrollIntoView(); 5187 } else { 5188 S(target_hash)[0].scrollIntoView(); 5189 } 5190 } else { 5191 // prefix the hashes so that the browser doesn't scroll down 5192 if (location_hash != undefined) { 5193 window.location.hash = 'fndtn-' + location_hash.replace('#', ''); 5194 } else { 5195 window.location.hash = 'fndtn-' + target_hash.replace('#', ''); 5196 } 5197 } 5198 } 5199 5200 // WARNING: The activation and deactivation of the tab content must 5201 // occur after the deep linking in order to properly refresh the browser 5202 // window (notably in Chrome). 5203 // Clean up multiple attr instances to done once 5204 tab.addClass(settings.active_class).triggerHandler('opened'); 5205 tab_link.attr({'aria-selected': 'true', tabindex: 0}); 5206 siblings.removeClass(settings.active_class) 5207 siblings.find('a').attr({'aria-selected': 'false', tabindex: -1}); 5208 target.siblings().removeClass(settings.active_class).attr({'aria-hidden': 'true', tabindex: -1}); 5209 target.addClass(settings.active_class).attr('aria-hidden', 'false').removeAttr('tabindex'); 5210 settings.callback(tab); 5211 target.triggerHandler('toggled', [tab]); 5212 tabs.triggerHandler('toggled', [target]); 5213 5214 tab_link.off('keydown').on('keydown', interpret_keyup_action ); 5215 }, 5216 5217 data_attr: function (str) { 5218 if (this.namespace.length > 0) { 5219 return this.namespace + '-' + str; 5220 } 5221 5222 return str; 5223 }, 5224 5225 off : function () {}, 5226 5227 reflow : function () {} 5228 }; 5229}(jQuery, window, window.document)); 5230 5231;(function ($, window, document, undefined) { 5232 'use strict'; 5233 5234 Foundation.libs.tooltip = { 5235 name : 'tooltip', 5236 5237 version : '5.5.0', 5238 5239 settings : { 5240 additional_inheritable_classes : [], 5241 tooltip_class : '.tooltip', 5242 append_to: 'body', 5243 touch_close_text: 'Tap To Close', 5244 disable_for_touch: false, 5245 hover_delay: 200, 5246 show_on : 'all', 5247 tip_template : function (selector, content) { 5248 return '<span data-selector="' + selector + '" id="' + selector + '" class="' 5249 + Foundation.libs.tooltip.settings.tooltip_class.substring(1) 5250 + '" role="tooltip">' + content + '<span class="nub"></span></span>'; 5251 } 5252 }, 5253 5254 cache : {}, 5255 5256 init : function (scope, method, options) { 5257 Foundation.inherit(this, 'random_str'); 5258 this.bindings(method, options); 5259 }, 5260 5261 should_show: function (target, tip) { 5262 var settings = $.extend({}, this.settings, this.data_options(target)); 5263 5264 if (settings.show_on === 'all') { 5265 return true; 5266 }
5266 else if (this.small() && settings.show_on === 'small') { 5267 return true; 5268 } else if (this.medium() && settings.show_on === 'medium') { 5269 return true; 5270 } else if (this.large() && settings.show_on === 'large') { 5271 return true; 5272 } 5273 return false; 5274 }, 5275 5276 medium : function () { 5277 return matchMedia(Foundation.media_queries['medium']).matches; 5278 }, 5279 5280 large : function () { 5281 return matchMedia(Foundation.media_queries['large']).matches; 5282 }, 5283 5284 events : function (instance) { 5285 var self = this, 5286 S = self.S; 5287 5288 self.create(this.S(instance)); 5289 5290 $(this.scope) 5291 .off('.tooltip') 5292 .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', 5293 '[' + this.attr_name() + ']', function (e) { 5294 var $this = S(this), 5295 settings = $.extend({}, self.settings, self.data_options($this)), 5296 is_touch = false; 5297 5298 if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type) && S(e.target).is('a')) { 5299 return false; 5300 } 5301 5302 if (/mouse/i.test(e.type) && self.ie_touch(e)) return false; 5303 5304 if ($this.hasClass('open')) { 5305 if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) e.preventDefault(); 5306 self.hide($this); 5307 } else { 5308 if (settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) { 5309 return; 5310 } else if(!settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) { 5311 e.preventDefault(); 5312 S(settings.tooltip_class + '.open').hide(); 5313 is_touch = true; 5314 } 5315 5316 if (/enter|over/i.test(e.type)) { 5317 this.timer = setTimeout(function () { 5318 var tip = self.showTip($this); 5319 }.bind(this), self.settings.hover_delay); 5320 } else if (e.type === 'mouseout' || e.type === 'mouseleave') { 5321 clearTimeout(this.timer); 5322 self.hide($this); 5323 } else { 5324 self.showTip($this); 5325 } 5326 } 5327 }) 5328 .on('mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', '[' + this.attr_name() + '].open', function (e) { 5329 if (/mouse/i.test(e.type) && self.ie_touch(e)) return false; 5330 5331 if($(this).data('tooltip-open-event-type') == 'touch' && e.type == 'mouseleave') { 5332 return; 5333 } 5334 else if($(this).data('tooltip-open-event-type') == 'mouse' && /MSPointerDown|touchstart/i.test(e.type)) { 5335 self.convert_to_touch($(this)); 5336 } else { 5337 self.hide($(this)); 5338 } 5339 }) 5340 .on('DOMNodeRemoved DOMAttrModified', '[' + this.attr_name() + ']:not(a)', function (e) { 5341 self.hide(S(this)); 5342 }); 5343 }, 5344 5345 ie_touch : function (e) { 5346 // How do I distinguish between IE11 and Windows Phone 8????? 5347 return false; 5348 }, 5349 5350 showTip : function ($target) { 5351 var $tip = this.getTip($target); 5352 if (this.should_show($target, $tip)){ 5353 return this.show($target); 5354 } 5355 return; 5356 }, 5357 5358 getTip : function ($target) { 5359 var selector = this.selector($target), 5360 settings = $.extend({}, this.settings, this.data_options($target)), 5361 tip = null; 5362 5363 if (selector) { 5364 tip = this.S('span[data-selector="' + selector + '"]' + settings.tooltip_class); 5365 } 5366 5367 return (typeof tip === 'object') ? tip : false; 5368 }, 5369 5370 selector : function ($target) { 5371 var id = $target.attr('id'), 5372 dataSelector = $target.attr(this.attr_name()) || $target.attr('data-selector'); 5373 5374 if ((id && id.length < 1 || !id) && typeof dataSelector != 'string') { 5375 dataSelector = this.random_str(6); 5376 $target 5377 .attr('data-selector', dataSelector) 5378 .attr('aria-describedby', dataSelector); 5379 } 5380 5381 return (id && id.length > 0) ? id : dataSelector; 5382 }, 5383 5384 create : function ($target) { 5385 var self = this, 5386 settings = $.extend({}, this.settings, this.data_options($target)), 5387 tip_template = this.settings.tip_template; 5388 5389 if (typeof settings.tip_template === 'string' && window.hasOwnProperty(settings.tip_template)) { 5390 tip_template = window[settings.tip_template]; 5391 } 5392 5393 var $tip = $(tip_template(this.selector($target), $('<div></div>').html($target.attr('title')).html())), 5394 classes = this.inheritable_classes($target); 5395
5396 $tip.addClass(classes).appendTo(settings.append_to); 5397 5398 if (Modernizr.touch) { 5399 $tip.append('<span class="tap-to-close">'+settings.touch_close_text+'</span>'); 5400 $tip.on('touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', function(e) { 5401 self.hide($target); 5402 }); 5403 } 5404 5405 $target.removeAttr('title').attr('title',''); 5406 }, 5407 5408 reposition : function (target, tip, classes) { 5409 var width, nub, nubHeight, nubWidth, column, objPos; 5410 5411 tip.css('visibility', 'hidden').show(); 5412 5413 width = target.data('width'); 5414 nub = tip.children('.nub'); 5415 nubHeight = nub.outerHeight(); 5416 nubWidth = nub.outerHeight(); 5417 5418 if (this.small()) { 5419 tip.css({'width' : '100%' }); 5420 } else { 5421 tip.css({'width' : (width) ? width : 'auto'}); 5422 } 5423 5424 objPos = function (obj, top, right, bottom, left, width) { 5425 return obj.css({ 5426 'top' : (top) ? top : 'auto', 5427 'bottom' : (bottom) ? bottom : 'auto', 5428 'left' : (left) ? left : 'auto', 5429 'right' : (right) ? right : 'auto' 5430 }).end(); 5431 }; 5432 5433 objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', target.offset().left); 5434 5435 if (this.small()) { 5436 objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', 12.5, $(this.scope).width()); 5437 tip.addClass('tip-override'); 5438 objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left); 5439 } else { 5440 var left = target.offset().left; 5441 if (Foundation.rtl) { 5442 nub.addClass('rtl'); 5443 left = target.offset().left + target.outerWidth() - tip.outerWidth(); 5444 } 5445 objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', left); 5446 tip.removeClass('tip-override'); 5447 if (classes && classes.indexOf('tip-top') > -1) { 5448 if (Foundation.rtl) nub.addClass('rtl'); 5449 objPos(tip, (target.offset().top - tip.outerHeight()), 'auto', 'auto', left) 5450 .removeClass('tip-override'); 5451 } else if (classes && classes.indexOf('tip-left') > -1) { 5452 objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left - tip.outerWidth() - nubHeight)) 5453 .removeClass('tip-override'); 5454 nub.removeClass('rtl'); 5455 } else if (classes && classes.indexOf('tip-right') > -1) { 5456 objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left + target.outerWidth() + nubHeight)) 5457 .removeClass('tip-override'); 5458 nub.removeClass('rtl'); 5459 } 5460 } 5461 5462 tip.css('visibility', 'visible').hide(); 5463 }, 5464 5465 small : function () { 5466 return matchMedia(Foundation.media_queries.small).matches && 5467 !matchMedia(Foundation.media_queries.medium).matches; 5468 }, 5469 5470 inheritable_classes : function ($target) { 5471 var settings = $.extend({}, this.settings, this.data_options($target)), 5472 inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'radius', 'round'].concat(settings.additional_inheritable_classes), 5473 classes = $target.attr('class'), 5474 filtered = classes ? $.map(classes.split(' '), function (el, i) { 5475 if ($.inArray(el, inheritables) !== -1) { 5476 return el; 5477 } 5478 }).join(' ') : ''; 5479 5480 return $.trim(filtered); 5481 }, 5482 5483 convert_to_touch : function($target) { 5484 var self = this, 5485 $tip = self.getTip($target), 5486 settings = $.extend({}, self.settings, self.data_options($target)); 5487 5488 if ($tip.find('.tap-to-close').length === 0) { 5489 $tip.append('<span class="tap-to-close">'+settings.touch_close_text+'</span>'); 5490 $tip.on('click.fndtn.tooltip.tapclose touchstart.fndtn.tooltip.tapclose MSPointerDown.fndtn.tooltip.tapclose', function(e) { 5491 self.hide($target); 5492 }); 5493 } 5494 5495 $target.data('tooltip-open-event-type', 'touch'); 5496 }, 5497 5498 show : function ($target) { 5499 var $tip = this.getTip($target); 5500 5501 if ($target.data('tooltip-open-event-type') == 'touch') { 5502 this.convert_to_touch($target); 5503 } 5504 5505 this.reposition($target, $tip, $target.attr('class')); 5506 $target.addClass('open'); 5507 $tip.fadeIn(150); 5508 }, 5509 5510 hide : function ($target) { 5511 var $tip = this.getTip($target); 5512 5513 $tip.fadeOut(150, function() { 5514 $tip.find('.tap-to-close').remove(); 5515 $tip.off('click.fndtn.tooltip.tapclose MSPointerDown.fndtn.tapclose'); 5516 $target.removeClass('open'); 5517 }); 5518 }, 5519 5520 off : function () { 5521 var self = this; 5522 this.S(this.scope).off('.fndtn.tooltip'); 5523 this.S(this.settings.tooltip_class).each(function (i) { 5524 $('[' + self.attr_name() + ']').eq(i).attr('title', $(this).text()); 5525 }).remove(); 5526 }, 5527 5528 reflow : function () {} 5529 }; 5530}(jQuery, window, window.document)); 5531 5532;(function ($, window, document, undefined) { 5533 'use strict'; 5534 5535 Foundation.libs.topbar = { 5536 name : 'topbar', 5537 5538 version: '5.5.0', 5539 5540 settings : { 5541 index : 0, 5542 sticky_class : 'sticky', 5543 custom_back_text: true, 5544 back_text: 'Back', 5545 mobile_show_parent_link: true, 5546 is_hover: true, 5547 scrolltop : true, // jump to top when sticky nav menu toggle is clicked 5548 sticky_on : 'all' 5549 }, 5550 5551 init : function (section, method, options) { 5552 Foundation.inherit(this, 'add_custom_rule register_media throttle'); 5553 var self = this; 5554 5555 self.register_media('topbar', 'foundation-mq-topbar'); 5556 5557 this.bindings(method, options); 5558 5559 self.S('[' + this.attr_name() + ']', this.scope).each(function () { 5560 var topbar = $(this), 5561 settings = topbar.data(self.attr_name(true) + '-init'),
5562 section = self.S('section, .top-bar-section', this); 5563 topbar.data('index', 0); 5564 var topbarContainer = topbar.parent(); 5565 if (topbarContainer.hasClass('fixed') || self.is_sticky(topbar, topbarContainer, settings) ) { 5566 self.settings.sticky_class = settings.sticky_class; 5567 self.settings.sticky_topbar = topbar; 5568 topbar.data('height', topbarContainer.outerHeight()); 5569 topbar.data('stickyoffset', topbarContainer.offset().top); 5570 } else { 5571 topbar.data('height', topbar.outerHeight()); 5572 } 5573 5574 if (!settings.assembled) { 5575 self.assemble(topbar); 5576 } 5577 5578 if (settings.is_hover) { 5579 self.S('.has-dropdown', topbar).addClass('not-click'); 5580 } else { 5581 self.S('.has-dropdown', topbar).removeClass('not-click'); 5582 } 5583 5584 // Pad body when sticky (scrolled) or fixed. 5585 self.add_custom_rule('.f-topbar-fixed { padding-top: ' + topbar.data('height') + 'px }'); 5586 5587 if (topbarContainer.hasClass('fixed')) { 5588 self.S('body').addClass('f-topbar-fixed'); 5589 } 5590 }); 5591 5592 }, 5593 5594 is_sticky: function (topbar, topbarContainer, settings) { 5595 var sticky = topbarContainer.hasClass(settings.sticky_class); 5596 5597 if (sticky && settings.sticky_on === 'all') { 5598 return true; 5599 } else if (sticky && this.small() && settings.sticky_on === 'small') { 5600 return (matchMedia(Foundation.media_queries.small).matches && !matchMedia(Foundation.media_queries.medium).matches && 5601 !matchMedia(Foundation.media_queries.large).matches); 5602 //return true; 5603 } else if (sticky && this.medium() && settings.sticky_on === 'medium') { 5604 return (matchMedia(Foundation.media_queries.small).matches && matchMedia(Foundation.media_queries.medium).matches && 5605 !matchMedia(Foundation.media_queries.large).matches); 5606 //return true; 5607 } else if(sticky && this.large() && settings.sticky_on === 'large') { 5608 return (matchMedia(Foundation.media_queries.small).matches && matchMedia(Foundation.media_queries.medium).matches && 5609 matchMedia(Foundation.media_queries.large).matches); 5610 //return true; 5611 } 5612 5613 return false; 5614 }, 5615 5616 toggle: function (toggleEl) { 5617 var self = this, 5618 topbar; 5619 5620 if (toggleEl) { 5621 topbar = self.S(toggleEl).closest('[' + this.attr_name() + ']'); 5622 } else { 5623 topbar = self.S('[' + this.attr_name() + ']'); 5624 } 5625 5626 var settings = topbar.data(this.attr_name(true) + '-init'); 5627 5628 var section = self.S('section, .top-bar-section', topbar); 5629 5630 if (self.breakpoint()) { 5631 if (!self.rtl) { 5632 section.css({left: '0%'}); 5633 $('>.name', section).css({left: '100%'}); 5634 } else { 5635 section.css({right: '0%'}); 5636 $('>.name', section).css({right: '100%'}); 5637 } 5638 5639 self.S('li.moved', section).removeClass('moved'); 5640 topbar.data('index', 0); 5641 5642 topbar 5643 .toggleClass('expanded') 5644 .css('height', ''); 5645 } 5646 5647 if (settings.scrolltop) { 5648 if (!topbar.hasClass('expanded')) { 5649 if (topbar.hasClass('fixed')) { 5650 topbar.parent().addClass('fixed'); 5651 topbar.removeClass('fixed'); 5652 self.S('body').addClass('f-topbar-fixed'); 5653 } 5654 } else if (topbar.parent().hasClass('fixed')) { 5655 if (settings.scrolltop) { 5656 topbar.parent().removeClass('fixed'); 5657 topbar.addClass('fixed'); 5658 self.S('body').removeClass('f-topbar-fixed'); 5659 5660 window.scrollTo(0,0); 5661 } else { 5662 topbar.parent().removeClass('expanded'); 5663 } 5664 } 5665 } else { 5666 if (self.is_sticky(topbar, topbar.parent(), settings)) { 5667 topbar.parent().addClass('fixed'); 5668 } 5669 5670 if (topbar.parent().hasClass('fixed')) { 5671 if (!topbar.hasClass('expanded')) { 5672 topbar.removeClass('fixed'); 5673 topbar.parent().removeClass('expanded'); 5674 self.update_sticky_positioning(); 5675 } else { 5676 topbar.addClass('fixed'); 5677 topbar.parent().addClass('expanded'); 5678 self.S('body').addClass('f-topbar-fixed'); 5679 } 5680 } 5681 } 5682 }, 5683 5684 timer : null, 5685 5686 events : function (bar) { 5687 var self = this, 5688 S = this.S; 5689 5690 S(this.scope) 5691 .off('.topbar') 5692 .on('click.fndtn.topbar', '[' + this.attr_name() + '] .toggle-topbar', function (e) { 5693 e.preventDefault(); 5694 self.toggle(this); 5695 }) 5696 .on('click.fndtn.topbar','.top-bar .top-bar-section li a[href^="#"],[' + this.attr_name() + '] .top-bar-section li a[href^="#"]',function (e) { 5697 var li = $(this).closest('li'); 5698 if(self.breakpoint() && !li.hasClass('back') && !li.hasClass('has-dropdown')) 5699 {
5700 self.toggle(); 5701 } 5702 }) 5703 .on('click.fndtn.topbar', '[' + this.attr_name() + '] li.has-dropdown', function (e) { 5704 var li = S(this), 5705 target = S(e.target), 5706 topbar = li.closest('[' + self.attr_name() + ']'), 5707 settings = topbar.data(self.attr_name(true) + '-init'); 5708 5709 if(target.data('revealId')) { 5710 self.toggle(); 5711 return; 5712 } 5713 5714 if (self.breakpoint()) return; 5715 if (settings.is_hover && !Modernizr.touch) return; 5716 5717 e.stopImmediatePropagation(); 5718 5719 if (li.hasClass('hover')) { 5720 li 5721 .removeClass('hover') 5722 .find('li') 5723 .removeClass('hover'); 5724 5725 li.parents('li.hover') 5726 .removeClass('hover'); 5727 } else { 5728 li.addClass('hover'); 5729 5730 $(li).siblings().removeClass('hover'); 5731 5732 if (target[0].nodeName === 'A' && target.parent().hasClass('has-dropdown')) { 5733 e.preventDefault(); 5734 } 5735 } 5736 }) 5737 .on('click.fndtn.topbar', '[' + this.attr_name() + '] .has-dropdown>a', function (e) { 5738 if (self.breakpoint()) { 5739 5740 e.preventDefault(); 5741 5742 var $this = S(this), 5743 topbar = $this.closest('[' + self.attr_name() + ']'), 5744 section = topbar.find('section, .top-bar-section'), 5745 dropdownHeight = $this.next('.dropdown').outerHeight(), 5746 $selectedLi = $this.closest('li'); 5747 5748 topbar.data('index', topbar.data('index') + 1); 5749 $selectedLi.addClass('moved'); 5750 5751 if (!self.rtl) { 5752 section.css({left: -(100 * topbar.data('index')) + '%'}); 5753 section.find('>.name').css({left: 100 * topbar.data('index') + '%'}); 5754 } else { 5755 section.css({right: -(100 * topbar.data('index')) + '%'}); 5756 section.find('>.name').css({right: 100 * topbar.data('index') + '%'}); 5757 } 5758 5759 topbar.css('height', $this.siblings('ul').outerHeight(true) + topbar.data('height')); 5760 } 5761 }); 5762 5763 S(window).off('.topbar').on('resize.fndtn.topbar', self.throttle(function() { 5764 self.resize.call(self); 5765 }, 50)).trigger('resize').trigger('resize.fndtn.topbar').load(function(){ 5766 // Ensure that the offset is calculated after all of the pages resources have loaded 5767 S(this).trigger('resize.fndtn.topbar'); 5768 }); 5769 5770 S('body').off('.topbar').on('click.fndtn.topbar', function (e) { 5771 var parent = S(e.target).closest('li').closest('li.hover'); 5772 5773 if (parent.length > 0) { 5774 return; 5775 } 5776 5777 S('[' + self.attr_name() + '] li.hover').removeClass('hover'); 5778 }); 5779 5780 // Go up a level on Click 5781 S(this.scope).on('click.fndtn.topbar', '[' + this.attr_name() + '] .has-dropdown .back', function (e) { 5782 e.preventDefault(); 5783 5784 var $this = S(this), 5785 topbar = $this.closest('[' + self.attr_name() + ']'), 5786 section = topbar.find('section, .top-bar-section'), 5787 settings = topbar.data(self.attr_name(true) + '-init'), 5788 $movedLi = $this.closest('li.moved'), 5789 $previousLevelUl = $movedLi.parent(); 5790 5791 topbar.data('index', topbar.data('index') - 1); 5792 5793 if (!self.rtl) { 5794 section.css({left: -(100 * topbar.data('index')) + '%'}); 5795 section.find('>.name').css({left: 100 * topbar.data('index') + '%'}); 5796 } else { 5797 section.css({right: -(100 * topbar.data('index')) + '%'}); 5798 section.find('>.name').css({right: 100 * topbar.data('index') + '%'}); 5799 } 5800 5801 if (topbar.data('index') === 0) { 5802 topbar.css('height', ''); 5803 } else { 5804 topbar.css('height', $previousLevelUl.outerHeight(true) + topbar.data('height')); 5805 } 5806 5807 setTimeout(function () { 5808 $movedLi.removeClass('moved'); 5809 }, 300); 5810 }); 5811 5812 // Show dropdown menus when their items are focused 5813 S(this.scope).find('.dropdown a') 5814 .focus(function() { 5815 $(this).parents('.has-dropdown').addClass('hover'); 5816 }) 5817 .blur(function() { 5818 $(this).parents('.has-dropdown').removeClass('hover'); 5819 }); 5820 }, 5821 5822 resize : function () { 5823 var self = this; 5824 self.S('[' + this.attr_name() + ']').each(function () { 5825 var topbar = self.S(this), 5826 settings = topbar.data(self.attr_name(true) + '-init'); 5827 5828 var stickyContainer = topbar.parent('.' + self.settings.sticky_class); 5829 var stickyOffset; 5830 5831 if (!self.breakpoint()) { 5832 var doToggle = topbar.hasClass('expanded'); 5833 topbar 5834 .css('height', '') 5835 .removeClass('expanded') 5836 .find('li') 5837 .removeClass('hover'); 5838 5839 if(doToggle) { 5840 self.toggle(topbar); 5841 } 5842 } 5843 5844 if(self.is_sticky(topbar, stickyContainer, settings)) { 5845 if(stickyContainer.hasClass('fixed')) {
5846 // Remove the fixed to allow for correct calculation of the offset. 5847 stickyContainer.removeClass('fixed'); 5848 5849 stickyOffset = stickyContainer.offset().top; 5850 if(self.S(document.body).hasClass('f-topbar-fixed')) { 5851 stickyOffset -= topbar.data('height'); 5852 } 5853 5854 topbar.data('stickyoffset', stickyOffset); 5855 stickyContainer.addClass('fixed'); 5856 } else { 5857 stickyOffset = stickyContainer.offset().top; 5858 topbar.data('stickyoffset', stickyOffset); 5859 } 5860 } 5861 5862 }); 5863 }, 5864 5865 breakpoint : function () { 5866 return !matchMedia(Foundation.media_queries['topbar']).matches; 5867 }, 5868 5869 small : function () { 5870 return matchMedia(Foundation.media_queries['small']).matches; 5871 }, 5872 5873 medium : function () { 5874 return matchMedia(Foundation.media_queries['medium']).matches; 5875 }, 5876 5877 large : function () { 5878 return matchMedia(Foundation.media_queries['large']).matches; 5879 }, 5880 5881 assemble : function (topbar) { 5882 var self = this, 5883 settings = topbar.data(this.attr_name(true) + '-init'), 5884 section = self.S('section, .top-bar-section', topbar); 5885 5886 // Pull element out of the DOM for manipulation 5887 section.detach(); 5888 5889 self.S('.has-dropdown>a', section).each(function () { 5890 var $link = self.S(this), 5891 $dropdown = $link.siblings('.dropdown'), 5892 url = $link.attr('href'), 5893 $titleLi; 5894 5895 5896 if (!$dropdown.find('.title.back').length) { 5897 5898 if (settings.mobile_show_parent_link == true && url) { 5899 $titleLi = $('<li class="title back js-generated"><h5><a href="javascript:void(0)"></a></h5></li><li class="parent-link show-for-small-only"><a class="parent-link js-generated" href="' + url + '">' + $link.html() +'</a></li>'); 5900 } else { 5901 $titleLi = $('<li class="title back js-generated"><h5><a href="javascript:void(0)"></a></h5>'); 5902 } 5903 5904 // Copy link to subnav 5905 if (settings.custom_back_text == true) { 5906 $('h5>
5906a', $titleLi).html(settings.back_text); 5907 } else { 5908 $('h5>a', $titleLi).html('« ' + $link.html()); 5909 } 5910 $dropdown.prepend($titleLi); 5911 } 5912 }); 5913 5914 // Put element back in the DOM 5915 section.appendTo(topbar); 5916 5917 // check for sticky 5918 this.sticky(); 5919 5920 this.assembled(topbar); 5921 }, 5922 5923 assembled : function (topbar) { 5924 topbar.data(this.attr_name(true), $.extend({}, topbar.data(this.attr_name(true)), {assembled: true})); 5925 }, 5926 5927 height : function (ul) { 5928 var total = 0, 5929 self = this; 5930 5931 $('> li', ul).each(function () { 5932 total += self.S(this).outerHeight(true); 5933 }); 5934 5935 return total; 5936 }, 5937 5938 sticky : function () { 5939 var self = this; 5940 5941 this.S(window).on('scroll', function() { 5942 self.update_sticky_positioning(); 5943 }); 5944 }, 5945 5946 update_sticky_positioning: function() { 5947 var klass = '.' + this.settings.sticky_class, 5948 $window = this.S(window), 5949 self = this; 5950 5951 if (self.settings.sticky_topbar && self.is_sticky(this.settings.sticky_topbar,this.settings.sticky_topbar.parent(), this.settings)) { 5952 var distance = this.settings.sticky_topbar.data('stickyoffset'); 5953 if (!self.S(klass).hasClass('expanded')) { 5954 if ($window.scrollTop() > (distance)) { 5955 if (!self.S(klass).hasClass('fixed')) { 5956 self.S(klass).addClass('fixed'); 5957 self.S('body').addClass('f-topbar-fixed'); 5958 } 5959 } else if ($window.scrollTop() <= distance) { 5960 if (self.S(klass).hasClass('fixed')) { 5961 self.S(klass).removeClass('fixed'); 5962 self.S('body').removeClass('f-topbar-fixed'); 5963 } 5964 } 5965 } 5966 } 5967 }, 5968 5969 off : function () { 5970 this.S(this.scope).off('.fndtn.topbar'); 5971 this.S(window).off('.fndtn.topbar'); 5972 }, 5973 5974 reflow : function () {} 5975 }; 5976}(jQuery, window, window.document));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.