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