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