1(function ($, Drupal) { 2 Drupal.behaviors.geSSOPersonalization = { 3 attach: function (context, settings) { 4 function userDetails(data) {} 5 sso_domain = settings.SSODomain; 6 console.log('sso domain:' + sso_domain); 7 // Retrieve user profile details. 8 function getSSOStatus() { 9 $.ajax({ 10 url: sso_domain + "/kcp/bulk-registration/user/getUserInfo", 11 dataType:"JSON", 12 jsonpCallback:"userDetails", 13 success: function (xml) { 14 userProfile = { 15 ssoid: xml.userId, 16 firstName: xml.firstName, 17 lastName: xml.lastName, 18 email: xml.email, 19 role: xml.role 20 } 21 updatePersonalizationMarkup(userProfile); 22 $('li.logged-out').hide(); 23 $('li.logged-in').show(); 24 showAdminMenuByRole(null); 25 } 26 }); 27 } 28 29 // Change login button and associated menu markup. 30 function updatePersonalizationMarkup(userProfile) { 31 // modify Login block 32 $('<i class="icon-user"></i>').insertBefore('a.user-name'); 33 $('a.user-name').text(userProfile.firstName + ' ' + userProfile.lastName); 34 $('<i class="icon-chevron-down"></i>').insertAfter('a.user-name'); 35 36 // set urls and visibility for sub-menu items 37 $('a.homeUrl').attr('href', lookupLandingPageByRole(userProfile.role)); 38 if (showModifyAccountLink(userProfile.role)) { 39 $('a.modifyUrl').attr('href', sso_domain + '/kcp/modifyProfile.do?method=getUserDetailsPage'); 40 $('a.modifyUrl').show(); 41 $('a.modifyUrl').parent('li').show(); 42 } 43 else { 44 $('a.modifyUrl').attr('href', '#'); 45 $('a.modifyUrl').hide(); 46 $('a.modifyUrl').parent('li').hide(); 47 } 48 $('a.coStatus').attr('href', 'https://estore.watertechnologies.com/customercommunity/services/auth/sso/estore?startURL=/s/orders'); 49 50 // Show/hide SSO Admin Menu based upon SSO role 51 showAdminMenuByRole(userProfile.role); 52 eStoreToggle(userProfile); 53 DocLibraryToggle(userProfile); 54 } 55 56 // Defines homepage URL by user profile role. 57 function lookupLandingPageByRole(role) { 58 switch (role) { 59 case 'GE_Admin': 60 case 'GE_Superuser': 61 case 'GE_Account_Manager': 62 case 'GE_Non_Water': 63 case 'GE_Water': 64 return '/ssl/EmployeeHome.html'; 65 break; 66 case 'Third_Party_Reps': 67 case 'ES_Channel_Admin': 68 case 'ES_Distributors': 69 return '/ssl/DistributorLandingPage.html'; 70 break; 71 case 'CMS_Channel_Admin': 72 case 'CMS_Distributors': 73 return '/ssl/DistributorLandingPageCMS.html'; 74 break; 75 case 'Direct_Customers': 76 case 'AI_Customers': 77 case 'Project_Engineers': 78 return '/ssl/custPortUser.html'; 79 break; 80 case 'Guest': 81 case 'GUEST': 82 return '/kcp/document-library.do'; 83 break; 84 default: 85 return '/kcp/document-library.do'; 86 break; 87 } 88 } 89 90 // Show Admin menu if role is: GE_Admin or GE_Superuser 91 function showAdminMenuByRole(role) { 92 if (role == 'GE_Admin' || role == 'GE_Superuser') { 93 $('#ge-sso-admin-block').show(); 94 } else { 95 $('#ge-sso-admin-block').hide(); 96 } 97 } 98 99 // Defines which user profile roles should be able to access the modify account link. 100 function showModifyAccountLink(role) { 101 switch (role) { 102 case 'Third_Party_Reps': 103 case 'ES_Channel_Admin': 104 case 'ES_Distributors': 105 case 'CMS_Channel_Admin': 106 case 'CMS_Distributors': 107 case 'Direct_Customers': 108 case 'AI_Customers': 109 case 'Project_Engineers': 110 return true; 111 break; 112 default: 113 return false; 114 } 115 } 116 117 function eStoreToggle(userProfile) { 118 if (userProfile.email != null) { 119 $('li.estore a').attr('href','https://estore.watertechnologies.com/services/auth/sso/estore?startURL=/'); 120 } else { 121 $('li.estore a').attr('href','https://estore.watertechnologies.com'); 122 } 123 } 124 125 function DocLibraryToggle(userProfile) { 126 if (userProfile.email != null) { 127 if(userProfile.role != "Suez_Internal"){ 128 $('li a.doc_lib').attr('href','https://my.watertechnologies.com/services/auth/sso/estore?startURL=/WTSCustomerPortal/s'); 129 } 130 } 131 } 132 133 134 // should only fire on login landing pages 135 $(document).ready(function() { 136 $('li.logged-out').show(); 137 $('li.logged-in').hide(); 138 account = settings.accountDetails; 139 getSSOStatus(); 140 /** 141 // anonymous user 142 if (account.isSSOAccount === null && account.authenticated !== true) { 143 getSSOStatus(); 144 console.log("anonymous"); 145 } 146 else if (account.authenticated === true && account.isSSOAccount === null) { 147 // non-sso account or admin logged in 148 $('li.logged-out').hide(); 149 showAdminMenuByRole(null); 150 } 151 else { 152 getSSOStatus(); 153 } 154 */ 155 }); 156 157 } 158 }; 159})(jQuery, Drupal); 160; 161/** 162 * @file 163 * Add functionality to be able to search though one or more kint dumps. 164 */ 165 166(function ($) { 167 'use strict'; 168 Drupal.behaviors.searchKintSearch = { 169 attach: function (context, settings) { 170 171 // Define kint root. 172 var kint = $('.kint:not(".processed")'); 173 174 // Check if there is a kint. 175 if ($(kint).addClass('processed').length > 0) { 176 // Create the search kint form. 177 var form = '<div class="search-kint">'; 178 form += ' <form id="search-kint">'; 179 form += ' <input class="form-text" type="text" name="search-query"/>'; 180 // If there are more than one kint's. 181 if ($(kint).length > 1) { 182 form += ' <select class="form-select" name="search-option">'; 183 form += ' <option value="all">' + Drupal.t('Buscar todo') + '</option>'; 184 // For each kint. 185 $(kint).each(function (i) { 186 i++; 187 form += ' <option value="' + i + '">' + Drupal.t('Search kint') + ' #' + i + '</option>'; 188 }); 189 form += ' </select>'; 190 } 191 form += ' <input class="form-submit" type="submit" value="' + Drupal.t('Submit') + '" name="submit" />'; 192 form += ' </form>'; 193 form += '</div>'; 194 form += '<div class="search-kint-results"></div>'; 195 196 // Insert the form before the first kint. 197 kint.eq(0).before(form); 198 } 199 200 // On submit execute the following. 201 $('form#search-kint').submit(function (e) { 202 // Remove result and classes from previous query. 203 $('.kint-query-result').removeClass('kint-query-result'); 204 $('.kint-parent.kint-show').removeClass('kint-show'); 205 var $search_kint_result = $('.search-kint-results'); 206 $search_kint_result.html(''); 207 208 // Get query value and option value as variables. 209 var query = $('input[name=search-query]', this).val(); 210 var option = $('select[name=search-option]', this).val(); 211 212 // If the query is not empty, we can proceed. 213 if (query) { 214 var search_kint; 215 // Check if we're just trying to look through a single kint. 216 if (option && option !== 'all') { 217 search_kint = $('.kint').eq(option - 1); 218 } 219 else { 220 // Let's search through all of them! 221 search_kint = $('.kint'); 222 } 223 224 // Find all elements with the query. 225 var count = 0; 226 $('dt:contains(' + query + ')', search_kint).each(function () { 227 count++; 228 229 // Add result class. 230 $(this).parent().addClass('kint-query-result'); 231 232 // Expand parents until the query result is layered open before the user. 233 $(this).parentsUntil('.kint', 'dd').prev().addClass('kint-show'); 234 235 }); 236 // Show result overview. 237 $search_kint_result.html(Drupal.formatPlural(count, 'Found 1 element', 'Found @count elements')); 238 } 239 else { 240 $search_kint_result.html(Drupal.t('Empty query')); 241 } 242 243 // Prevent the form from being submitted. 244 e.preventDefault(); 245 }); 246 247 } 248 }; 249})(jQuery); 250; 251/** 252 * @file 253 * Adds functionality to copy path to a specific part of the array / object. 254 */ 255 256(function ($) { 257 'use strict'; 258 Drupal.behaviors.searchKintTrail = { 259 attach: function (context, settings) { 260 261 var first = true; 262 $('.kint dt', context).once('trail').each(function () { 263 264 if (first) { 265 first = false;
266 return true; 267 } 268 269 $(this).append('<span class="kint-get-path"><a href="#">' + Drupal.t('Get path') + '</a></span>'); 270 }); 271 272 $('.kint-get-path a').once().click(function (e) { 273 e.preventDefault(); 274 275 var pathItems = []; 276 buildPath($(this).parents('dl').first(), pathItems); 277 pathItems.reverse(); 278 279 var path = '$var'; 280 $.each(pathItems, function (index, item) { 281 if (item.label === '$args') { 282 return true; 283 } 284 var prevItem = pathItems[index - 1]; 285 if (prevItem.type === 'array') { 286 path += '[' + item.label + ']'; 287 } 288 else if (prevItem.type.substring(0, 7) === 'object ') { 289 path += '->' + item.label; 290 } 291 }); 292 293 $(this).addClass('hidden'); 294 $(this).after('<input id="kint-path-value" type="text" value="' + path + '" />'); 295 $('#kint-path-value').select().blur(function () { 296 $(this).remove(); 297 $('.kint-get-path a.hidden').removeClass('hidden'); 298 }); 299 300 }); 301 302 function buildPath($current, pathItems) { 303 if (!$current.length) { 304 return; 305 } 306 var label = $current.find('> dt dfn').text().trim(); 307 308 // If uppermost dl set label to $args so it gets included. 309 if (!$current.parents('dl').length) { 310 label = '$args'; 311 } 312 313 if (label.length) { 314 pathItems.push({ 315 type: $current.find('> dt var').text(), 316 index: $current.index(), 317 label: label 318 }); 319 } 320 buildPath($current.parents('dl').first(), pathItems); 321 322 } 323 324 } 325 }; 326})(jQuery); 327; 328(function ($, Drupal) { 329 330 'use strict' 331 332 Drupal.behaviors.simplePopupBlocks = { 333 attach: function (context, settings) { 334 // Global variables 335 var popup_settings = drupalSettings.simple_popup_blocks.settings, 336 _html = document.documentElement, windowWidth = $(window).width(); 337 338 $.each(popup_settings, function (index, values) { 339 340 // No popup when the window width is less than the trigger width. 341 if (windowWidth < values.trigger_width) {return null;}; 342 343 // Declaring variable inside foreach - so it will not global. 344 var modal_class = '', 345 block_id = values.identifier, 346 visit_counts_arr = values.visit_counts.split(','), 347 allow_cookie = true, 348 read_cookie = '', 349 cookie_val = 1, 350 cookie_days = values.cookie_expiry || 100, 351 match = 0, 352 css_identity = '', 353 spb_popup_id = '', 354 modal_close_class = '', 355 modal_minimize_class = '', 356 modal_minimized_class = '', 357 layout_class = '', 358 class_exists = false, 359 delays = '', 360 browser_close_trigger = true, 361 use_time_frequency = values.use_time_frequency, 362 time_frequency = values.time_frequency, 363 time_frequency_cookie = 0, 364 next_popup = 0, 365 current_timestamp = 0, 366 show_minimized_button = values.show_minimized_button, 367 show_model = true 368 // Always show popup, so prevent from creating cookie 369 if (visit_counts_arr.length == 1 && visit_counts_arr[0] == 0 && use_time_frequency == 0) { 370 allow_cookie = false 371 } 372 // Check to see if the block exists in the current page. 373 var element = document.getElementById(block_id); 374 if (typeof(element) != 'undefined' && element != null) { 375 // Creating cookie 376 if (allow_cookie == true) { 377 if (use_time_frequency == 0) { 378 read_cookie = readCookie('spb_' + block_id) 379 if (read_cookie) { 380 cookie_val = + read_cookie + 1 381 createCookie('spb_' + block_id, cookie_val, 100) 382 } 383 else { 384 createCookie('spb_' + block_id, cookie_val, 100) 385 } 386 // Match cookie 387 cookie_val = cookie_val.toString() 388 match = $.inArray(cookie_val, visit_counts_arr) 389 390 if (match === -1) { 391 show_model = false 392 } 393 } 394 else { 395 time_frequency_cookie = readCookie('spb_time' + block_id) 396 current_timestamp = Math.floor(Date.now() / 1000) 397 next_popup = current_timestamp + parseInt(time_frequency, 10) 398 399 if (time_frequency_cookie) { 400 // If current_timestamp is greater than cookie time show the popup. 401 if (current_timestamp >= time_frequency_cookie) { 402 match = 1 403 }
404 // This should allow the time frequency to be adjusted down after 405 // the cookie has been set. 406 else if (next_popup <= time_frequency_cookie) { 407 match = 1 408 } 409 else { 410 match = -1 411 show_model = false 412 } 413 414 // Create new cookie for popup. 415 if (match === 1) { 416 createCookie('spb_time' + block_id, next_popup, 100) 417 } 418 } 419 else { 420 createCookie('spb_time' + block_id, next_popup, 100) 421 } 422 } 423 } 424 425 } 426 // Set css selector 427 css_identity = '.' 428 if (values.css_selector == 1) { 429 css_identity = '#' 430 } 431 432 // Assign dynamic css classes 433 spb_popup_id = 'spb-' + block_id 434 modal_class = block_id + '-modal' 435 modal_close_class = block_id + '-modal-close' 436 modal_minimize_class = block_id + '-modal-minimize' 437 modal_minimized_class = block_id + '-modal-minimized' 438 layout_class = '.' + modal_class + ' .spb-popup-main-wrapper' 439 // Wrap arround elements 440 $(css_identity + block_id).once(). 441 wrap($('<div class="' + modal_class + '"></div>')) 442 // Hide the popup initially 443 $('.' + modal_class).once().hide() 444 445 // Wrap remaining elements 446 if ($(css_identity + block_id).closest('.spb-popup-main-wrapper').length) { 447 return; 448 } 449 $(css_identity + block_id). 450 wrap($('<div class="spb-popup-main-wrapper"></div>')) 451 $('.' + modal_class). 452 wrap('<div id="' + spb_popup_id + 453 '" class="simple-popup-blocks-global"></div>') 454 $(css_identity + block_id). 455 before($('<div class="spb-controls"></div>')) 456 457 // Skip code for non popup pages. 458 class_exists = $('#' + spb_popup_id). 459 hasClass('simple-popup-blocks-global') 460 if (!class_exists) { 461 return true 462 } 463 // Minimize button wrap 464 if (values.minimize === "1") { 465 $("#"+spb_popup_id + " .spb-controls"). 466 prepend($('<span class="' + modal_minimize_class + 467 ' spb_minimize">-</span>')) 468 $('.' + modal_class). 469 before($('<span class="' + modal_minimized_class + 470 ' spb_minimized"></span>')) 471 } 472 // Close button wrap 473 if (values.close == 1) { 474 $("#"+spb_popup_id + " .spb-controls"). 475 prepend($('<span class="' + modal_close_class + 476 ' spb_close">Ã</span>')) 477 } 478 // Overlay 479 if (values.overlay == 1) { 480 $('.' + modal_class).addClass('spb_overlay') 481 } 482 // Inject layout class. 483 switch (values.layout) { 484 // Top left. 485 case '0': 486 $(layout_class).addClass('spb_top_left') 487 $(layout_class).css({ 488 'width': values.width, 489 }) 490 break 491 // Top right. 492 case '1': 493 $(layout_class).addClass('spb_top_right') 494 $(layout_class).css({ 495 'width': values.width, 496 }) 497 break 498 // Bottom left. 499 case '2': 500 $(layout_class).addClass('spb_bottom_left') 501 $(layout_class).css({ 502 'width': values.width, 503 }) 504 break 505 // Bottom right. 506 case '3': 507 $(layout_class).addClass('spb_bottom_right') 508 $(layout_class).css({ 509 'width': values.width, 510 }) 511 break 512 // Center. 513 case '4': 514 $(layout_class).addClass('spb_center') 515 $(layout_class).css({ 516 'width': values.width, 517 'margin-left': -values.width / 2 518 }) 519 break 520 // Top Center. 521 case '5': 522 $(layout_class).addClass('spb_top_center') 523 $(layout_class).css({ 524 'width': values.width, 525 }) 526 break 527 // Top bar. 528 case '6': 529 $(layout_class).addClass('spb_top_bar') 530 $(layout_class).css({}) 531 break 532 // Right bar. 533 case '7': 534 $(layout_class).addClass('spb_bottom_bar') 535 $(layout_class).css({}) 536 break 537 // Bottom bar. 538 case '8': 539 $(layout_class).addClass('spb_left_bar') 540 $(layout_class).css({ 541 'width': values.width, 542 }) 543 break 544 // Right bar. 545 case '9': 546 $(layout_class).addClass('spb_right_bar') 547 $(layout_class).css({ 548 'width': values.width, 549 }) 550 break 551 } 552 if (show_model === true) { 553 // Automatic trigger with delay 554 if (values.trigger_method == 0 && values.delay > 0) { 555 delays = values.delay * 1000 556 $('.' + modal_class).delay(delays).fadeIn('slow')
557 if (values.overlay == 1) { 558 setTimeout(stopTheScroll, delays) 559 } 560 } 561 // Automatic trigger without delay 562 else if (values.trigger_method == 0) { 563 $('.' + modal_class).show() 564 $(css_identity + block_id).show() 565 if (values.overlay == 1) { 566 stopTheScroll() 567 } 568 } 569 // Manual trigger 570 else if (values.trigger_method == 1) { 571 $(document).on('click', values.trigger_selector, function (e) { 572 $('.' + modal_class).show() 573 $(css_identity + block_id).show() 574 if (values.overlay == 1) { 575 stopTheScroll() 576 } 577 return false; 578 }) 579 } 580 // Browser close trigger 581 else if (values.trigger_method == 2) { 582 $(_html).mouseleave(function (e) { 583 // Trigger only when mouse leave on top view port 584 if (e.clientY > 20) { return } 585 // Trigger only once per page 586 if (!browser_close_trigger) { return } 587 browser_close_trigger = false 588 $('.' + modal_class).show() 589 $(css_identity + block_id).show() 590 if (values.overlay == 1) { 591 stopTheScroll() 592 } 593 }) 594 } 595 } 596 597 // Trigger for close button click 598 $('.' + modal_close_class).click(function () { 599 $('.' + modal_class).hide() 600 startTheScroll() 601 }) 602 // Trigger for minimize button click 603 $('.' + modal_minimize_class).click(function () { 604 $('.' + modal_class).hide() 605 startTheScroll() 606 $('.' + modal_minimized_class).show() 607 }) 608 // Trigger for minimized button click 609 $('.' + modal_minimized_class).click(function () { 610 $('.' + modal_class).show() 611 $(css_identity + block_id).show() 612 if (values.overlay == 1) { 613 stopTheScroll() 614 } 615 616 // Hide the minimized button. 617 if (show_minimized_button == 0) { 618 $('.' + modal_minimized_class).hide() 619 } 620 621 }) 622 // Trigger for ESC button click 623 if (values.enable_escape == 1) { 624 $(document).keyup(function (e) { 625 if (e.keyCode == 27) { // Escape key maps to keycode `27`. 626 $('.' + modal_class).hide() 627 startTheScroll() 628 $('.' + modal_minimized_class).show() 629 } 630 }) 631 } 632 633 // Hide the minimized button. 634 if (show_minimized_button == 0) { 635 $('.' + modal_minimized_class).hide() 636 } 637 638 }) // Foreach end. 639 } 640 } // document.ready end. 641 642 // Remove the scrolling while overlay active 643 function stopTheScroll () { 644 $('body').css({ 645 'overflow': 'hidden', 646 }); 647 648 $('input:text').focus(); 649 } 650 651 // Enable the scrolling while overlay inactive 652 function startTheScroll () { 653 $('body').css({ 654 'overflow': '', 655 }) 656 } 657 658 // Creating cookie 659 function createCookie (name, value, days) { 660 if (days > 0) { 661 var date = new Date() 662 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)) 663 var expires = '; expires=' + date.toGMTString() 664 } 665 else { 666 var expires = '' 667 } 668 document.cookie = name + '=' + value + expires + '; path=/' 669 } 670 671 // Reading cookie 672 function readCookie (name) { 673 var nameEQ = name + '=' 674 var ca = document.cookie.split(';') 675 for (var i = 0; i < ca.length; i++) { 676 var c = ca[i] 677 while (c.charAt(0) == ' ') { 678 c = c.substring(1, c.length) 679 } 680 if (c.indexOf(nameEQ) == 0) { 681 return c.substring(nameEQ.length, c.length) 682 } 683 } 684 return null 685 } 686 687})(jQuery, Drupal) 688; 689/*! flip - v1.1.2 - 2016-10-20 690* https://github.com/nnattawat/flip 691* Copyright (c) 2016 Nattawat Nonsung; Licensed MIT */ 692 693!function(a){var b=function(){var a,b=document.createElement("fakeelement"),c={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(a in c)if(void 0!==b.style[a])return c[a]},c=function(b,c,d){this.setting={axis:"y",reverse:!1,trigger:"click",
693speed:500,forceHeight:!1,forceWidth:!1,autoSize:!0,front:".front",back:".back"},this.setting=a.extend(this.setting,c),"string"!=typeof c.axis||"x"!==c.axis.toLowerCase()&&"y"!==c.axis.toLowerCase()||(this.setting.axis=c.axis.toLowerCase()),"boolean"==typeof c.reverse&&(this.setting.reverse=c.reverse),"string"==typeof c.trigger&&(this.setting.trigger=c.trigger.toLowerCase());var e=parseInt(c.speed);isNaN(e)||(this.setting.speed=e),"boolean"==typeof c.forceHeight&&(this.setting.forceHeight=c.forceHeight),"boolean"==typeof c.forceWidth&&(this.setting.forceWidth=c.forceWidth),"boolean"==typeof c.autoSize&&(this.setting.autoSize=c.autoSize),("string"==typeof c.front||c.front instanceof a)&&(this.setting.front=c.front),("string"==typeof c.back||c.back instanceof a)&&(this.setting.back=c.back),this.element=b,this.frontElement=this.getFrontElement(),this.backElement=this.getBackElement(),this.isFlipped=!1,this.init(d)};a.extend(c.prototype,{flipDone:function(a){var c=this;c.element.one(b(),function(){c.element.trigger("flip:done"),"function"==typeof a&&a.call(c.element)})},flip:function(a){if(!this.isFlipped){this.isFlipped=!0;var b="rotate"+this.setting.axis;this.frontElement.css({transform:b+(this.setting.reverse?"(-180deg)":"(180deg)"),"z-index":"0"}),this.backElement.css({transform:b+"(0deg)","z-index":"1"}),this.flipDone(a)}},unflip:function(a){if(this.isFlipped){this.isFlipped=!1;var b="rotate"+this.setting.axis;this.frontElement.css({transform:b+"(0deg)","z-index":"1"}),this.backElement.css({transform:b+(this.setting.reverse?"(180deg)":"(-180deg)"),"z-index":"0"}),this.flipDone(a)}},getFrontElement:function(){return this.setting.front instanceof a?this.setting.front:this.element.find(this.setting.front)},getBackElement:function(){return this.setting.back instanceof a?this.setting.back:this.element.find(this.setting.back)},init:function(a){var b=this,c=b.frontElement.add(b.backElement),d="rotate"+b.setting.axis,e=2*b.element["outer"+("rotatex"===d?"Height":"Width")](),f={perspective:e,position:"relative"},g={transform:d+"("+(b.setting.reverse?"180deg":"-180deg")+")","z-index":"0",position:"relative"},h={"backface-visibility":"hidden","transform-style":"preserve-3d",position:"absolute","z-index":"1"};b.setting.forceHeight?c.outerHeight(b.element.height()):b.setting.autoSize&&(h.height="100%"),b.setting.forceWidth?c.outerWidth(b.element.width()):b.setting.autoSize&&(h.width="100%"),(window.chrome||window.Intl&&Intl.v8BreakIterator)&&"CSS"in window&&(f["-webkit-transform-style"]="preserve-3d"),c.css(h).find("*").css({"backface-visibility":"hidden"}),b.element.css(f),b.backElement.css(g),setTimeout(function(){var d=b.setting.speed/1e3||.5;c.css({transition:"all "+d+"s ease-out"}),"function"==typeof a&&a.call(b.element)},20),b.attachEvents()},clickHandler:function(b){b||(b=window.event),this.element.find(a(b.target).closest('button, a, input[type="submit"]')).length||(this.isFlipped?this.unflip():this.flip())},hoverHandler:function(){var b=this;b.element.off("mouseleave.flip"),b.flip(),setTimeout(function(){b.element.on("mouseleave.flip",a.proxy(b.unflip,b)),b.element.is(":hover")||b.unflip()},b.setting.speed+150)},attachEvents:function(){var b=this;"click"===b.setting.trigger?b.element.on(a.fn.tap?"tap.flip":"click.flip",a.proxy(b.clickHandler,b)):"hover"===b.setting.trigger&&(b.element.on("mouseenter.flip",a.proxy(b.hoverHandler,b)),b.element.on("mouseleave.flip",a.proxy(b.unflip,b)))},flipChanged:function(a){this.element.trigger("flip:change"),"function"==typeof a&&a.call(this.element)},changeSettings:function(a,b){var c=this,d=!1;if(void 0!==a.axis&&c.setting.axis!==a.axis.toLowerCase()&&(c.setting.axis=a.axis.toLowerCase(),d=!0),void 0!==a.reverse&&c.setting.reverse!==a.reverse&&(c.setting.reverse=a.reverse,d=!0),d){var e=c.frontElement.add(c.backElement),f=e.css(["transition-property","transition-timing-function","transition-duration","transition-delay"]);e.css({transition:"none"});var g="rotate"+c.setting.axis;c.isFlipped?c.frontElement.css({transform:g+(c.setting.reverse?"(-180deg)":"(180deg)"),"z-index":"0"}):c.backElement.css({transform:g+(c.setting.reverse?"(180deg)":"(-180deg)"),"z-index":"0"}
693),setTimeout(function(){e.css(f),c.flipChanged(b)},0)}else c.flipChanged(b)}}),a.fn.flip=function(b,d){return"function"==typeof b&&(d=b),"string"==typeof b||"boolean"==typeof b?this.each(function(){var c=a(this).data("flip-model");"toggle"===b&&(b=!c.isFlipped),b?c.flip(d):c.unflip(d)}):this.each(function(){if(a(this).data("flip-model")){var e=a(this).data("flip-model");!b||void 0===b.axis&&void 0===b.reverse||e.changeSettings(b,d)}else a(this).data("flip-model",new c(a(this),b||{},d))}),this}}(jQuery); 694 695!function ($) { 696 697 "use strict"; 698 699 var FOUNDATION_VERSION = '6.2.0'; 700 701 // Global Foundation object 702 // This is attached to the window, or used as a module for AMD/Browserify 703 var Foundation = { 704 version: FOUNDATION_VERSION, 705 706 /** 707 * Stores initialized plugins. 708 */ 709 _plugins: {}, 710 711 /** 712 * Stores generated unique ids for plugin instances 713 */ 714 _uuids: [], 715 716 /** 717 * Returns a boolean for RTL support 718 */ 719 rtl: function () { 720 return $('html').attr('dir') === 'rtl'; 721 }, 722 /** 723 * Defines a Foundation plugin, adding it to the `Foundation` namespace and the list of plugins to initialize when reflowing. 724 * @param {Object} plugin - The constructor of the plugin. 725 */ 726 plugin: function (plugin, name) { 727 // Object key to use when adding to global Foundation object 728 // Examples: Foundation.Reveal, Foundation.OffCanvas 729 var className = name || functionName(plugin); 730 // Object key to use when storing the plugin, also used to create the identifying data attribute for the plugin 731 // Examples: data-reveal, data-off-canvas 732 var attrName = hyphenate(className); 733 734 // Add to the Foundation object and the plugins list (for reflowing) 735 this._plugins[attrName] = this[className] = plugin; 736 }, 737 /** 738 * @function 739 * Populates the _uuids array with pointers to each individual plugin instance. 740 * Adds the `zfPlugin` data-attribute to programmatically created plugins to allow use of $(selector).foundation(method) calls. 741 * Also fires the initialization event for each plugin, consolidating repeditive code. 742 * @param {Object} plugin - an instance of a plugin, usually `this` in context. 743 * @param {String} name - the name of the plugin, passed as a camelCased string. 744 * @fires Plugin#init 745 */ 746 registerPlugin: function (plugin, name) { 747 var pluginName = name ? hyphenate(name) : functionName(plugin.constructor).toLowerCase(); 748 plugin.uuid = this.GetYoDigits(6, pluginName); 749 750 if (!plugin.$element.attr('data-' + pluginName)) { 751 plugin.$element.attr('data-' + pluginName, plugin.uuid); 752 } 753 if (!plugin.$element.data('zfPlugin')) { 754 plugin.$element.data('zfPlugin', plugin); 755 } 756 /** 757 * Fires when the plugin has initialized. 758 * @event Plugin#init 759 */ 760 plugin.$element.trigger('init.zf.' + pluginName); 761 762 this._uuids.push(plugin.uuid); 763 764 return; 765 }, 766 /** 767 * @function 768 * Removes the plugins uuid from the _uuids array. 769 * Removes the zfPlugin data attribute, as well as the data-plugin-name attribute. 770 * Also fires the destroyed event for the plugin, consolidating repeditive code. 771 * @param {Object} plugin - an instance of a plugin, usually `this` in context. 772 * @fires Plugin#destroyed 773 */ 774 unregisterPlugin: function (plugin) { 775 var pluginName = hyphenate(functionName(plugin.$element.data('zfPlugin').constructor)); 776 777 this._uuids.splice(this._uuids.indexOf(plugin.uuid), 1); 778 plugin.$element.removeAttr('data-' + pluginName).removeData('zfPlugin') 779 /** 780 * Fires when the plugin has been destroyed. 781 * @event Plugin#destroyed 782 */ 783 .trigger('destroyed.zf.' + pluginName); 784 for (var prop in plugin) { 785 plugin[prop] = null; //clean up script to prep for garbage collection. 786 } 787 return; 788 }, 789 790 /** 791 * @function 792 * Causes one or more active plugins to re-initialize, resetting event listeners, recalculating positions, etc. 793 * @param {String} plugins - optional string of an individual plugin key, attained by calling `$(element).data('pluginName')`, or string of a plugin class i.e. `'dropdown'` 794 * @default If no argument is passed, reflow all currently active plugins. 795 */ 796 reInit: function (plugins) { 797 var isJQ = plugins instanceof $;
798 try { 799 if (isJQ) { 800 plugins.each(function () { 801 $(this).data('zfPlugin')._init(); 802 }); 803 } else { 804 var type = typeof plugins, 805 _this = this, 806 fns = { 807 'object': function (plgs) { 808 plgs.forEach(function (p) { 809 p = hyphenate(p); 810 $('[data-' + p + ']').foundation('_init'); 811 }); 812 }, 813 'string': function () { 814 plugins = hyphenate(plugins); 815 $('[data-' + plugins + ']').foundation('_init'); 816 }, 817 'undefined': function () { 818 this['object'](Object.keys(_this._plugins)); 819 } 820 }; 821 fns[type](plugins); 822 } 823 } catch (err) { 824 console.error(err); 825 } finally { 826 return plugins; 827 } 828 }, 829 830 /** 831 * returns a random base-36 uid with namespacing 832 * @function 833 * @param {Number} length - number of random base-36 digits desired. Increase for more random strings. 834 * @param {String} namespace - name of plugin to be incorporated in uid, optional. 835 * @default {String} '' - if no plugin name is provided, nothing is appended to the uid. 836 * @returns {String} - unique id 837 */ 838 GetYoDigits: function (length, namespace) { 839 length = length || 6; 840 return Math.round(Math.pow(36, length + 1) - Math.random() * Math.pow(36, length)).toString(36).slice(1) + (namespace ? '-' + namespace : ''); 841 }, 842 /** 843 * Initialize plugins on any elements within `elem` (and `elem` itself) that aren't already initialized. 844 * @param {Object} elem - jQuery object containing the element to check inside. Also checks the element itself, unless it's the `document` object. 845 * @param {String|Array} plugins - A list of plugins to initialize. Leave this out to initialize everything. 846 */ 847 reflow: function (elem, plugins) { 848 849 // If plugins is undefined, just grab everything 850 if (typeof plugins === 'undefined') { 851 plugins = Object.keys(this._plugins); 852 } 853 // If plugins is a string, convert it to an array with one item 854 else if (typeof plugins === 'string') { 855 plugins = [plugins]; 856 } 857 858 var _this = this; 859 860 // Iterate through each plugin 861 $.each(plugins, function (i, name) { 862 // Get the current plugin 863 var plugin = _this._plugins[name]; 864 865 // Localize the search to all elements inside elem, as well as elem itself, unless elem === document 866 var $elem = $(elem).find('[data-' + name + ']').addBack('[data-' + name + ']'); 867 868 // For each plugin found, initialize it 869 $elem.each(function () { 870 var $el = $(this), 871 opts = {}; 872 // Don't double-dip on plugins 873 if ($el.data('zfPlugin')) { 874 console.warn("Tried to initialize " + name + " on an element that already has a Foundation plugin."); 875 return; 876 } 877 878 if ($el.attr('data-options')) { 879 var thing = $el.attr('data-options').split(';').forEach(function (e, i) { 880 var opt = e.split(':').map(function (el) { 881 return el.trim(); 882 }); 883 if (opt[0]) opts[opt[0]] = parseValue(opt[1]); 884 }); 885 } 886 try { 887 $el.data('zfPlugin', new plugin($(this), opts)); 888 } catch (er) { 889 console.error(er); 890 } finally { 891 return; 892 } 893 }); 894 }); 895 }, 896 getFnName: functionName, 897 transitionend: function ($elem) { 898 var transitions = { 899 'transition': 'transitionend', 900 'WebkitTransition': 'webkitTransitionEnd', 901 'MozTransition': 'transitionend', 902 'OTransition': 'otransitionend' 903 }; 904 var elem = document.createElement('div'), 905 end; 906 907 for (var t in transitions) { 908 if (typeof elem.style[t] !== 'undefined') { 909 end = transitions[t]; 910 } 911 } 912 if (end) { 913 return end; 914 } else { 915 end = setTimeout(function () { 916 $elem.triggerHandler('transitionend', [$elem]); 917 }, 1); 918 return 'transitionend'; 919 } 920 } 921 }; 922 923 Foundation.util = { 924 /** 925 * Function for applying a debounce effect to a function call. 926 * @function 927 * @param {Function} func - Function to be called at end of timeout. 928 * @param {Number} delay - Time in ms to delay the call of `func`. 929 * @returns function 930 */ 931 throttle: function (func, delay) { 932 var timer = null; 933 934 return function () { 935 var context = this, 936 args = arguments; 937 938 if (timer === null) { 939 timer = setTimeout(function () {
940 func.apply(context, args); 941 timer = null; 942 }, delay); 943 } 944 }; 945 } 946 }; 947 948 // TODO: consider not making this a jQuery function 949 // TODO: need way to reflow vs. re-initialize 950 /** 951 * The Foundation jQuery method. 952 * @param {String|Array} method - An action to perform on the current jQuery object. 953 */ 954 var foundation = function (method) { 955 var type = typeof method, 956 $meta = $('meta.foundation-mq'), 957 $noJS = $('.no-js'); 958 959 if (!$meta.length) { 960 $('<meta class="foundation-mq">').appendTo(document.head); 961 } 962 if ($noJS.length) { 963 $noJS.removeClass('no-js'); 964 } 965 966 if (type === 'undefined') { 967 //needs to initialize the Foundation object, or an individual plugin. 968 Foundation.MediaQuery._init(); 969 Foundation.reflow(this); 970 } else if (type === 'string') { 971 //an individual method to invoke on a plugin or group of plugins 972 var args = Array.prototype.slice.call(arguments, 1); //collect all the arguments, if necessary 973 var plugClass = this.data('zfPlugin'); //determine the class of plugin 974 975 if (plugClass !== undefined && plugClass[method] !== undefined) { 976 //make sure both the class and method exist 977 if (this.length === 1) { 978 //if there's only one, call it directly. 979 plugClass[method].apply(plugClass, args); 980 } else { 981 this.each(function (i, el) { 982 //otherwise loop through the jQuery collection and invoke the method on each 983 plugClass[method].apply($(el).data('zfPlugin'), args); 984 }); 985 } 986 } else { 987 //error for no class or no method 988 throw new ReferenceError("We're sorry, '" + method + "' is not an available method for " + (plugClass ? functionName(plugClass) : 'this element') + '.'); 989 } 990 } else { 991 //error for invalid argument type 992 throw new TypeError('We\'re sorry, ' + type + ' is not a valid parameter. You must use a string representing the method you wish to invoke.'); 993 } 994 return this; 995 }; 996 997 window.Foundation = Foundation; 998 $.fn.foundation = foundation; 999 1000 // Polyfill for requestAnimationFrame 1001 (function () { 1002 if (!Date.now || !window.Date.now) window.Date.now = Date.now = function () { 1003 return new Date().getTime(); 1004 }; 1005 1006 var vendors = ['webkit', 'moz']; 1007 for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) { 1008 var vp = vendors[i]; 1009 window.requestAnimationFrame = window[vp + 'RequestAnimationFrame']; 1010 window.cancelAnimationFrame = window[vp + 'CancelAnimationFrame'] || window[vp + 'CancelRequestAnimationFrame']; 1011 } 1012 if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) || !window.requestAnimationFrame || !window.cancelAnimationFrame) { 1013 var lastTime = 0; 1014 window.requestAnimationFrame = function (callback) { 1015 var now = Date.now(); 1016 var nextTime = Math.max(lastTime + 16, now); 1017 return setTimeout(function () { 1018 callback(lastTime = nextTime); 1019 }, nextTime - now); 1020 }; 1021 window.cancelAnimationFrame = clearTimeout; 1022 } 1023 /** 1024 * Polyfill for performance.now, required by rAF 1025 */ 1026 if (!window.performance || !window.performance.now) { 1027 window.performance = { 1028 start: Date.now(), 1029 now: function () { 1030 return Date.now() - this.start; 1031 } 1032 }; 1033 } 1034 })(); 1035 if (!Function.prototype.bind) { 1036 Function.prototype.bind = function (oThis) { 1037 if (typeof this !== 'function') { 1038 // closest thing possible to the ECMAScript 5 1039 // internal IsCallable function 1040 throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); 1041 } 1042 1043 var aArgs = Array.prototype.slice.call(arguments, 1), 1044 fToBind = this, 1045 fNOP = function () {}, 1046 fBound = function () { 1047 return fToBind.apply(this instanceof fNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); 1048 }; 1049 1050 if (this.prototype) { 1051 // native functions don't have a prototype 1052 fNOP.prototype = this.prototype; 1053 } 1054 fBound.prototype = new fNOP(); 1055 1056 return fBound; 1057 }; 1058 } 1059 // Polyfill to get the name of a function in IE9 1060 function functionName(fn) { 1061 if (Function.prototype.name === undefined) { 1062 var funcNameRegex = /function\s([^(]{1,})\(/; 1063 var results = funcNameRegex.exec(fn.toString()); 1064 return results && results.length > 1 ? results[1].trim() : ""; 1065 } else if (fn.prototype === undefined) { 1066 return fn.constructor.name; 1067 } else { 1068 return fn.prototype.constructor.name; 1069 } 1070 } 1071 function parseValue(str) { 1072 if (/true/.test(str)) return true;else if (/false/.test(str)) return false;else if (!isNaN(str * 1)) return parseFloat(str); 1073 return str; 1074 } 1075 // Convert PascalCase to kebab-case 1076 // Thank you: http://stackoverflow.com/a/8955580 1077 function hyphenate(str) { 1078 return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); 1079 } 1080}(jQuery); 1081'use strict'; 1082 1083!function ($) { 1084 1085 Foundation.Box = { 1086 ImNotTouchingYou: ImNotTouchingYou, 1087 GetDimensions: GetDimensions, 1088 GetOffsets: GetOffsets 1089 }; 1090 1091 /** 1092 * Compares the dimensions of an element to a container and determines collision events with container. 1093 * @function 1094 * @param {jQuery} element - jQuery object to test for collisions. 1095 * @param {jQuery}
1095 parent - jQuery object to use as bounding container. 1096 * @param {Boolean} lrOnly - set to true to check left and right values only. 1097 * @param {Boolean} tbOnly - set to true to check top and bottom values only. 1098 * @default if no parent object passed, detects collisions with `window`. 1099 * @returns {Boolean} - true if collision free, false if a collision in any direction. 1100 */ 1101 function ImNotTouchingYou(element, parent, lrOnly, tbOnly) { 1102 var eleDims = GetDimensions(element), 1103 top, 1104 bottom, 1105 left, 1106 right; 1107 1108 if (parent) { 1109 var parDims = GetDimensions(parent); 1110 1111 bottom = eleDims.offset.top + eleDims.height <= parDims.height + parDims.offset.top; 1112 top = eleDims.offset.top >= parDims.offset.top; 1113 left = eleDims.offset.left >= parDims.offset.left; 1114 right = eleDims.offset.left + eleDims.width <= parDims.width; 1115 } else { 1116 bottom = eleDims.offset.top + eleDims.height <= eleDims.windowDims.height + eleDims.windowDims.offset.top; 1117 top = eleDims.offset.top >= eleDims.windowDims.offset.top; 1118 left = eleDims.offset.left >= eleDims.windowDims.offset.left; 1119 right = eleDims.offset.left + eleDims.width <= eleDims.windowDims.width; 1120 } 1121 1122 var allDirs = [bottom, top, left, right]; 1123 1124 if (lrOnly) { 1125 return left === right === true; 1126 } 1127 1128 if (tbOnly) { 1129 return top === bottom === true; 1130 } 1131 1132 return allDirs.indexOf(false) === -1; 1133 }; 1134 1135 /** 1136 * Uses native methods to return an object of dimension values. 1137 * @function 1138 * @param {jQuery || HTML} element - jQuery object or DOM element for which to get the dimensions. Can be any element other that document or window. 1139 * @returns {Object} - nested object of integer pixel values 1140 * TODO - if element is window, return only those values. 1141 */ 1142 function GetDimensions(elem, test) { 1143 elem = elem.length ? elem[0] : elem; 1144 1145 if (elem === window || elem === document) { 1146 throw new Error("I'm sorry, Dave. I'm afraid I can't do that."); 1147 } 1148 1149 var rect = elem.getBoundingClientRect(), 1150 parRect = elem.parentNode.getBoundingClientRect(), 1151 winRect = document.body.getBoundingClientRect(), 1152 winY = window.pageYOffset, 1153 winX = window.pageXOffset; 1154 1155 return { 1156 width: rect.width, 1157 height: rect.height, 1158 offset: { 1159 top: rect.top + winY, 1160 left: rect.left + winX 1161 }, 1162 parentDims: { 1163 width: parRect.width, 1164 height: parRect.height, 1165 offset: { 1166 top: parRect.top + winY, 1167 left: parRect.left + winX 1168 } 1169 }, 1170 windowDims: { 1171 width: winRect.width, 1172 height: winRect.height, 1173 offset: { 1174 top: winY, 1175 left: winX 1176 } 1177 } 1178 }; 1179 } 1180 1181 /** 1182 * Returns an object of top and left integer pixel values for dynamically rendered elements, 1183 * such as: Tooltip, Reveal, and Dropdown 1184 * @function 1185 * @param {jQuery} element - jQuery object for the element being positioned. 1186 * @param {jQuery} anchor - jQuery object for the element's anchor point. 1187 * @param {String} position - a string relating to the desired position of the element, relative to it's anchor 1188 * @param {Number} vOffset - integer pixel value of desired vertical separation between anchor and element. 1189 * @param {Number} hOffset - integer pixel value of desired horizontal separation between anchor and element. 1190 * @param {Boolean} isOverflow - if a collision event is detected, sets to true to default the element to full width - any desired offset. 1191 * TODO alter/rewrite to work with `em` values as well/instead of pixels 1192 */ 1193 function GetOffsets(element, anchor, position, vOffset, hOffset, isOverflow) { 1194 var $eleDims = GetDimensions(element), 1195 $anchorDims = anchor ? GetDimensions(anchor) : null; 1196 1197 switch (position) { 1198 case 'top': 1199 return { 1200 left: Foundation.rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width : $anchorDims.offset.left, 1201 top: $anchorDims.offset.top - ($eleDims.height + vOffset) 1202 }; 1203 break; 1204 case 'left': 1205 return { 1206 left: $anchorDims.offset.left - ($eleDims.width + hOffset), 1207 top: $anchorDims.offset.top 1208 }; 1209 break; 1210 case 'right': 1211 return { 1212 left: $anchorDims.offset.left + $anchorDims.width + hOffset, 1213 top: $anchorDims.offset.top 1214 }; 1215 break; 1216 case 'center top': 1217 return { 1218 left: $anchorDims.offset.left + $anchorDims.width / 2 - $eleDims.width / 2,
1219 top: $anchorDims.offset.top - ($eleDims.height + vOffset) 1220 }; 1221 break; 1222 case 'center bottom': 1223 return { 1224 left: isOverflow ? hOffset : $anchorDims.offset.left + $anchorDims.width / 2 - $eleDims.width / 2, 1225 top: $anchorDims.offset.top + $anchorDims.height + vOffset 1226 }; 1227 break; 1228 case 'center left': 1229 return { 1230 left: $anchorDims.offset.left - ($eleDims.width + hOffset), 1231 top: $anchorDims.offset.top + $anchorDims.height / 2 - $eleDims.height / 2 1232 }; 1233 break; 1234 case 'center right': 1235 return { 1236 left: $anchorDims.offset.left + $anchorDims.width + hOffset + 1, 1237 top: $anchorDims.offset.top + $anchorDims.height / 2 - $eleDims.height / 2 1238 }; 1239 break; 1240 case 'center': 1241 return { 1242 left: $eleDims.windowDims.offset.left + $eleDims.windowDims.width / 2 - $eleDims.width / 2, 1243 top: $eleDims.windowDims.offset.top + $eleDims.windowDims.height / 2 - $eleDims.height / 2 1244 }; 1245 break; 1246 case 'reveal': 1247 return { 1248 left: ($eleDims.windowDims.width - $eleDims.width) / 2, 1249 top: $eleDims.windowDims.offset.top + vOffset 1250 }; 1251 case 'reveal full': 1252 return { 1253 left: $eleDims.windowDims.offset.left, 1254 top: $eleDims.windowDims.offset.top 1255 }; 1256 break; 1257 default: 1258 return { 1259 left: Foundation.rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width : $anchorDims.offset.left, 1260 top: $anchorDims.offset.top + $anchorDims.height + vOffset 1261 }; 1262 } 1263 } 1264}(jQuery); 1265/******************************************* 1266 * * 1267 * This util was created by Marius Olbertz * 1268 * Please thank Marius on GitHub /owlbertz * 1269 * or the web http://www.mariusolbertz.de/ * 1270 * * 1271 ******************************************/ 1272 1273'use strict'; 1274 1275!function ($) { 1276 1277 var keyCodes = { 1278 9: 'TAB', 1279 13: 'ENTER', 1280 27: 'ESCAPE', 1281 32: 'SPACE', 1282 37: 'ARROW_LEFT', 1283 38: 'ARROW_UP', 1284 39: 'ARROW_RIGHT', 1285 40: 'ARROW_DOWN' 1286 }; 1287 1288 var commands = {}; 1289 1290 var Keyboard = { 1291 keys: getKeyCodes(keyCodes), 1292 1293 /** 1294 * Parses the (keyboard) event and returns a String that represents its key 1295 * Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE 1296 * @param {Event} event - the event generated by the event handler 1297 * @return String key - String that represents the key pressed 1298 */ 1299 parseKey: function (event) { 1300 var key = keyCodes[event.which || event.keyCode] || String.fromCharCode(event.which).toUpperCase(); 1301 if (event.shiftKey) key = 'SHIFT_' + key; 1302 if (event.ctrlKey) key = 'CTRL_' + key; 1303 if (event.altKey) key = 'ALT_' + key; 1304 return key; 1305 }, 1306 1307 1308 /** 1309 * Handles the given (keyboard) event 1310 * @param {Event} event - the event generated by the event handler 1311 * @param {String} component - Foundation component's name, e.g. Slider or Reveal 1312 * @param {Objects} functions - collection of functions that are to be executed 1313 */ 1314 handleKey: function (event, component, functions) { 1315 var commandList = commands[component], 1316 keyCode = this.parseKey(event), 1317 cmds, 1318 command, 1319 fn; 1320 1321 if (!commandList) return console.warn('Component not defined!'); 1322 1323 if (typeof commandList.ltr === 'undefined') { 1324 // this component does not differentiate between ltr and rtl 1325 cmds = commandList; // use plain list 1326 } else { 1327 // merge ltr and rtl: if document is rtl, rtl overwrites ltr and vice versa 1328 if (Foundation.rtl()) cmds = $.extend({}, commandList.ltr, commandList.rtl);else cmds = $.extend({}, commandList.rtl, commandList.ltr); 1329 } 1330 command = cmds[keyCode]; 1331 1332 fn = functions[command]; 1333 if (fn && typeof fn === 'function') { 1334 // execute function if exists 1335 fn.apply(); 1336 if (functions.handled || typeof functions.handled === 'function') { 1337 // execute function when event was handled 1338 functions.handled.apply(); 1339 } 1340 } else { 1341 if (functions.unhandled || typeof functions.unhandled === 'function') { 1342 // execute function when event was not handled 1343 functions.unhandled.apply(); 1344 } 1345 } 1346 }, 1347 1348 1349 /** 1350 * Finds all focusable elements within the given `$element` 1351 * @param {jQuery} $element - jQuery object to search within 1352 * @return {jQuery} $focusable - all focusable elements within `$element` 1353 */ 1354 findFocusable: function ($element) {
1355 return $element.find('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]').filter(function () { 1356 if (!$(this).is(':visible') || $(this).attr('tabindex') < 0) { 1357 return false; 1358 } //only have visible elements and those that have a tabindex greater or equal 0 1359 return true; 1360 }); 1361 }, 1362 1363 1364 /** 1365 * Returns the component name name 1366 * @param {Object} component - Foundation component, e.g. Slider or Reveal 1367 * @return String componentName 1368 */ 1369 1370 register: function (componentName, cmds) { 1371 commands[componentName] = cmds; 1372 } 1373 }; 1374 1375 /* 1376 * Constants for easier comparing. 1377 * Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE 1378 */ 1379 function getKeyCodes(kcs) { 1380 var k = {}; 1381 for (var kc in kcs) { 1382 k[kcs[kc]] = kcs[kc]; 1383 }return k; 1384 } 1385 1386 Foundation.Keyboard = Keyboard; 1387}(jQuery); 1388'use strict'; 1389 1390!function ($) { 1391 1392 // Default set of media queries 1393 var defaultQueries = { 1394 'default': 'only screen', 1395 landscape: 'only screen and (orientation: landscape)', 1396 portrait: 'only screen and (orientation: portrait)', 1397 retina: 'only screen and (-webkit-min-device-pixel-ratio: 2),' + 'only screen and (min--moz-device-pixel-ratio: 2),' + 'only screen and (-o-min-device-pixel-ratio: 2/1),' + 'only screen and (min-device-pixel-ratio: 2),' + 'only screen and (min-resolution: 192dpi),' + 'only screen and (min-resolution: 2dppx)' 1398 }; 1399 1400 var MediaQuery = { 1401 queries: [], 1402 1403 current: '', 1404 1405 /** 1406 * Initializes the media query helper, by extracting the breakpoint list from the CSS and activating the breakpoint watcher. 1407 * @function 1408 * @private 1409 */ 1410 _init: function () { 1411 var self = this; 1412 var extractedStyles = $('.foundation-mq').css('font-family'); 1413 var namedQueries; 1414 1415 namedQueries = parseStyleToObject(extractedStyles); 1416 1417 for (var key in namedQueries) { 1418 self.queries.push({ 1419 name: key, 1420 value: 'only screen and (min-width: ' + namedQueries[key] + ')' 1421 }); 1422 } 1423 1424 this.current = this._getCurrentSize(); 1425 1426 this._watcher(); 1427 }, 1428 1429 1430 /** 1431 * Checks if the screen is at least as wide as a breakpoint. 1432 * @function 1433 * @param {String} size - Name of the breakpoint to check. 1434 * @returns {Boolean} `true` if the breakpoint matches, `false` if it's smaller. 1435 */ 1436 atLeast: function (size) { 1437 var query = this.get(size); 1438 1439 if (query) { 1440 return window.matchMedia(query).matches; 1441 } 1442 1443 return false; 1444 }, 1445 1446 1447 /** 1448 * Gets the media query of a breakpoint. 1449 * @function 1450 * @param {String} size - Name of the breakpoint to get. 1451 * @returns {String|null} - The media query of the breakpoint, or `null` if the breakpoint doesn't exist. 1452 */ 1453 get: function (size) { 1454 for (var i in this.queries) { 1455 var query = this.queries[i]; 1456 if (size === query.name) return query.value; 1457 } 1458 1459 return null; 1460 }, 1461 1462 1463 /** 1464 * Gets the current breakpoint name by testing every breakpoint and returning the last one to match (the biggest one). 1465 * @function 1466 * @private 1467 * @returns {String} Name of the current breakpoint. 1468 */ 1469 _getCurrentSize: function () { 1470 var matched; 1471 1472 for (var i in this.queries) { 1473 var query = this.queries[i]; 1474 1475 if (window.matchMedia(query.value).matches) { 1476 matched = query; 1477 } 1478 } 1479 1480 if (typeof matched === 'object') { 1481 return matched.name; 1482 } else { 1483 return matched; 1484 } 1485 }, 1486 1487 1488 /** 1489 * Activates the breakpoint watcher, which fires an event on the window whenever the breakpoint changes. 1490 * @function 1491 * @private 1492 */ 1493 _watcher: function () { 1494 var _this = this; 1495 1496 $(window).on('resize.zf.mediaquery', function () { 1497 var newSize = _this._getCurrentSize(); 1498 1499 if (newSize !== _this.current) { 1500 // Broadcast the media query change on the window 1501 $(window).trigger('changed.zf.mediaquery', [newSize, _this.current]); 1502 1503 // Change the current media query 1504 _this.current = newSize; 1505 } 1506 }); 1507 } 1508 }; 1509 1510 Foundation.MediaQuery = MediaQuery; 1511 1512 // matchMedia() polyfill - Test a CSS media type/query in JS. 1513 // Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license 1514 window.matchMedia || (window.matchMedia = function () { 1515 'use strict'; 1516 1517 // For browsers that support matchMedium api such as IE 9 and webkit 1518 1519 var styleMedia = window.styleMedia || window.media; 1520 1521 // For those that don't support matchMedium 1522 if (!styleMedia) { 1523 var style = document.createElement('style'), 1524 script = document.getElementsByTagName('script')[0], 1525 info = null; 1526 1527 style.type = 'text/css'; 1528 style.id = 'matchmediajs-test'; 1529 1530 script.parentNode.insertBefore(style, script); 1531 1532 // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers 1533 info = 'getComputedStyle' in window && window.getComputedStyle(style, null) || style.currentStyle; 1534 1535 styleMedia = { 1536 matchMedium: function (media) { 1537 var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; 1538 1539 // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers 1540 if (style.styleSheet) { 1541 style.styleSheet.cssText = text; 1542 } else { 1543 style.textContent = text; 1544 } 1545 1546 // Test if media query is true or false 1547 return info.width === '1px'; 1548 } 1549 }; 1550 } 1551 1552 return function (media) { 1553 return { 1554 matches: styleMedia.matchMedium(media || 'all'), 1555 media: media || 'all' 1556 }; 1557 }; 1558 }()); 1559 1560 // Thank you: https://github.com/sindresorhus/query-string 1561 function parseStyleToObject(str) { 1562 var styleObject = {}; 1563 1564 if (typeof str !== 'string') { 1565 return styleObject; 1566 } 1567 1568 str = str.trim().slice(1, -1);
1568 // browsers re-quote string style values 1569 1570 if (!str) { 1571 return styleObject; 1572 } 1573 1574 styleObject = str.split('&').reduce(function (ret, param) { 1575 var parts = param.replace(/\+/g, ' ').split('='); 1576 var key = parts[0]; 1577 var val = parts[1]; 1578 key = decodeURIComponent(key); 1579 1580 // missing `=` should be `null`: 1581 // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters 1582 val = val === undefined ? null : decodeURIComponent(val); 1583 1584 if (!ret.hasOwnProperty(key)) { 1585 ret[key] = val; 1586 } else if (Array.isArray(ret[key])) { 1587 ret[key].push(val); 1588 } else { 1589 ret[key] = [ret[key], val]; 1590 } 1591 return ret; 1592 }, {}); 1593 1594 return styleObject; 1595 } 1596 1597 Foundation.MediaQuery = MediaQuery; 1598}(jQuery); 1599'use strict'; 1600 1601!function ($) { 1602 1603 /** 1604 * Motion module. 1605 * @module foundation.motion 1606 */ 1607 1608 var initClasses = ['mui-enter', 'mui-leave']; 1609 var activeClasses = ['mui-enter-active', 'mui-leave-active']; 1610 1611 var Motion = { 1612 animateIn: function (element, animation, cb) { 1613 animate(true, element, animation, cb); 1614 }, 1615 1616 animateOut: function (element, animation, cb) { 1617 animate(false, element, animation, cb); 1618 } 1619 }; 1620 1621 function Move(duration, elem, fn) { 1622 var anim, 1623 prog, 1624 start = null; 1625 // console.log('called'); 1626 1627 function move(ts) { 1628 if (!start) start = window.performance.now(); 1629 // console.log(start, ts); 1630 prog = ts - start; 1631 fn.apply(elem); 1632 1633 if (prog < duration) { 1634 anim = window.requestAnimationFrame(move, elem); 1635 } else { 1636 window.cancelAnimationFrame(anim); 1637 elem.trigger('finished.zf.animate', [elem]).triggerHandler('finished.zf.animate', [elem]); 1638 } 1639 } 1640 anim = window.requestAnimationFrame(move); 1641 } 1642 1643 /** 1644 * Animates an element in or out using a CSS transition class. 1645 * @function 1646 * @private 1647 * @param {Boolean} isIn - Defines if the animation is in or out. 1648 * @param {Object} element - jQuery or HTML object to animate. 1649 * @param {String} animation - CSS class to use. 1650 * @param {Function} cb - Callback to run when animation is finished. 1651 */ 1652 function animate(isIn, element, animation, cb) { 1653 element = $(element).eq(0); 1654 1655 if (!element.length) return; 1656 1657 var initClass = isIn ? initClasses[0] : initClasses[1]; 1658 var activeClass = isIn ? activeClasses[0] : activeClasses[1]; 1659 1660 // Set up the animation 1661 reset(); 1662 1663 element.addClass(animation).css('transition', 'none'); 1664 1665 requestAnimationFrame(function () { 1666 element.addClass(initClass); 1667 if (isIn) element.show(); 1668 }); 1669 1670 // Start the animation 1671 requestAnimationFrame(function () { 1672 element[0].offsetWidth; 1673 element.css('transition', '').addClass(activeClass); 1674 }); 1675 1676 // Clean up the animation when it finishes 1677 element.one(Foundation.transitionend(element), finish); 1678 1679 // Hides the element (for out animations), resets the element, and runs a callback 1680 function finish() { 1681 if (!isIn) element.hide(); 1682 reset(); 1683 if (cb) cb.apply(element); 1684 } 1685 1686 // Resets transitions and removes motion-specific classes 1687 function reset() { 1688 element[0].style.transitionDuration = 0; 1689 element.removeClass(initClass + ' ' + activeClass + ' ' + animation); 1690 } 1691 } 1692 1693 Foundation.Move = Move; 1694 Foundation.Motion = Motion; 1695}(jQuery); 1696// 'use strict'; 1697 1698// !function ($) { 1699 1700// var Nest = { 1701// Feather: function (menu) { 1702// var type = arguments.length <= 1 || arguments[1] === undefined ? 'zf' : arguments[1]; 1703 1704// menu.attr('role', 'menubar'); 1705 1706// var items = menu.find('li').attr({ 'role': 'menuitem' }), 1707// subMenuClass = 'is-' + type + '-submenu', 1708// subItemClass = subMenuClass + '-item', 1709// hasSubClass = 'is-' + type + '-submenu-parent'; 1710 1711// menu.find('a:first').attr('tabindex', 0); 1712 1713// items.each(function () { 1714// var $item = $(this), 1715// $sub = $item.children('ul'); 1716 1717// if ($sub.length) { 1718// $item.addClass(hasSubClass).attr({ 1719// 'aria-haspopup': true, 1720// 'aria-expanded': false, 1721// 'aria-label': $item.children('a:first').text() 1722// }); 1723 1724// $sub.addClass('submenu ' + subMenuClass).attr({ 1725// 'data-submenu': '', 1726// 'aria-hidden': true, 1727// 'role': 'menu' 1728// }); 1729// } 1730 1731// if ($item.parent('[data-submenu]').length) { 1732// $item.addClass('is-submenu-item ' + subItemClass); 1733// } 1734// }); 1735 1736// return; 1737// }, 1738// Burn: function (menu, type) { 1739// var items = menu.find('li').removeAttr('tabindex'), 1740// subMenuClass = 'is-' + type + '-submenu', 1741// subItemClass = subMenuClass + '-item', 1742// hasSubClass = 'is-' + type + '-submenu-parent'; 1743 1744// menu.find('*').removeClass(subMenuClass + ' ' + subItemClass + ' ' + hasSubClass + ' is-submenu-item submenu is-active').removeAttr('data-submenu').css('display', ''); 1745// } 1746// }; 1747 1748// Foundation.Nest = Nest; 1749// }(jQuery); 1750'use strict'; 1751 1752!function ($) { 1753 1754 function Timer(elem, options, cb) { 1755 var _this = this, 1756 duration = options.duration, 1757 //options is an object for easily adding features later. 1758 nameSpace = Object.keys(elem.data())[0] || 'timer', 1759 remain = -1, 1760 start, 1761 timer; 1762 1763 this.isPaused = false;
1764 1765 this.restart = function () { 1766 remain = -1; 1767 clearTimeout(timer); 1768 this.start(); 1769 }; 1770 1771 this.start = function () { 1772 this.isPaused = false; 1773 // if(!elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things. 1774 clearTimeout(timer); 1775 remain = remain <= 0 ? duration : remain; 1776 elem.data('paused', false); 1777 start = Date.now(); 1778 timer = setTimeout(function () { 1779 if (options.infinite) { 1780 _this.restart(); //rerun the timer. 1781 } 1782 cb(); 1783 }, remain); 1784 elem.trigger('timerstart.zf.' + nameSpace); 1785 }; 1786 1787 this.pause = function () { 1788 this.isPaused = true; 1789 //if(elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things. 1790 clearTimeout(timer); 1791 elem.data('paused', true); 1792 var end = Date.now(); 1793 remain = remain - (end - start); 1794 elem.trigger('timerpaused.zf.' + nameSpace); 1795 }; 1796 } 1797 1798 /** 1799 * Runs a callback function when images are fully loaded. 1800 * @param {Object} images - Image(s) to check if loaded. 1801 * @param {Func} callback - Function to execute when image is fully loaded. 1802 */ 1803 function onImagesLoaded(images, callback) { 1804 var self = this, 1805 unloaded = images.length; 1806 1807 if (unloaded === 0) { 1808 callback(); 1809 } 1810 1811 images.each(function () { 1812 if (this.complete) { 1813 singleImageLoaded(); 1814 } else if (typeof this.naturalWidth !== 'undefined' && this.naturalWidth > 0) { 1815 singleImageLoaded(); 1816 } else { 1817 $(this).one('load', function () { 1818 singleImageLoaded(); 1819 }); 1820 } 1821 }); 1822 1823 function singleImageLoaded() { 1824 unloaded--; 1825 if (unloaded === 0) { 1826 callback(); 1827 } 1828 } 1829 } 1830 1831 Foundation.Timer = Timer; 1832 Foundation.onImagesLoaded = onImagesLoaded; 1833}(jQuery); 1834//************************************************** 1835//**Work inspired by multiple jquery swipe plugins** 1836//**Done by Yohai Ararat *************************** 1837//************************************************** 1838(function ($) { 1839 1840 $.spotSwipe = { 1841 version: '1.0.0', 1842 enabled: 'ontouchstart' in document.documentElement, 1843 preventDefault: false, 1844 moveThreshold: 75, 1845 timeThreshold: 200 1846 }; 1847 1848 var startPosX, 1849 startPosY, 1850 startTime, 1851 elapsedTime, 1852 isMoving = false; 1853 1854 function onTouchEnd() { 1855 // alert(this); 1856 this.removeEventListener('touchmove', onTouchMove); 1857 this.removeEventListener('touchend', onTouchEnd); 1858 isMoving = false; 1859 } 1860 1861 function onTouchMove(e) { 1862 if ($.spotSwipe.preventDefault) { 1863 e.preventDefault(); 1864 } 1865 if (isMoving) { 1866 var x = e.touches[0].pageX; 1867 var y = e.touches[0].pageY; 1868 var dx = startPosX - x; 1869 var dy = startPosY - y; 1870 var dir; 1871 elapsedTime = new Date().getTime() - startTime; 1872 if (Math.abs(dx) >= $.spotSwipe.moveThreshold && elapsedTime <= $.spotSwipe.timeThreshold) { 1873 dir = dx > 0 ? 'left' : 'right'; 1874 } 1875 // else if(Math.abs(dy) >= $.spotSwipe.moveThreshold && elapsedTime <= $.spotSwipe.timeThreshold) { 1876 // dir = dy > 0 ? 'down' : 'up'; 1877 // } 1878 if (dir) { 1879 e.preventDefault(); 1880 onTouchEnd.call(this); 1881 $(this).trigger('swipe', dir).trigger('swipe' + dir); 1882 } 1883 } 1884 } 1885 1886 function onTouchStart(e) { 1887 if (e.touches.length == 1) { 1888 startPosX = e.touches[0].pageX; 1889 startPosY = e.touches[0].pageY; 1890 isMoving = true; 1891 startTime = new Date().getTime(); 1892 this.addEventListener('touchmove', onTouchMove, false); 1893 this.addEventListener('touchend', onTouchEnd, false); 1894 } 1895 } 1896 1897 function init() { 1898 this.addEventListener && this.addEventListener('touchstart', onTouchStart, false); 1899 } 1900 1901 function teardown() { 1902 this.removeEventListener('touchstart', onTouchStart); 1903 } 1904 1905 $.event.special.swipe = { setup: init }; 1906 1907 $.each(['left', 'up', 'down', 'right'], function () { 1908 $.event.special['swipe' + this] = { setup: function () { 1909 $(this).on('swipe', $.noop); 1910 } }; 1911 }); 1912})(jQuery); 1913/**************************************************** 1914 * Method for adding psuedo drag events to elements * 1915 ***************************************************/ 1916!function ($) { 1917 $.fn.addTouch = function () { 1918 this.each(function (i, el) { 1919 $(el).bind('touchstart touchmove touchend touchcancel', function () { 1920 //we pass the original event object because the jQuery event 1921 //object is normalized to w3c specs and does not provide the TouchList 1922 handleTouch(event); 1923 }); 1924 }); 1925 1926 var handleTouch = function (event) { 1927 var touches = event.changedTouches, 1928 first = touches[0], 1929 eventTypes = { 1930 touchstart: 'mousedown', 1931 touchmove: 'mousemove', 1932 touchend: 'mouseup' 1933 }, 1934 type = eventTypes[event.type], 1935 simulatedEvent; 1936 1937 if ('MouseEvent' in window && typeof window.MouseEvent === 'function') { 1938 simulatedEvent = window.MouseEvent(type, { 1939 'bubbles': true, 1940 'cancelable': true, 1941 'screenX': first.screenX, 1942 'screenY': first.screenY, 1943 'clientX': first.clientX, 1944 'clientY': first.clientY 1945 }); 1946 } else { 1947 simulatedEvent = document.createEvent('MouseEvent'); 1948 simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0 /*left*/, null); 1949 } 1950 first.target.dispatchEvent(simulatedEvent); 1951 }; 1952 }; 1953}(jQuery); 1954 1955//********************************** 1956//**From the jQuery Mobile Library** 1957//**need to recreate functionality**
1958//**and try to improve if possible** 1959//********************************** 1960 1961/* Removing the jQuery function **** 1962************************************ 1963 1964(function( $, window, undefined ) { 1965 1966 var $document = $( document ), 1967 // supportTouch = $.mobile.support.touch, 1968 touchStartEvent = 'touchstart'//supportTouch ? "touchstart" : "mousedown", 1969 touchStopEvent = 'touchend'//supportTouch ? "touchend" : "mouseup", 1970 touchMoveEvent = 'touchmove'//supportTouch ? "touchmove" : "mousemove"; 1971 1972 // setup new event shortcuts 1973 $.each( ( "touchstart touchmove touchend " + 1974 "swipe swipeleft swiperight" ).split( " " ), function( i, name ) { 1975 1976 $.fn[ name ] = function( fn ) { 1977 return fn ? this.bind( name, fn ) : this.trigger( name ); 1978 }; 1979 1980 // jQuery < 1.8 1981 if ( $.attrFn ) { 1982 $.attrFn[ name ] = true; 1983 } 1984 }); 1985 1986 function triggerCustomEvent( obj, eventType, event, bubble ) { 1987 var originalType = event.type; 1988 event.type = eventType; 1989 if ( bubble ) { 1990 $.event.trigger( event, undefined, obj ); 1991 } else { 1992 $.event.dispatch.call( obj, event ); 1993 } 1994 event.type = originalType; 1995 } 1996 1997 // also handles taphold 1998 1999 // Also handles swipeleft, swiperight 2000 $.event.special.swipe = { 2001 2002 // More than this horizontal displacement, and we will suppress scrolling. 2003 scrollSupressionThreshold: 30, 2004 2005 // More time than this, and it isn't a swipe. 2006 durationThreshold: 1000, 2007 2008 // Swipe horizontal displacement must be more than this. 2009 horizontalDistanceThreshold: window.devicePixelRatio >= 2 ? 15 : 30, 2010 2011 // Swipe vertical displacement must be less than this. 2012 verticalDistanceThreshold: window.devicePixelRatio >= 2 ? 15 : 30, 2013 2014 getLocation: function ( event ) { 2015 var winPageX = window.pageXOffset, 2016 winPageY = window.pageYOffset, 2017 x = event.clientX, 2018 y = event.clientY; 2019 2020 if ( event.pageY === 0 && Math.floor( y ) > Math.floor( event.pageY ) || 2021 event.pageX === 0 && Math.floor( x ) > Math.floor( event.pageX ) ) { 2022 2023 // iOS4 clientX/clientY have the value that should have been 2024 // in pageX/pageY. While pageX/page/ have the value 0 2025 x = x - winPageX; 2026 y = y - winPageY; 2027 } else if ( y < ( event.pageY - winPageY) || x < ( event.pageX - winPageX ) ) { 2028 2029 // Some Android browsers have totally bogus values for clientX/Y 2030 // when scrolling/zooming a page. Detectable since clientX/clientY 2031 // should never be smaller than pageX/pageY minus page scroll 2032 x = event.pageX - winPageX; 2033 y = event.pageY - winPageY; 2034 } 2035 2036 return { 2037 x: x, 2038 y: y 2039 }; 2040 }, 2041 2042 start: function( event ) { 2043 var data = event.originalEvent.touches ? 2044 event.originalEvent.touches[ 0 ] : event, 2045 location = $.event.special.swipe.getLocation( data ); 2046 return { 2047 time: ( new Date() ).getTime(), 2048 coords: [ location.x, location.y ], 2049 origin: $( event.target ) 2050 }; 2051 }, 2052 2053 stop: function( event ) { 2054 var data = event.originalEvent.touches ? 2055 event.originalEvent.touches[ 0 ] : event, 2056 location = $.event.special.swipe.getLocation( data ); 2057 return { 2058 time: ( new Date() ).getTime(), 2059 coords: [ location.x, location.y ] 2060 }; 2061 }, 2062 2063 handleSwipe: function( start, stop, thisObject, origTarget ) { 2064 if ( stop.time - start.time < $.event.special.swipe.durationThreshold && 2065 Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.horizontalDistanceThreshold && 2066 Math.abs( start.coords[ 1 ] - stop.coords[ 1 ] ) < $.event.special.swipe.verticalDistanceThreshold ) { 2067 var direction = start.coords[0] > stop.coords[ 0 ] ? "swipeleft" : "swiperight"; 2068 2069 triggerCustomEvent( thisObject, "swipe", $.Event( "swipe", { target: origTarget, swipestart: start, swipestop: stop }), true ); 2070 triggerCustomEvent( thisObject, direction,$.Event( direction, { target: origTarget, swipestart: start, swipestop: stop } ), true ); 2071 return true; 2072 } 2073 return false; 2074 2075 }, 2076 2077 // This serves as a flag to ensure that at most one swipe event event is 2078 // in work at any given time 2079 eventInProgress: false, 2080 2081 setup: function() { 2082 var events, 2083 thisObject = this, 2084 $this = $( thisObject ), 2085 context = {}; 2086 2087 // Retrieve the events data for this element and add the swipe context 2088 events = $.data( this, "mobile-events" ); 2089 if ( !events ) { 2090 events = { length: 0 }; 2091 $.data( this, "mobile-events", events ); 2092 } 2093 events.length++; 2094 events.swipe = context; 2095 2096 context.start = function( event ) { 2097 2098 // Bail if we're already working on a swipe event 2099 if ( $.event.special.swipe.eventInProgress ) { 2100 return; 2101 } 2102 $.event.special.swipe.eventInProgress = true; 2103 2104 var stop, 2105 start = $.event.special.swipe.start( event ), 2106 origTarget = event.target, 2107 emitted = false;
2108 2109 context.move = function( event ) { 2110 if ( !start || event.isDefaultPrevented() ) { 2111 return; 2112 } 2113 2114 stop = $.event.special.swipe.stop( event ); 2115 if ( !emitted ) { 2116 emitted = $.event.special.swipe.handleSwipe( start, stop, thisObject, origTarget ); 2117 if ( emitted ) { 2118 2119 // Reset the context to make way for the next swipe event 2120 $.event.special.swipe.eventInProgress = false; 2121 } 2122 } 2123 // prevent scrolling 2124 if ( Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.scrollSupressionThreshold ) { 2125 event.preventDefault(); 2126 } 2127 }; 2128 2129 context.stop = function() { 2130 emitted = true; 2131 2132 // Reset the context to make way for the next swipe event 2133 $.event.special.swipe.eventInProgress = false; 2134 $document.off( touchMoveEvent, context.move ); 2135 context.move = null; 2136 }; 2137 2138 $document.on( touchMoveEvent, context.move ) 2139 .one( touchStopEvent, context.stop ); 2140 }; 2141 $this.on( touchStartEvent, context.start ); 2142 }, 2143 2144 teardown: function() { 2145 var events, context; 2146 2147 events = $.data( this, "mobile-events" ); 2148 if ( events ) { 2149 context = events.swipe; 2150 delete events.swipe; 2151 events.length--; 2152 if ( events.length === 0 ) { 2153 $.removeData( this, "mobile-events" ); 2154 } 2155 } 2156 2157 if ( context ) { 2158 if ( context.start ) { 2159 $( this ).off( touchStartEvent, context.start ); 2160 } 2161 if ( context.move ) { 2162 $document.off( touchMoveEvent, context.move ); 2163 } 2164 if ( context.stop ) { 2165 $document.off( touchStopEvent, context.stop ); 2166 } 2167 } 2168 } 2169 }; 2170 $.each({ 2171 swipeleft: "swipe.left", 2172 swiperight: "swipe.right" 2173 }, function( event, sourceEvent ) { 2174 2175 $.event.special[ event ] = { 2176 setup: function() { 2177 $( this ).bind( sourceEvent, $.noop ); 2178 }, 2179 teardown: function() { 2180 $( this ).unbind( sourceEvent ); 2181 } 2182 }; 2183 }); 2184})( jQuery, this ); 2185*/ 2186'use strict'; 2187 2188!function ($) { 2189 2190 var MutationObserver = function () { 2191 var prefixes = ['WebKit', 'Moz', 'O', 'Ms', '']; 2192 for (var i = 0; i < prefixes.length; i++) { 2193 if (prefixes[i] + 'MutationObserver' in window) { 2194 return window[prefixes[i] + 'MutationObserver']; 2195 } 2196 } 2197 return false; 2198 }(); 2199 2200 var triggers = function (el, type) { 2201 el.data(type).split(' ').forEach(function (id) { 2202 $('#' + id)[type === 'close' ? 'trigger' : 'triggerHandler'](type + '.zf.trigger', [el]); 2203 }); 2204 }; 2205 // Elements with [data-open] will reveal a plugin that supports it when clicked. 2206 $(document).on('click.zf.trigger', '[data-open]', function () { 2207 triggers($(this), 'open'); 2208 }); 2209 2210 // Elements with [data-close] will close a plugin that supports it when clicked. 2211 // If used without a value on [data-close], the event will bubble, allowing it to close a parent component. 2212 $(document).on('click.zf.trigger', '[data-close]', function () { 2213 var id = $(this).data('close'); 2214 if (id) { 2215 triggers($(this), 'close'); 2216 } else { 2217 $(this).trigger('close.zf.trigger'); 2218 } 2219 }); 2220 2221 // Elements with [data-toggle] will toggle a plugin that supports it when clicked. 2222 $(document).on('click.zf.trigger', '[data-toggle]', function () { 2223 triggers($(this), 'toggle'); 2224 }); 2225 2226 // Elements with [data-closable] will respond to close.zf.trigger events. 2227 $(document).on('close.zf.trigger', '[data-closable]', function (e) { 2228 e.stopPropagation(); 2229 var animation = $(this).data('closable'); 2230 2231 if (animation !== '') { 2232 Foundation.Motion.animateOut($(this), animation, function () { 2233 $(this).trigger('closed.zf'); 2234 }); 2235 } else { 2236 $(this).fadeOut().trigger('closed.zf'); 2237 } 2238 }); 2239 2240 $(document).on('focus.zf.trigger blur.zf.trigger', '[data-toggle-focus]', function () { 2241 var id = $(this).data('toggle-focus'); 2242 $('#' + id).triggerHandler('toggle.zf.trigger', [$(this)]); 2243 }); 2244 2245 /** 2246 * Fires once after all other scripts have loaded 2247 * @function 2248 * @private 2249 */ 2250 //$(window).load(function () { 2251 $(window).on("load", function (e) { 2252 checkListeners(); 2253 }); 2254 2255 function checkListeners() { 2256 eventsListener(); 2257 resizeListener(); 2258 scrollListener(); 2259 closemeListener(); 2260 } 2261 2262 //******** only fires this function once on load, if there's something to watch ******** 2263 function closemeListener(pluginName) { 2264 var yetiBoxes = $('[data-yeti-box]'), 2265 plugNames = ['dropdown', 'tooltip', 'reveal']; 2266 2267 if (pluginName) { 2268 if (typeof pluginName === 'string') { 2269 plugNames.push(pluginName); 2270 } else if (typeof pluginName === 'object' && typeof pluginName[0] === 'string') { 2271 plugNames.concat(pluginName); 2272 } else { 2273 console.error('Plugin names must be strings'); 2274 } 2275 } 2276 if (yetiBoxes.length) { 2277 var listeners = plugNames.map(function (name) { 2278 return 'closeme.zf.' + name; 2279 }).join(' '); 2280 2281 $(window).off(listeners).on(listeners, function (e, pluginId) { 2282 var plugin = e.namespace.split('.')[0]; 2283 var plugins = $('[data-' + plugin + ']').not('[data-yeti-box="' + pluginId + '"]'); 2284 2285 plugins.each(function () { 2286 var _this = $(this); 2287 2288 _this.triggerHandler('close.zf.trigger', [_this]); 2289 }); 2290 }); 2291 } 2292 } 2293 2294 function resizeListener(debounce) { 2295 var timer = undefined, 2296 $nodes = $('[data-resize]'); 2297 if ($nodes.length) { 2298 $(window).off('resize.zf.trigger').on('resize.zf.trigger', function (e) { 2299 if (timer) { 2300 clearTimeout(timer); 2301 } 2302 2303 timer = setTimeout(function () { 2304 2305 if (!MutationObserver) { 2306 //fallback for IE 9 2307 $nodes.each(function () { 2308 $(this).triggerHandler('resizeme.zf.trigger'); 2309 }); 2310 } 2311 //trigger all listening elements and signal a resize event 2312 $nodes.attr('data-events', "resize"); 2313 }, debounce || 10); //default time to emit resize event 2314 }); 2315 } 2316 } 2317 2318 function scrollListener(debounce) { 2319 var timer = undefined, 2320 $nodes = $('[data-scroll]'); 2321 if ($nodes.length) { 2322 $(window).off('scroll.zf.trigger').on('scroll.zf.trigger', function (e) { 2323 if (timer) { 2324 clearTimeout(timer); 2325 } 2326 2327 timer = setTimeout(function () { 2328 2329 if (!MutationObserver) { 2330 //fallback for IE 9 2331 $nodes.each(function () { 2332 $(this).triggerHandler('scrollme.zf.trigger'); 2333 }); 2334 } 2335 //trigger all listening elements and signal a scroll event 2336 $nodes.attr('data-events', "scroll"); 2337 }, debounce || 10); //default time to emit scroll event 2338 }); 2339 } 2340 } 2341 2342 function eventsListener() { 2343 if (!MutationObserver) { 2344 return false;
2345 } 2346 var nodes = document.querySelectorAll('[data-resize], [data-scroll], [data-mutate]'); 2347 2348 //element callback 2349 var listeningElementsMutation = function (mutationRecordsList) { 2350 var $target = $(mutationRecordsList[0].target); 2351 //trigger the event handler for the element depending on type 2352 switch ($target.attr("data-events")) { 2353 2354 case "resize": 2355 $target.triggerHandler('resizeme.zf.trigger', [$target]); 2356 break; 2357 2358 case "scroll": 2359 $target.triggerHandler('scrollme.zf.trigger', [$target, window.pageYOffset]); 2360 break; 2361 2362 // case "mutate" : 2363 // console.log('mutate', $target); 2364 // $target.triggerHandler('mutate.zf.trigger'); 2365 // 2366 // //make sure we don't get stuck in an infinite loop from sloppy codeing 2367 // if ($target.index('[data-mutate]') == $("[data-mutate]").length-1) { 2368 // domMutationObserver(); 2369 // } 2370 // break; 2371 2372 default: 2373 return false; 2374 //nothing 2375 } 2376 }; 2377 2378 if (nodes.length) { 2379 //for each element that needs to listen for resizing, scrolling, (or coming soon mutation) add a single observer 2380 for (var i = 0; i <= nodes.length - 1; i++) { 2381 var elementObserver = new MutationObserver(listeningElementsMutation); 2382 elementObserver.observe(nodes[i], { attributes: true, childList: false, characterData: false, subtree: false, attributeFilter: ["data-events"] }); 2383 } 2384 } 2385 } 2386 2387 // ------------------------------------ 2388 2389 // [PH] 2390 // Foundation.CheckWatchers = checkWatchers; 2391 Foundation.IHearYou = checkListeners; 2392 // Foundation.ISeeYou = scrollListener; 2393 // Foundation.IFeelYou = closemeListener; 2394}(jQuery); 2395 2396// function domMutationObserver(debounce) { 2397// // !!! This is coming soon and needs more work; not active !!! // 2398// var timer, 2399// nodes = document.querySelectorAll('[data-mutate]'); 2400// // 2401// if (nodes.length) { 2402// // var MutationObserver = (function () { 2403// // var prefixes = ['WebKit', 'Moz', 'O', 'Ms', '']; 2404// // for (var i=0; i < prefixes.length; i++) { 2405// // if (prefixes[i] + 'MutationObserver' in window) { 2406// // return window[prefixes[i] + 'MutationObserver']; 2407// // } 2408// // } 2409// // return false; 2410// // }()); 2411// 2412// 2413// //for the body, we need to listen for all changes effecting the style and class attributes 2414// var bodyObserver = new MutationObserver(bodyMutation); 2415// bodyObserver.observe(document.body, { attributes: true, childList: true, characterData: false, subtree:true, attributeFilter:["style", "class"]}); 2416// 2417// 2418// //body callback 2419// function bodyMutation(mutate) { 2420// //trigger all listening elements and signal a mutation event 2421// if (timer) { clearTimeout(timer); } 2422// 2423// timer = setTimeout(function() { 2424// bodyObserver.disconnect(); 2425// $('[data-mutate]').attr('data-events',"mutate"); 2426// }, debounce || 150); 2427// } 2428// } 2429// } 2430'use strict'; 2431 2432var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 2433 2434function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2435 2436!function ($) { 2437 2438 /** 2439 * Abide module. 2440 * @module foundation.abide 2441 */ 2442 2443 var Abide = function () { 2444 /** 2445 * Creates a new instance of Abide. 2446 * @class 2447 * @fires Abide#init 2448 * @param {Object} element - jQuery object to add the trigger to. 2449 * @param {Object} options - Overrides to the default plugin settings. 2450 */ 2451 2452 function Abide(element) { 2453 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 2454 2455 _classCallCheck(this, Abide); 2456 2457 this.$element = element; 2458 this.options = $.extend({}, Abide.defaults, this.$element.data(), options); 2459 2460 this._init(); 2461 2462 Foundation.registerPlugin(this, 'Abide'); 2463 } 2464 2465 /** 2466 * Initializes the Abide plugin and calls functions to get Abide functioning on load. 2467 * @private 2468 */ 2469 2470 2471 _createClass(Abide, [{ 2472 key: '_init', 2473 value: function _init() { 2474 this.$inputs = this.$element.find('input, textarea, select').not('[data-abide-ignore]'); 2475 2476 this._events(); 2477 } 2478 2479 /** 2480 * Initializes events for Abide. 2481 * @private 2482 */ 2483 2484 }, {
vendor: 4,099 bytes, lines 2485-2624
2485 key: '_events', 2486 value: function _events() { 2487 var _this2 = this; 2488 2489 this.$element.off('.abide').on('reset.zf.abide', function () { 2490 _this2.resetForm(); 2491 }).on('submit.zf.abide', function () { 2492 return _this2.validateForm(); 2493 }); 2494 2495 if (this.options.validateOn === 'fieldChange') { 2496 this.$inputs.off('change.zf.abide').on('change.zf.abide', function (e) { 2497 _this2.validateInput($(e.target)); 2498 }); 2499 } 2500 2501 if (this.options.liveValidate) { 2502 this.$inputs.off('input.zf.abide').on('input.zf.abide', function (e) { 2503 _this2.validateInput($(e.target)); 2504 }); 2505 } 2506 } 2507 2508 /** 2509 * Calls necessary functions to update Abide upon DOM change 2510 * @private 2511 */ 2512 2513 }, { 2514 key: '_reflow', 2515 value: function _reflow() { 2516 this._init(); 2517 } 2518 2519 /** 2520 * Checks whether or not a form element has the required attribute and if it's checked or not 2521 * @param {Object} element - jQuery object to check for required attribute 2522 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 2523 */ 2524 2525 }, { 2526 key: 'requiredCheck', 2527 value: function requiredCheck($el) { 2528 if (!$el.attr('required')) return true; 2529 2530 var isGood = true; 2531 2532 switch ($el[0].type) { 2533 case 'checkbox': 2534 case 'radio': 2535 isGood = $el[0].checked; 2536 break; 2537 2538 case 'select': 2539 case 'select-one': 2540 case 'select-multiple': 2541 var opt = $el.find('option:selected'); 2542 if (!opt.length || !opt.val()) isGood = false; 2543 break; 2544 2545 default: 2546 if (!$el.val() || !$el.val().length) isGood = false; 2547 } 2548 2549 return isGood; 2550 } 2551 2552 /** 2553 * Based on $el, get the first element with selector in this order: 2554 * 1. The element's direct sibling('s). 2555 * 3. The element's parent's children. 2556 * 2557 * This allows for multiple form errors per input, though if none are found, no form errors will be shown. 2558 * 2559 * @param {Object} $el - jQuery object to use as reference to find the form error selector. 2560 * @returns {Object} jQuery object with the selector. 2561 */ 2562 2563 }, { 2564 key: 'findFormError', 2565 value: function findFormError($el) { 2566 var $error = $el.siblings(this.options.formErrorSelector); 2567 2568 if (!$error.length) { 2569 $error = $el.parent().find(this.options.formErrorSelector); 2570 } 2571 2572 return $error; 2573 } 2574 2575 /** 2576 * Get the first element in this order: 2577 * 2. The <label> with the attribute `[for="someInputId"]` 2578 * 3. The `.closest()` <label> 2579 * 2580 * @param {Object} $el - jQuery object to check for required attribute 2581 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 2582 */ 2583 2584 }, { 2585 key: 'findLabel', 2586 value: function findLabel($el) { 2587 var id = $el[0].id; 2588 var $label = this.$element.find('label[for="' + id + '"]'); 2589 2590 if (!$label.length) { 2591 return $el.closest('label'); 2592 } 2593 2594 return $label; 2595 } 2596 2597 /** 2598 * Adds the CSS error class as specified by the Abide settings to the label, input, and the form 2599 * @param {Object} $el - jQuery object to add the class to 2600 */ 2601 2602 }, { 2603 key: 'addErrorClasses', 2604 value: function addErrorClasses($el) { 2605 var $label = this.findLabel($el); 2606 var $formError = this.findFormError($el); 2607 2608 if ($label.length) { 2609 $label.addClass(this.options.labelErrorClass); 2610 } 2611 2612 if ($formError.length) { 2613 $formError.addClass(this.options.formErrorClass); 2614 } 2615 2616 $el.addClass(this.options.inputErrorClass).attr('data-invalid', ''); 2617 } 2618 2619 /** 2620 * Removes CSS error class as specified by the Abide settings from the label, input, and the form 2621 * @param {Object} $el - jQuery object to remove the class from 2622 */ 2623 2624 }, {
2625 key: 'removeErrorClasses', 2626 value: function removeErrorClasses($el) { 2627 var $label = this.findLabel($el); 2628 var $formError = this.findFormError($el); 2629 2630 if ($label.length) { 2631 $label.removeClass(this.options.labelErrorClass); 2632 } 2633 2634 if ($formError.length) { 2635 $formError.removeClass(this.options.formErrorClass); 2636 } 2637 2638 $el.removeClass(this.options.inputErrorClass).removeAttr('data-invalid'); 2639 } 2640 2641 /** 2642 * Goes through a form to find inputs and proceeds to validate them in ways specific to their type 2643 * @fires Abide#invalid 2644 * @fires Abide#valid 2645 * @param {Object} element - jQuery object to validate, should be an HTML input 2646 * @returns {Boolean} goodToGo - If the input is valid or not. 2647 */ 2648 2649 }, { 2650 key: 'validateInput', 2651 value: function validateInput($el) { 2652 var clearRequire = this.requiredCheck($el), 2653 validated = false, 2654 customValidator = true, 2655 validator = $el.attr('data-validator'), 2656 equalTo = true; 2657 2658 switch ($el[0].type) { 2659 case 'radio': 2660 validated = this.validateRadio($el.attr('name')); 2661 break; 2662 2663 case 'checkbox': 2664 validated = clearRequire; 2665 break; 2666 2667 case 'select': 2668 case 'select-one': 2669 case 'select-multiple': 2670 validated = clearRequire; 2671 break; 2672 2673 default: 2674 validated = this.validateText($el); 2675 } 2676 2677 if (validator) { 2678 customValidator = this.matchValidation($el, validator, $el.attr('required')); 2679 } 2680 2681 if ($el.attr('data-equalto')) { 2682 equalTo = this.options.validators.equalTo($el); 2683 } 2684 2685 var goodToGo = [clearRequire, validated, customValidator, equalTo].indexOf(false) === -1; 2686 var message = (goodToGo ? 'valid' : 'invalid') + '.zf.abide'; 2687 2688 this[goodToGo ? 'removeErrorClasses' : 'addErrorClasses']($el); 2689 2690 /** 2691 * Fires when the input is done checking for validation. Event trigger is either `valid.zf.abide` or `invalid.zf.abide` 2692 * Trigger includes the DOM element of the input. 2693 * @event Abide#valid 2694 * @event Abide#invalid 2695 */ 2696 $el.trigger(message, [$el]); 2697 2698 return goodToGo; 2699 } 2700 2701 /** 2702 * Goes through a form and if there are any invalid inputs, it will display the form error element 2703 * @returns {Boolean} noError - true if no errors were detected... 2704 * @fires Abide#formvalid 2705 * @fires Abide#forminvalid 2706 */ 2707 2708 }, { 2709 key: 'validateForm', 2710 value: function validateForm() { 2711 var acc = []; 2712 var _this = this; 2713 2714 this.$inputs.each(function () { 2715 acc.push(_this.validateInput($(this))); 2716 }); 2717 2718 var noError = acc.indexOf(false) === -1; 2719 2720 this.$element.find('[data-abide-error]').css('display', noError ? 'none' : 'block'); 2721 2722 /** 2723 * Fires when the form is finished validating. Event trigger is either `formvalid.zf.abide` or `forminvalid.zf.abide`. 2724 * Trigger includes the element of the form. 2725 * @event Abide#formvalid 2726 * @event Abide#forminvalid 2727 */ 2728 this.$element.trigger((noError ? 'formvalid' : 'forminvalid') + '.zf.abide', [this.$element]); 2729 2730 return noError; 2731 } 2732 2733 /** 2734 * Determines whether or a not a text input is valid based on the pattern specified in the attribute. If no matching pattern is found, returns true. 2735 * @param {Object} $el - jQuery object to validate, should be a text input HTML element 2736 * @param {String} pattern - string value of one of the RegEx patterns in Abide.options.patterns 2737 * @returns {Boolean} Boolean value depends on whether or not the input value matches the pattern specified 2738 */ 2739 2740 }, { 2741 key: 'validateText', 2742 value: function validateText($el, pattern) { 2743 // pattern = pattern ? pattern : $el.attr('pattern') ? $el.attr('pattern') : $el.attr('type'); 2744 pattern = pattern || $el.attr('pattern') || $el.attr('type'); 2745 var inputText = $el.val(); 2746 2747 // if text, check if the pattern exists, if so, test it, if no text or no pattern, return true. 2748 return inputText.length ? this.options.patterns.hasOwnProperty(pattern) ? this.options.patterns[pattern].test(inputText) : pattern && pattern !== $el.attr('type') ? new RegExp(pattern).test(inputText) : true : true; 2749 } 2750 2751 /** 2752 * Determines whether or a not a radio input is valid based on whether or not it is required and selected 2753 * @param {String} groupName - A string that specifies the name of a radio button group 2754 * @returns {Boolean} Boolean value depends on whether or not at least one radio input has been selected (if it's required) 2755 */ 2756 2757 }, {
2758 key: 'validateRadio', 2759 value: function validateRadio(groupName) { 2760 var $group = this.$element.find(':radio[name="' + groupName + '"]'), 2761 counter = [], 2762 _this = this; 2763 2764 $group.each(function () { 2765 var rdio = $(this), 2766 clear = _this.requiredCheck(rdio); 2767 counter.push(clear); 2768 if (clear) _this.removeErrorClasses(rdio); 2769 }); 2770 2771 return counter.indexOf(false) === -1; 2772 } 2773 2774 /** 2775 * Determines if a selected input passes a custom validation function. Multiple validations can be used, if passed to the element with `data-validator="foo bar baz"` in a space separated listed. 2776 * @param {Object} $el - jQuery input element. 2777 * @param {String} validators - a string of function names matching functions in the Abide.options.validators object. 2778 * @param {Boolean} required - self explanatory? 2779 * @returns {Boolean} - true if validations passed. 2780 */ 2781 2782 }, { 2783 key: 'matchValidation', 2784 value: function matchValidation($el, validators, required) { 2785 var _this3 = this; 2786 2787 required = required ? true : false; 2788 2789 var clear = validators.split(' ').map(function (v) { 2790 return _this3.options.validators[v]($el, required, $el.parent()); 2791 }); 2792 return clear.indexOf(false) === -1; 2793 } 2794 2795 /** 2796 * Resets form inputs and styles 2797 * @fires Abide#formreset 2798 */ 2799 2800 }, { 2801 key: 'resetForm', 2802 value: function resetForm() { 2803 var $form = this.$element, 2804 opts = this.options; 2805 2806 $('.' + opts.labelErrorClass, $form).not('small').removeClass(opts.labelErrorClass); 2807 $('.' + opts.inputErrorClass, $form).not('small').removeClass(opts.inputErrorClass); 2808 $(opts.formErrorSelector + '.' + opts.formErrorClass).removeClass(opts.formErrorClass); 2809 $form.find('[data-abide-error]').css('display', 'none'); 2810 $(':input', $form).not(':button, :submit, :reset, :hidden, [data-abide-ignore]').val('').removeAttr('data-invalid'); 2811 /** 2812 * Fires when the form has been reset. 2813 * @event Abide#formreset 2814 */ 2815 $form.trigger('formreset.zf.abide', [$form]); 2816 } 2817 2818 /** 2819 * Destroys an instance of Abide. 2820 * Removes error styles and classes from elements, without resetting their values. 2821 */ 2822 2823 }, { 2824 key: 'destroy', 2825 value: function destroy() { 2826 var _this = this; 2827 this.$element.off('.abide').find('[data-abide-error]').css('display', 'none'); 2828 2829 this.$inputs.off('.abide').each(function () { 2830 _this.removeErrorClasses($(this)); 2831 }); 2832 2833 Foundation.unregisterPlugin(this); 2834 } 2835 }]); 2836 2837 return Abide; 2838 }(); 2839 2840 /** 2841 * Default settings for plugin 2842 */ 2843 2844 2845 Abide.defaults = { 2846 /** 2847 * The default event to validate inputs. Checkboxes and radios validate immediately. 2848 * Remove or change this value for manual validation. 2849 * @option 2850 * @example 'fieldChange' 2851 */ 2852 validateOn: 'fieldChange', 2853 2854 /** 2855 * Class to be applied to input labels on failed validation. 2856 * @option 2857 * @example 'is-invalid-label' 2858 */ 2859 labelErrorClass: 'is-invalid-label', 2860 2861 /** 2862 * Class to be applied to inputs on failed validation. 2863 * @option 2864 * @example 'is-invalid-input' 2865 */ 2866 inputErrorClass: 'is-invalid-input', 2867 2868 /** 2869 * Class selector to use to target Form Errors for show/hide. 2870 * @option 2871 * @example '.form-error' 2872 */ 2873 formErrorSelector: '.form-error', 2874 2875 /** 2876 * Class added to Form Errors on failed validation. 2877 * @option 2878 * @example 'is-visible' 2879 */ 2880 formErrorClass: 'is-visible', 2881 2882 /** 2883 * Set to true to validate text inputs on any value change. 2884 * @option 2885 * @example false 2886 */ 2887 liveValidate: false, 2888 2889 patterns: { 2890 alpha: /^[a-zA-Z]+$/, 2891 alpha_numeric: /^[a-zA-Z0-9]+$/, 2892 integer: /^[-+]?\d+$/, 2893 number: /^[-+]?\d*(?:[\.\,]\d+)?$/, 2894 2895 // amex, visa, diners 2896 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})$/, 2897 cvv: /^([0-9]){3,4}$/, 2898 2899 // http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address 2900 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])?)+$/,
2901 2902 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})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/, 2903 // abc.de 2904 domain: /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,8}$/, 2905 2906 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))$/, 2907 // YYYY-MM-DD 2908 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))$/, 2909 // HH:MM:SS 2910 time: /^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/, 2911 dateISO: /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/, 2912 // MM/DD/YYYY 2913 month_day_year: /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/, 2914 // DD/MM/YYYY 2915 day_month_year: /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/, 2916 2917 // #FFF or #FFFFFF 2918 color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/ 2919 }, 2920 2921 /** 2922 * Optional validation functions to be used. `equalTo` being the only default included function. 2923 * Functions should return only a boolean if the input is valid or not. Functions are given the following arguments: 2924 * el : The jQuery element to validate. 2925 * required : Boolean value of the required attribute be present or not. 2926 * parent : The direct parent of the input. 2927 * @option 2928 */ 2929 validators: { 2930 equalTo: function (el, required, parent) { 2931 return $('#' + el.attr('data-equalto')).val() === el.val(); 2932 } 2933 } 2934 }; 2935 2936 // Window exports 2937 Foundation.plugin(Abide, 'Abide'); 2938}(jQuery); 2939'use strict'; 2940 2941var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 2942 2943function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2944 2945!function ($) { 2946 2947 /** 2948 * Accordion module. 2949 * @module foundation.accordion 2950 * @requires foundation.util.keyboard 2951 * @requires foundation.util.motion 2952 */ 2953 2954 var Accordion = function () { 2955 /** 2956 * Creates a new instance of an accordion. 2957 * @class 2958 * @fires Accordion#init 2959 * @param {jQuery} element - jQuery object to make into an accordion. 2960 * @param {Object} options - a plain object with settings to override the default options. 2961 */ 2962 2963 function Accordion(element, options) { 2964 _classCallCheck(this, Accordion); 2965 2966 this.$element = element; 2967 this.options = $.extend({}, Accordion.defaults, this.$element.data(), options); 2968 2969 this._init(); 2970 2971 Foundation.registerPlugin(this, 'Accordion'); 2972 Foundation.Keyboard.register('Accordion', { 2973 'ENTER': 'toggle', 2974 'SPACE': 'toggle', 2975 'ARROW_DOWN': 'next', 2976 'ARROW_UP': 'previous' 2977 }); 2978 } 2979 2980 /** 2981 * Initializes the accordion by animating the preset active pane(s). 2982 * @private 2983 */ 2984 2985 2986 _createClass(Accordion, [{ 2987 key: '_init', 2988 value: function _init() { 2989 this.$element.attr('role', 'tablist'); 2990 this.$tabs = this.$element.children('li'); 2991 if (this.$tabs.length === 0) { 2992 this.$tabs = this.$element.children('[data-accordion-item]'); 2993 } 2994 this.$tabs.each(function (idx, el) { 2995 2996 var $el = $(el), 2997 $content = $el.find('[data-tab-content]'), 2998 id = $content[0].id || Foundation.GetYoDigits(6, 'accordion'), 2999 linkId = el.id || id + '-label'; 3000 3001 $el.find('a:first').attr({ 3002 'aria-controls': id, 3003 'role': 'tab', 3004 'id': linkId, 3005 'aria-expanded': false, 3006 'aria-selected': false 3007 }); 3008 $content.attr({ 'role': 'tabpanel', 'aria-labelledby': linkId, 'aria-hidden': true, 'id': id }); 3009 }); 3010 var $initActive = this.$element.find('.is-active').children('[data-tab-content]'); 3011 if ($initActive.length) { 3012 this.down($initActive, true); 3013 } 3014 this._events(); 3015 } 3016 3017 /** 3018 * Adds event handlers for items within the accordion. 3019 * @private 3020 */ 3021 3022 }, {
3023 key: '_events', 3024 value: function _events() { 3025 var _this = this; 3026 3027 this.$tabs.each(function () { 3028 var $elem = $(this); 3029 var $tabContent = $elem.children('[data-tab-content]'); 3030 if ($tabContent.length) { 3031 $elem.children('a').off('click.zf.accordion keydown.zf.accordion').on('click.zf.accordion', function (e) { 3032 // $(this).children('a').on('click.zf.accordion', function(e) { 3033 e.preventDefault(); 3034 if ($elem.hasClass('is-active')) { 3035 if (_this.options.allowAllClosed || $elem.siblings().hasClass('is-active')) { 3036 _this.up($tabContent); 3037 } 3038 } else { 3039 _this.down($tabContent); 3040 } 3041 }).on('keydown.zf.accordion', function (e) { 3042 Foundation.Keyboard.handleKey(e, 'Accordion', { 3043 toggle: function () { 3044 _this.toggle($tabContent); 3045 }, 3046 next: function () { 3047 $elem.next().find('a').focus().trigger('click.zf.accordion'); 3048 }, 3049 previous: function () { 3050 $elem.prev().find('a').focus().trigger('click.zf.accordion'); 3051 }, 3052 handled: function () { 3053 e.preventDefault(); 3054 e.stopPropagation(); 3055 } 3056 }); 3057 }); 3058 } 3059 }); 3060 } 3061 3062 /** 3063 * Toggles the selected content pane's open/close state. 3064 * @param {jQuery} $target - jQuery object of the pane to toggle. 3065 * @function 3066 */ 3067 3068 }, { 3069 key: 'toggle', 3070 value: function toggle($target) { 3071 if ($target.parent().hasClass('is-active')) { 3072 if (this.options.allowAllClosed || $target.parent().siblings().hasClass('is-active')) { 3073 this.up($target); 3074 } else { 3075 return; 3076 } 3077 } else { 3078 this.down($target); 3079 } 3080 } 3081 3082 /** 3083 * Opens the accordion tab defined by `$target`. 3084 * @param {jQuery} $target - Accordion pane to open. 3085 * @param {Boolean} firstTime - flag to determine if reflow should happen. 3086 * @fires Accordion#down 3087 * @function 3088 */ 3089 3090 }, { 3091 key: 'down', 3092 value: function down($target, firstTime) { 3093 var _this = this; 3094 if (!this.options.multiExpand && !firstTime) { 3095 var $currentActive = this.$element.find('.is-active').children('[data-tab-content]'); 3096 if ($currentActive.length) { 3097 this.up($currentActive); 3098 } 3099 } 3100 3101 $target.attr('aria-hidden', false).parent('[data-tab-content]').addBack().parent().addClass('is-active'); 3102 3103 // Foundation.Move(_this.options.slideSpeed, $target, function(){ 3104 $target.slideDown(_this.options.slideSpeed, function () { 3105 /** 3106 * Fires when the tab is done opening. 3107 * @event Accordion#down 3108 */ 3109 _this.$element.trigger('down.zf.accordion', [$target]); 3110 }); 3111 // }); 3112 3113 // if(!firstTime){ 3114 // Foundation._reflow(this.$element.attr('data-accordion')); 3115 // } 3116 $('#' + $target.attr('aria-labelledby')).attr({ 3117 'aria-expanded': true, 3118 'aria-selected': true 3119 }); 3120 } 3121 3122 /** 3123 * Closes the tab defined by `$target`. 3124 * @param {jQuery} $target - Accordion tab to close. 3125 * @fires Accordion#up 3126 * @function 3127 */ 3128 3129 }, { 3130 key: 'up', 3131 value: function up($target) { 3132 var $aunts = $target.parent().siblings(), 3133 _this = this; 3134 var canClose = this.options.multiExpand ? $aunts.hasClass('is-active') : $target.parent().hasClass('is-active'); 3135 3136 if (!this.options.allowAllClosed && !canClose) { 3137 return; 3138 } 3139 3140 // Foundation.Move(this.options.slideSpeed, $target, function(){ 3141 $target.slideUp(_this.options.slideSpeed, function () { 3142 /** 3143 * Fires when the tab is done collapsing up. 3144 * @event Accordion#up 3145 */ 3146 _this.$element.trigger('up.zf.accordion', [$target]); 3147 }); 3148 // }); 3149 3150 $target.attr('aria-hidden', true).parent().removeClass('is-active'); 3151 3152 $('#' + $target.attr('aria-labelledby')).attr({ 3153 'aria-expanded': false, 3154 'aria-selected': false 3155 }); 3156 } 3157 3158 /** 3159 * Destroys an instance of an accordion. 3160 * @fires Accordion#destroyed 3161 * @function 3162 */ 3163 3164 }, {
3165 key: 'destroy', 3166 value: function destroy() { 3167 this.$element.find('[data-tab-content]').slideUp(0).css('display', ''); 3168 this.$element.find('a').off('.zf.accordion'); 3169 3170 Foundation.unregisterPlugin(this); 3171 } 3172 }]); 3173 3174 return Accordion; 3175 }(); 3176 3177 Accordion.defaults = { 3178 /** 3179 * Amount of time to animate the opening of an accordion pane. 3180 * @option 3181 * @example 250 3182 */ 3183 slideSpeed: 250, 3184 /** 3185 * Allow the accordion to have multiple open panes. 3186 * @option 3187 * @example false 3188 */ 3189 multiExpand: false, 3190 /** 3191 * Allow the accordion to close all panes. 3192 * @option 3193 * @example false 3194 */ 3195 allowAllClosed: false 3196 }; 3197 3198 // Window exports 3199 Foundation.plugin(Accordion, 'Accordion'); 3200}(jQuery); 3201'use strict'; 3202 3203var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 3204 3205function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 3206 3207// !function ($) { 3208 3209// /** 3210// * AccordionMenu module. 3211// * @module foundation.accordionMenu 3212// * @requires foundation.util.keyboard 3213// * @requires foundation.util.motion 3214// * @requires foundation.util.nest 3215// */ 3216 3217// var AccordionMenu = function () { 3218// /** 3219// * Creates a new instance of an accordion menu. 3220// * @class 3221// * @fires AccordionMenu#init 3222// * @param {jQuery} element - jQuery object to make into an accordion menu. 3223// * @param {Object} options - Overrides to the default plugin settings. 3224// */ 3225 3226// function AccordionMenu(element, options) { 3227// _classCallCheck(this, AccordionMenu); 3228 3229// this.$element = element; 3230// this.options = $.extend({}, AccordionMenu.defaults, this.$element.data(), options); 3231 3232// Foundation.Nest.Feather(this.$element, 'accordion'); 3233 3234// this._init(); 3235 3236// Foundation.registerPlugin(this, 'AccordionMenu'); 3237// Foundation.Keyboard.register('AccordionMenu', { 3238// 'ENTER': 'toggle', 3239// 'SPACE': 'toggle', 3240// 'ARROW_RIGHT': 'open', 3241// 'ARROW_UP': 'up', 3242// 'ARROW_DOWN': 'down', 3243// 'ARROW_LEFT': 'close', 3244// 'ESCAPE': 'closeAll', 3245// 'TAB': 'down', 3246// 'SHIFT_TAB': 'up' 3247// }); 3248// } 3249 3250// /** 3251// * Initializes the accordion menu by hiding all nested menus. 3252// * @private 3253// */ 3254 3255 3256// _createClass(AccordionMenu, [{ 3257// key: '_init', 3258// value: function _init() { 3259// this.$element.find('[data-submenu]').not('.is-active').slideUp(0); //.find('a').css('padding-left', '1rem'); 3260// this.$element.attr({ 3261// 'role': 'tablist', 3262// 'aria-multiselectable': this.options.multiOpen 3263// }); 3264 3265// this.$menuLinks = this.$element.find('.is-accordion-submenu-parent'); 3266// this.$menuLinks.each(function () { 3267// var linkId = this.id || Foundation.GetYoDigits(6, 'acc-menu-link'), 3268// $elem = $(this), 3269// $sub = $elem.children('[data-submenu]'), 3270// subId = $sub[0].id || Foundation.GetYoDigits(6, 'acc-menu'), 3271// isActive = $sub.hasClass('is-active'); 3272// $elem.attr({ 3273// 'aria-controls': subId, 3274// 'aria-expanded': isActive, 3275// 'role': 'tab', 3276// 'id': linkId 3277// }); 3278// $sub.attr({ 3279// 'aria-labelledby': linkId, 3280// 'aria-hidden': !isActive, 3281// 'role': 'tabpanel', 3282// 'id': subId 3283// }); 3284// }); 3285// var initPanes = this.$element.find('.is-active'); 3286// if (initPanes.length) { 3287// var _this = this; 3288// initPanes.each(function () { 3289// _this.down($(this)); 3290// }); 3291// } 3292// this._events(); 3293// } 3294 3295// /** 3296// * Adds event handlers for items within the menu. 3297// * @private 3298// */ 3299 3300// }, { 3301// key: '_events', 3302// value: function _events() { 3303// var _this = this; 3304 3305// this.$element.find('li').each(function () { 3306// var $submenu = $(this).children('[data-submenu]'); 3307 3308// if ($submenu.length) { 3309// $(this).children('a').off('click.zf.accordionMenu').on('click.zf.accordionMenu', function (e) { 3310// e.preventDefault(); 3311 3312// _this.toggle($submenu); 3313// }); 3314// } 3315// }).on('keydown.zf.accordionmenu', function (e) { 3316// var $element = $(this), 3317// $elements = $element.parent('ul').children('li'), 3318// $prevElement, 3319// $nextElement, 3320// $target = $element.children('[data-submenu]'); 3321 3322// $elements.each(function (i) { 3323// if ($(this).is($element)) { 3324// $prevElement = $elements.eq(Math.max(0, i - 1)); 3325// $nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1)); 3326 3327// if ($(this).children('[data-submenu]:visible').length) { 3328// // has open sub menu 3329// $nextElement = $element.find('li:first-child'); 3330// } 3331// if ($(this).is(':first-child')) { 3332// // is first element of sub menu 3333// $prevElement = $element.parents('li').first(); 3334// } else if ($prevElement.children('[data-submenu]:visible').length) { 3335// // if previous element has open sub menu 3336// $prevElement = $prevElement.find('li:last-child'); 3337// } 3338// if ($(this).is(':last-child')) { 3339// // is last element of sub menu 3340// $nextElement = $element.parents('li').first().next('li'); 3341// } 3342 3343// return; 3344// } 3345// }); 3346// Foundation.Keyboard.handleKey(e, 'AccordionMenu', { 3347// open: function () { 3348// if ($target.is(':hidden')) { 3349// _this.down($target); 3350// $target.find('li').first().focus(); 3351// } 3352// }, 3353// close: function () { 3354// if ($target.length && !$target.is(':hidden')) { 3355// // close active sub of this item 3356// _this.up($target); 3357// } else if ($element.parent('[data-submenu]').length) { 3358// // close currently open sub 3359// _this.up($element.parent('[data-submenu]')); 3360// $element.parents('li').first().focus(); 3361// } 3362// }, 3363// up: function () { 3364// $prevElement.focus(); 3365// }, 3366// down: function () { 3367// $nextElement.focus(); 3368// }, 3369// toggle: function () { 3370// if ($element.children('[data-submenu]').length) { 3371// _this.toggle($element.children('[data-submenu]')); 3372// } 3373// }, 3374// closeAll: function () { 3375// _this.hideAll(); 3376// }, 3377// handled: function () { 3378// e.preventDefault(); 3379// e.stopImmediatePropagation(); 3380// } 3381// }); 3382// }); //.attr('tabindex', 0); 3383// } 3384 3385// /** 3386// * Closes all panes of the menu. 3387// * @function 3388// */ 3389 3390// }, { 3391// key: 'hideAll', 3392// value: function hideAll() {
3393// this.$element.find('[data-submenu]').slideUp(this.options.slideSpeed); 3394// } 3395 3396// /** 3397// * Toggles the open/close state of a submenu. 3398// * @function 3399// * @param {jQuery} $target - the submenu to toggle 3400// */ 3401 3402// }, { 3403// key: 'toggle', 3404// value: function toggle($target) { 3405// if (!$target.is(':animated')) { 3406// if (!$target.is(':hidden')) { 3407// this.up($target); 3408// } else { 3409// this.down($target); 3410// } 3411// } 3412// } 3413 3414// /** 3415// * Opens the sub-menu defined by `$target`. 3416// * @param {jQuery} $target - Sub-menu to open. 3417// * @fires AccordionMenu#down 3418// */ 3419 3420// }, { 3421// key: 'down', 3422// value: function down($target) { 3423// var _this = this; 3424 3425// if (!this.options.multiOpen) { 3426// this.up(this.$element.find('.is-active').not($target.parentsUntil(this.$element).add($target))); 3427// } 3428 3429// $target.addClass('is-active').attr({ 'aria-hidden': false }).parent('.is-accordion-submenu-parent').attr({ 'aria-expanded': true }); 3430 3431// Foundation.Move(this.options.slideSpeed, $target, function () { 3432// $target.slideDown(_this.options.slideSpeed, function () { 3433// /** 3434// * Fires when the menu is done opening. 3435// * @event AccordionMenu#down 3436// */ 3437// _this.$element.trigger('down.zf.accordionMenu', [$target]); 3438// }); 3439// }); 3440// } 3441 3442// /** 3443// * Closes the sub-menu defined by `$target`. All sub-menus inside the target will be closed as well. 3444// * @param {jQuery} $target - Sub-menu to close. 3445// * @fires AccordionMenu#up 3446// */ 3447 3448// }, { 3449// key: 'up', 3450// value: function up($target) { 3451// var _this = this; 3452// Foundation.Move(this.options.slideSpeed, $target, function () { 3453// $target.slideUp(_this.options.slideSpeed, function () { 3454// /** 3455// * Fires when the menu is done collapsing up. 3456// * @event AccordionMenu#up 3457// */ 3458// _this.$element.trigger('up.zf.accordionMenu', [$target]); 3459// }); 3460// }); 3461 3462// var $menus = $target.find('[data-submenu]').slideUp(0).addBack().attr('aria-hidden', true); 3463 3464// $menus.parent('.is-accordion-submenu-parent').attr('aria-expanded', false); 3465// } 3466 3467// /** 3468// * Destroys an instance of accordion menu. 3469// * @fires AccordionMenu#destroyed 3470// */ 3471 3472// }, { 3473// key: 'destroy', 3474// value: function destroy() { 3475// this.$element.find('[data-submenu]').slideDown(0).css('display', ''); 3476// this.$element.find('a').off('click.zf.accordionMenu'); 3477 3478// Foundation.Nest.Burn(this.$element, 'accordion'); 3479// Foundation.unregisterPlugin(this); 3480// } 3481// }]); 3482 3483// return AccordionMenu; 3484// }(); 3485 3486// AccordionMenu.defaults = { 3487// /** 3488// * Amount of time to animate the opening of a submenu in ms. 3489// * @option 3490// * @example 250 3491// */ 3492// slideSpeed: 250, 3493// /** 3494// * Allow the menu to have multiple open panes. 3495// * @option 3496// * @example true 3497// */ 3498// multiOpen: true 3499// }; 3500 3501// // Window exports 3502// Foundation.plugin(AccordionMenu, 'AccordionMenu'); 3503// }(jQuery); 3504'use strict'; 3505 3506var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 3507 3508function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 3509 3510// !function ($) { 3511 3512// /** 3513// * Drilldown module. 3514// * @module foundation.drilldown 3515// * @requires foundation.util.keyboard 3516// * @requires foundation.util.motion 3517// * @requires foundation.util.nest 3518// */ 3519 3520// var Drilldown = function () { 3521// /** 3522// * Creates a new instance of a drilldown menu. 3523// * @class 3524// * @param {jQuery} element - jQuery object to make into an accordion menu. 3525// * @param {Object} options - Overrides to the default plugin settings. 3526// */ 3527 3528// function Drilldown(element, options) { 3529// _classCallCheck(this, Drilldown); 3530 3531// this.$element = element; 3532// this.options = $.extend({}, Drilldown.defaults, this.$element.data(), options); 3533 3534// Foundation.Nest.Feather(this.$element, 'drilldown'); 3535 3536// this._init(); 3537 3538// Foundation.registerPlugin(this, 'Drilldown'); 3539// Foundation.Keyboard.register('Drilldown', { 3540// 'ENTER': 'open', 3541// 'SPACE': 'open',
3542// 'ARROW_RIGHT': 'next', 3543// 'ARROW_UP': 'up', 3544// 'ARROW_DOWN': 'down', 3545// 'ARROW_LEFT': 'previous', 3546// 'ESCAPE': 'close', 3547// 'TAB': 'down', 3548// 'SHIFT_TAB': 'up' 3549// }); 3550// } 3551 3552// /** 3553// * Initializes the drilldown by creating jQuery collections of elements 3554// * @private 3555// */ 3556 3557 3558// _createClass(Drilldown, [{ 3559// key: '_init', 3560// value: function _init() { 3561// this.$submenuAnchors = this.$element.find('li.is-drilldown-submenu-parent'); 3562// this.$submenus = this.$submenuAnchors.children('[data-submenu]'); 3563// this.$menuItems = this.$element.find('li').not('.js-drilldown-back').attr('role', 'menuitem'); 3564 3565// this._prepareMenu(); 3566 3567// this._keyboardEvents(); 3568// } 3569 3570// /** 3571// * prepares drilldown menu by setting attributes to links and elements 3572// * sets a min height to prevent content jumping 3573// * wraps the element if not already wrapped 3574// * @private 3575// * @function 3576// */ 3577 3578// }, { 3579// key: '_prepareMenu', 3580// value: function _prepareMenu() { 3581// var _this = this; 3582// // if(!this.options.holdOpen){ 3583// // this._menuLinkEvents(); 3584// // } 3585// this.$submenuAnchors.each(function () { 3586// var $sub = $(this); 3587// var $link = $sub.find('a:first'); 3588// if (_this.options.parentLink) { 3589// $link.clone().prependTo($sub.children('[data-submenu]')).wrap('<li class="is-submenu-parent-item is-submenu-item is-drilldown-submenu-item" role="menu-item"></li>'); 3590// } 3591// $link.data('savedHref', $link.attr('href')).removeAttr('href'); 3592// $sub.children('[data-submenu]').attr({ 3593// 'aria-hidden': true, 3594// 'tabindex': 0, 3595// 'role': 'menu' 3596// }); 3597// _this._events($sub); 3598// }); 3599// this.$submenus.each(function () { 3600// var $menu = $(this), 3601// $back = $menu.find('.js-drilldown-back'); 3602// if (!$back.length) { 3603// $menu.prepend(_this.options.backButton); 3604// } 3605// _this._back($menu); 3606// }); 3607// if (!this.$element.parent().hasClass('is-drilldown')) { 3608// this.$wrapper = $(this.options.wrapper).addClass('is-drilldown').css(this._getMaxDims()); 3609// this.$element.wrap(this.$wrapper); 3610// } 3611// } 3612 3613// /** 3614// * Adds event handlers to elements in the menu. 3615// * @function 3616// * @private 3617// * @param {jQuery} $elem - the current menu item to add handlers to. 3618// */ 3619 3620// }, { 3621// key: '_events', 3622// value: function _events($elem) { 3623// var _this = this; 3624 3625// $elem.off('click.zf.drilldown').on('click.zf.drilldown', function (e) { 3626// if ($(e.target).parentsUntil('ul', 'li').hasClass('is-drilldown-submenu-parent')) { 3627// e.stopImmediatePropagation(); 3628// e.preventDefault(); 3629// } 3630 3631// // if(e.target !== e.currentTarget.firstElementChild){ 3632// // return false; 3633// // } 3634// _this._show($elem); 3635 3636// if (_this.options.closeOnClick) { 3637// var $body = $('body').not(_this.$wrapper); 3638// $body.off('.zf.drilldown').on('click.zf.drilldown', function (e) { 3639// e.preventDefault(); 3640// _this._hideAll(); 3641// $body.off('.zf.drilldown'); 3642// }); 3643// } 3644// }); 3645// } 3646 3647// /** 3648// * Adds keydown event listener to `li`'s in the menu. 3649// * @private 3650// */ 3651 3652// }, { 3653// key: '_keyboardEvents', 3654// value: function _keyboardEvents() { 3655// var _this = this; 3656// this.$menuItems.add(this.$element.find('.js-drilldown-back')).on('keydown.zf.drilldown', function (e) { 3657// var $element = $(this), 3658// $elements = $element.parent('ul').children('li'), 3659// $prevElement, 3660// $nextElement; 3661 3662// $elements.each(function (i) { 3663// if ($(this).is($element)) { 3664// $prevElement = $elements.eq(Math.max(0, i - 1)); 3665// $nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1)); 3666// return; 3667// } 3668// }); 3669// Foundation.Keyboard.handleKey(e, 'Drilldown', { 3670// next: function () { 3671// if ($element.is(_this.$submenuAnchors)) { 3672// _this._show($element); 3673// $element.on(Foundation.transitionend($element), function () { 3674// $element.find('ul li').filter(_this.$menuItems).first().focus(); 3675// }); 3676// } 3677// }, 3678// previous: function () { 3679// _this._hide($element.parent('ul')); 3680// $element.parent('ul').on(Foundation.transitionend($element), function () { 3681// setTimeout(function () { 3682// $element.parent('ul').parent('li').focus(); 3683// }, 1); 3684// }); 3685// }, 3686// up: function () { 3687// $prevElement.focus(); 3688// }, 3689// down: function () { 3690// $nextElement.focus(); 3691// }, 3692// close: function () { 3693// _this._back(); 3694// //_this.$menuItems.first().focus(); // focus to first element 3695// }, 3696// open: function () { 3697// if (!$element.is(_this.$menuItems)) { 3698// // not menu item means back button 3699// _this._hide($element.parent('ul')); 3700// setTimeout(function () { 3701// $element.parent('ul').parent('li').focus(); 3702// }, 1); 3703// } else if ($element.is(_this.$submenuAnchors)) { 3704// _this._show($element); 3705// setTimeout(function () { 3706// $element.find('ul li').filter(_this.$menuItems).first().focus(); 3707// }, 1); 3708// } 3709// }, 3710// handled: function () { 3711// e.preventDefault(); 3712// e.stopImmediatePropagation(); 3713// } 3714// }); 3715// }); // end keyboardAccess 3716// } 3717 3718// /** 3719// * Closes all open elements, and returns to root menu. 3720// * @function 3721// * @fires Drilldown#closed 3722// */ 3723 3724// }, { 3725// key: '_hideAll', 3726// value: function _hideAll() { 3727// var $elem = this.$element.find('.is-drilldown-submenu.is-active').addClass('is-closing'); 3728// $elem.one(Foundation.transitionend($elem), function (e) { 3729// $elem.removeClass('is-active is-closing'); 3730// }); 3731// /** 3732// * Fires when the menu is fully closed. 3733// * @event Drilldown#closed 3734// */ 3735// this.$element.trigger('closed.zf.drilldown'); 3736// } 3737 3738// /** 3739// * Adds event listener for each `back` button, and closes open menus. 3740// * @function 3741// * @fires Drilldown#back 3742// * @param {jQuery} $elem - the current sub-menu to add `back` event. 3743// */ 3744 3745// }, { 3746// key: '_back', 3747// value: function _back($elem) { 3748// var _this = this; 3749// $elem.off('click.zf.drilldown'); 3750// $elem.children('.js-drilldown-back').on('click.zf.drilldown', function (e) { 3751// e.stopImmediatePropagation(); 3752// // console.log('mouseup on back'); 3753// _this._hide($elem); 3754// }); 3755// } 3756 3757// /** 3758// * Adds event listener to menu items w/o submenus to close open menus on click. 3759// * @function 3760// * @private 3761// */ 3762 3763// }, { 3764// key: '_menuLinkEvents', 3765// value: function _menuLinkEvents() { 3766// var _this = this; 3767// this.$menuItems.not('.is-drilldown-submenu-parent').off('click.zf.drilldown').on('click.zf.drilldown', function (e) { 3768// // e.stopImmediatePropagation(); 3769// setTimeout(function () { 3770// _this._hideAll(); 3771// }, 0); 3772// }); 3773// } 3774 3775// /** 3776// * Opens a submenu. 3777// * @function 3778// * @fires Drilldown#open 3779// * @param {jQuery} $elem - the current element with a submenu to open. 3780// */ 3781 3782// }, { 3783// key: '_show', 3784// value: function _show($elem) { 3785// $elem.children('[data-submenu]').addClass('is-active'); 3786 3787// this.$element.trigger('open.zf.drilldown', [$elem]); 3788// } 3789// }, { 3790// key: '_hide', 3791 3792 3793// /** 3794// * Hides a submenu 3795// * @function 3796// * @fires Drilldown#hide 3797// * @param {jQuery} $elem - the current sub-menu to hide. 3798// */ 3799// value: function _hide($elem) { 3800// var _this = this; 3801// $elem.addClass('is-closing').one(Foundation.transitionend($elem), function () { 3802// $elem.removeClass('is-active is-closing'); 3803// $elem.blur(); 3804// }); 3805// /** 3806// * Fires when the submenu is has closed. 3807// * @event Drilldown#hide 3808// */ 3809// $elem.trigger('hide.zf.drilldown', [$elem]); 3810// } 3811 3812// /** 3813// * Iterates through the nested menus to calculate the min-height, and max-width for the menu. 3814// * Prevents content jumping. 3815// * @function 3816// * @private 3817// */ 3818 3819// }, { 3820// key: '_getMaxDims', 3821// value: function _getMaxDims() { 3822// var max = 0, 3823// result = {}; 3824// this.$submenus.add(this.$element).each(function () { 3825// var numOfElems = $(this).children('li').length; 3826// max = numOfElems > max ? numOfElems : max; 3827// }); 3828 3829// result['min-height'] = max * this.$menuItems[0].getBoundingClientRect().height + 'px'; 3830// result['max-width'] = this.$element[0].getBoundingClientRect().width + 'px'; 3831 3832// return result; 3833// } 3834 3835// /** 3836// * Destroys the Drilldown Menu 3837// * @function 3838// */ 3839 3840// }, { 3841// key: 'destroy', 3842// value: function destroy() { 3843// this._hideAll(); 3844// Foundation.Nest.Burn(this.$element, 'drilldown'); 3845// this.$element.unwrap().find('.js-drilldown-back, .is-submenu-parent-item').remove().end().find('.is-active, .is-closing, .is-drilldown-submenu').removeClass('is-active is-closing is-drilldown-submenu').end().find('[data-submenu]').removeAttr('aria-hidden tabindex role').off('.zf.drilldown').end().off('zf.drilldown'); 3846// this.$element.find('a').each(function () { 3847// var $link = $(this); 3848// if ($link.data('savedHref')) { 3849// $link.attr('href', $link.data('savedHref')).removeData('savedHref'); 3850// } else { 3851// return; 3852// } 3853// }); 3854// Foundation.unregisterPlugin(this); 3855// } 3856// }]); 3857 3858// return Drilldown; 3859// }(); 3860 3861// Drilldown.defaults = { 3862// /** 3863// * Markup used for JS generated back button. Prepended to submenu lists and deleted on `destroy` method, 'js-drilldown-back' class required. Remove the backslash (`\`) if copy and pasting. 3864// * @option 3865// * @example '<\li><\a>Back<\/a><\/li>' 3866// */ 3867// backButton: '<li class="js-drilldown-back"><a>Back</a></li>', 3868// /** 3869// * Markup used to wrap drilldown menu. Use a class name for independent styling; the JS applied class: `is-drilldown` is required. Remove the backslash (`\`) if copy and pasting. 3870// * @option 3871// * @example '<\div class="is-drilldown"><\/div>' 3872// */ 3873// wrapper: '<div></div>', 3874// /** 3875// * Adds the parent link to the submenu. 3876// * @option 3877// * @example false 3878// */ 3879// parentLink: false, 3880// /** 3881// * Allow the menu to return to root list on body click. 3882// * @option 3883// * @example false 3884// */ 3885// closeOnClick: false 3886// // holdOpen: false 3887// }; 3888 3889// // Window exports 3890// Foundation.plugin(Drilldown, 'Drilldown'); 3891// }(jQuery); 3892'use strict'; 3893 3894var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 3895 3896function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 3897 3898!function ($) { 3899 3900 /** 3901 * Dropdown module. 3902 * @module foundation.dropdown 3903 * @requires foundation.util.keyboard 3904 * @requires foundation.util.box 3905 * @requires foundation.util.triggers 3906 */ 3907 3908 var Dropdown = function () { 3909 /** 3910 * Creates a new instance of a dropdown. 3911 * @class 3912 * @param {jQuery} element - jQuery object to make into a dropdown. 3913 * Object should be of the dropdown panel, rather than
3913its anchor. 3914 * @param {Object} options - Overrides to the default plugin settings. 3915 */ 3916 3917 function Dropdown(element, options) { 3918 _classCallCheck(this, Dropdown); 3919 3920 this.$element = element; 3921 this.options = $.extend({}, Dropdown.defaults, this.$element.data(), options); 3922 this._init(); 3923 3924 Foundation.registerPlugin(this, 'Dropdown'); 3925 Foundation.Keyboard.register('Dropdown', { 3926 'ENTER': 'open', 3927 'SPACE': 'open', 3928 'ESCAPE': 'close', 3929 'TAB': 'tab_forward', 3930 'SHIFT_TAB': 'tab_backward' 3931 }); 3932 } 3933 3934 /** 3935 * Initializes the plugin by setting/checking options and attributes, adding helper variables, and saving the anchor. 3936 * @function 3937 * @private 3938 */ 3939 3940 3941 _createClass(Dropdown, [{ 3942 key: '_init', 3943 value: function _init() { 3944 var $id = this.$element.attr('id'); 3945 3946 this.$anchor = $('[data-toggle="' + $id + '"]') || $('[data-open="' + $id + '"]'); 3947 this.$anchor.attr({ 3948 'aria-controls': $id, 3949 'data-is-focus': false, 3950 'data-yeti-box': $id, 3951 'aria-haspopup': true, 3952 'aria-expanded': false 3953 3954 }); 3955 3956 this.options.positionClass = this.getPositionClass(); 3957 this.counter = 4; 3958 this.usedPositions = []; 3959 this.$element.attr({ 3960 'aria-hidden': 'true', 3961 'data-yeti-box': $id, 3962 'data-resize': $id, 3963 'aria-labelledby': this.$anchor[0].id || Foundation.GetYoDigits(6, 'dd-anchor') 3964 }); 3965 this._events(); 3966 } 3967 3968 /** 3969 * Helper function to determine current orientation of dropdown pane. 3970 * @function 3971 * @returns {String} position - string value of a position class. 3972 */ 3973 3974 }, { 3975 key: 'getPositionClass', 3976 value: function getPositionClass() { 3977 var position = this.$element[0].className.match(/\b(top|left|right)\b/g); 3978 position = position ? position[0] : ''; 3979 return position; 3980 } 3981 3982 /** 3983 * Adjusts the dropdown panes orientation by adding/removing positioning classes. 3984 * @function 3985 * @private 3986 * @param {String} position - position class to remove. 3987 */ 3988 3989 }, { 3990 key: '_reposition', 3991 value: function _reposition(position) { 3992 this.usedPositions.push(position ? position : 'bottom'); 3993 //default, try switching to opposite side 3994 if (!position && this.usedPositions.indexOf('top') < 0) { 3995 this.$element.addClass('top'); 3996 } else if (position === 'top' && this.usedPositions.indexOf('bottom') < 0) { 3997 this.$element.removeClass(position); 3998 } else if (position === 'left' && this.usedPositions.indexOf('right') < 0) { 3999 this.$element.removeClass(position).addClass('right'); 4000 } else if (position === 'right' && this.usedPositions.indexOf('left') < 0) { 4001 this.$element.removeClass(position).addClass('left'); 4002 } 4003 4004 //if default change didn't work, try bottom or left first 4005 else if (!position && this.usedPositions.indexOf('top') > -1 && this.usedPositions.indexOf('left') < 0) { 4006 this.$element.addClass('left'); 4007 } else if (position === 'top' && this.usedPositions.indexOf('bottom') > -1 && this.usedPositions.indexOf('left') < 0) { 4008 this.$element.removeClass(position).addClass('left'); 4009 } else if (position === 'left' && this.usedPositions.indexOf('right') > -1 && this.usedPositions.indexOf('bottom') < 0) { 4010 this.$element.removeClass(position); 4011 } else if (position === 'right' && this.usedPositions.indexOf('left') > -1 && this.usedPositions.indexOf('bottom') < 0) { 4012 this.$element.removeClass(position); 4013 } 4014 //if nothing cleared, set to bottom 4015 else { 4016 this.$element.removeClass(position); 4017 } 4018 this.classChanged = true; 4019 this.counter--; 4020 } 4021 4022 /** 4023 * Sets the position and orientation of the dropdown pane, checks for collisions. 4024 * Recursively calls itself if a collision is detected, with a new position class. 4025 * @function 4026 * @private 4027 */ 4028 4029 }, {
4030 key: '_setPosition', 4031 value: function _setPosition() { 4032 if (this.$anchor.attr('aria-expanded') === 'false') { 4033 return false; 4034 } 4035 var position = this.getPositionClass(), 4036 $eleDims = Foundation.Box.GetDimensions(this.$element), 4037 $anchorDims = Foundation.Box.GetDimensions(this.$anchor), 4038 _this = this, 4039 direction = position === 'left' ? 'left' : position === 'right' ? 'left' : 'top', 4040 param = direction === 'top' ? 'height' : 'width', 4041 offset = param === 'height' ? this.options.vOffset : this.options.hOffset; 4042 4043 if ($eleDims.width >= $eleDims.windowDims.width || !this.counter && !Foundation.Box.ImNotTouchingYou(this.$element)) { 4044 this.$element.offset(Foundation.Box.GetOffsets(this.$element, this.$anchor, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({ 4045 'width': $eleDims.windowDims.width - this.options.hOffset * 2, 4046 'height': 'auto' 4047 }); 4048 this.classChanged = true; 4049 return false; 4050 } 4051 4052 this.$element.offset(Foundation.Box.GetOffsets(this.$element, this.$anchor, position, this.options.vOffset, this.options.hOffset)); 4053 4054 while (!Foundation.Box.ImNotTouchingYou(this.$element) && this.counter) { 4055 this._reposition(position); 4056 this._setPosition(); 4057 } 4058 } 4059 4060 /** 4061 * Adds event listeners to the element utilizing the triggers utility library. 4062 * @function 4063 * @private 4064 */ 4065 4066 }, { 4067 key: '_events', 4068 value: function _events() { 4069 var _this = this; 4070 this.$element.on({ 4071 'open.zf.trigger': this.open.bind(this), 4072 'close.zf.trigger': this.close.bind(this), 4073 'toggle.zf.trigger': this.toggle.bind(this), 4074 'resizeme.zf.trigger': this._setPosition.bind(this) 4075 }); 4076 4077 if (this.options.hover) { 4078 this.$anchor.off('mouseenter.zf.dropdown mouseleave.zf.dropdown').on('mouseenter.zf.dropdown', function () { 4079 clearTimeout(_this.timeout); 4080 _this.timeout = setTimeout(function () { 4081 _this.open(); 4082 _this.$anchor.data('hover', true); 4083 }, _this.options.hoverDelay); 4084 }).on('mouseleave.zf.dropdown', function () { 4085 clearTimeout(_this.timeout); 4086 _this.timeout = setTimeout(function () { 4087 _this.close(); 4088 _this.$anchor.data('hover', false); 4089 }, _this.options.hoverDelay); 4090 }); 4091 if (this.options.hoverPane) { 4092 this.$element.off('mouseenter.zf.dropdown mouseleave.zf.dropdown').on('mouseenter.zf.dropdown', function () { 4093 clearTimeout(_this.timeout); 4094 }).on('mouseleave.zf.dropdown', function () { 4095 clearTimeout(_this.timeout); 4096 _this.timeout = setTimeout(function () { 4097 _this.close(); 4098 _this.$anchor.data('hover', false); 4099 }, _this.options.hoverDelay); 4100 }); 4101 } 4102 } 4103 this.$anchor.add(this.$element).on('keydown.zf.dropdown', function (e) { 4104 4105 var $target = $(this), 4106 visibleFocusableElements = Foundation.Keyboard.findFocusable(_this.$element); 4107 4108 Foundation.Keyboard.handleKey(e, 'Dropdown', { 4109 tab_forward: function () { 4110 if (_this.$element.find(':focus').is(visibleFocusableElements.eq(-1))) { 4111 // left modal downwards, setting focus to first element 4112 if (_this.options.trapFocus) { 4113 // if focus shall be trapped 4114 visibleFocusableElements.eq(0).focus(); 4115 e.preventDefault(); 4116 } else { 4117 // if focus is not trapped, close dropdown on focus out 4118 _this.close(); 4119 } 4120 } 4121 }, 4122 tab_backward: function () { 4123 if (_this.$element.find(':focus').is(visibleFocusableElements.eq(0)) || _this.$element.is(':focus')) { 4124 // left modal upwards, setting focus to last element 4125 if (_this.options.trapFocus) { 4126 // if focus shall be trapped 4127 visibleFocusableElements.eq(-1).focus(); 4128 e.preventDefault(); 4129 } else { 4130 // if focus is not trapped, close dropdown on focus out 4131 _this.close(); 4132 } 4133 } 4134 }, 4135 open: function () { 4136 if ($target.is(_this.$anchor)) { 4137 _this.open(); 4138 _this.$element.attr('tabindex', -1).focus(); 4139 e.preventDefault(); 4140 } 4141 }, 4142 close: function () { 4143 _this.close(); 4144 _this.$anchor.focus(); 4145 } 4146 }); 4147 }); 4148 } 4149 4150 /** 4151 * Adds an event handler to the body to close any dropdowns on a click. 4152 * @function 4153 * @private 4154 */ 4155 4156 }, {
4157 key: '_addBodyHandler', 4158 value: function _addBodyHandler() { 4159 var $body = $(document.body).not(this.$element), 4160 _this = this; 4161 $body.off('click.zf.dropdown').on('click.zf.dropdown', function (e) { 4162 if (_this.$anchor.is(e.target) || _this.$anchor.find(e.target).length) { 4163 return; 4164 } 4165 if (_this.$element.find(e.target).length) { 4166 return; 4167 } 4168 _this.close(); 4169 $body.off('click.zf.dropdown'); 4170 }); 4171 } 4172 4173 /** 4174 * Opens the dropdown pane, and fires a bubbling event to close other dropdowns. 4175 * @function 4176 * @fires Dropdown#closeme 4177 * @fires Dropdown#show 4178 */ 4179 4180 }, { 4181 key: 'open', 4182 value: function open() { 4183 // var _this = this; 4184 /** 4185 * Fires to close other open dropdowns 4186 * @event Dropdown#closeme 4187 */ 4188 this.$element.trigger('closeme.zf.dropdown', this.$element.attr('id')); 4189 this.$anchor.addClass('hover').attr({ 'aria-expanded': true }); 4190 // this.$element/*.show()*/; 4191 this._setPosition(); 4192 this.$element.addClass('is-open').attr({ 'aria-hidden': false }); 4193 4194 if (this.options.autoFocus) { 4195 var $focusable = Foundation.Keyboard.findFocusable(this.$element); 4196 if ($focusable.length) { 4197 $focusable.eq(0).focus(); 4198 } 4199 } 4200 4201 if (this.options.closeOnClick) { 4202 this._addBodyHandler(); 4203 } 4204 4205 /** 4206 * Fires once the dropdown is visible. 4207 * @event Dropdown#show 4208 */ 4209 this.$element.trigger('show.zf.dropdown', [this.$element]); 4210 } 4211 4212 /** 4213 * Closes the open dropdown pane. 4214 * @function 4215 * @fires Dropdown#hide 4216 */ 4217 4218 }, { 4219 key: 'close', 4220 value: function close() { 4221 if (!this.$element.hasClass('is-open')) { 4222 return false; 4223 } 4224 this.$element.removeClass('is-open').attr({ 'aria-hidden': true }); 4225 4226 this.$anchor.removeClass('hover').attr('aria-expanded', false); 4227 4228 if (this.classChanged) { 4229 var curPositionClass = this.getPositionClass(); 4230 if (curPositionClass) { 4231 this.$element.removeClass(curPositionClass); 4232 } 4233 this.$element.addClass(this.options.positionClass) 4234 /*.hide()*/.css({ height: '', width: '' }); 4235 this.classChanged = false; 4236 this.counter = 4; 4237 this.usedPositions.length = 0; 4238 } 4239 this.$element.trigger('hide.zf.dropdown', [this.$element]); 4240 } 4241 4242 /** 4243 * Toggles the dropdown pane's visibility. 4244 * @function 4245 */ 4246 4247 }, { 4248 key: 'toggle', 4249 value: function toggle() { 4250 if (this.$element.hasClass('is-open')) { 4251 if (this.$anchor.data('hover')) return; 4252 this.close(); 4253 } else { 4254 this.open(); 4255 } 4256 } 4257 4258 /** 4259 * Destroys the dropdown. 4260 * @function 4261 */ 4262 4263 }, { 4264 key: 'destroy', 4265 value: function destroy() { 4266 this.$element.off('.zf.trigger').hide(); 4267 this.$anchor.off('.zf.dropdown'); 4268 4269 Foundation.unregisterPlugin(this); 4270 } 4271 }]); 4272 4273 return Dropdown; 4274 }(); 4275 4276 Dropdown.defaults = { 4277 /** 4278 * Amount of time to delay opening a submenu on hover event. 4279 * @option 4280 * @example 250 4281 */ 4282 hoverDelay: 250, 4283 /** 4284 * Allow submenus to open on hover events 4285 * @option 4286 * @example false 4287 */ 4288 hover: false, 4289 /** 4290 * Don't close dropdown when hovering over dropdown pane 4291 * @option 4292 * @example true 4293 */ 4294 hoverPane: false, 4295 /** 4296 * Number of pixels between the dropdown pane and the triggering element on open. 4297 * @option 4298 * @example 1 4299 */ 4300 vOffset: 1, 4301 /** 4302 * Number of pixels between the dropdown pane and the triggering element on open. 4303 * @option 4304 * @example 1 4305 */ 4306 hOffset: 1, 4307 /** 4308 * Class applied to adjust open position. JS will test and fill this in. 4309 * @option 4310 * @example 'top' 4311 */ 4312 positionClass: '', 4313 /** 4314 * Allow the plugin to trap focus to the dropdown pane if opened with keyboard commands. 4315 * @option 4316 * @example false 4317 */ 4318 trapFocus: false, 4319 /** 4320 * Allow the plugin to set focus to the first focusable element within the pane, regardless of method of opening. 4321 * @option 4322 * @example true 4323 */ 4324 autoFocus: false, 4325 /** 4326 * Allows a click on the body to close the dropdown. 4327 * @option 4328 * @example false 4329 */ 4330 closeOnClick: false 4331 }; 4332 4333 // Window exports 4334 Foundation.plugin(Dropdown, 'Dropdown'); 4335}(jQuery); 4336'use strict'; 4337 4338var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4339 4340function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4341 4342// !function ($) { 4343 4344// /** 4345// * DropdownMenu module. 4346// * @module foundation.dropdown-menu 4347// * @requires foundation.util.keyboard 4348// * @requires foundation.util.box 4349// * @requires foundation.util.nest 4350// */ 4351 4352// var DropdownMenu = function () { 4353// /** 4354// * Creates a new instance of DropdownMenu. 4355// * @class 4356// * @fires DropdownMenu#init 4357// * @param {jQuery} element - jQuery object to make into a dropdown menu. 4358// * @param {Object} options - Overrides to the default plugin settings. 4359// */ 4360 4361// function DropdownMenu(element, options) { 4362// _classCallCheck(this, DropdownMenu); 4363 4364// this.$element = element; 4365// this.options = $.extend({}, DropdownMenu.defaults, this.$element.data(), options); 4366 4367// Foundation.Nest.Feather(this.$element, 'dropdown'); 4368// this._init(); 4369 4370// Foundation.registerPlugin(this, 'DropdownMenu'); 4371// Foundation.Keyboard.register('DropdownMenu', { 4372// 'ENTER': 'open', 4373// 'SPACE': 'open',
4374// 'ARROW_RIGHT': 'next', 4375// 'ARROW_UP': 'up', 4376// 'ARROW_DOWN': 'down', 4377// 'ARROW_LEFT': 'previous', 4378// 'ESCAPE': 'close' 4379// }); 4380// } 4381 4382// /** 4383// * Initializes the plugin, and calls _prepareMenu 4384// * @private 4385// * @function 4386// */ 4387 4388 4389// _createClass(DropdownMenu, [{ 4390// key: '_init', 4391// value: function _init() { 4392// var subs = this.$element.find('li.is-dropdown-submenu-parent'); 4393// this.$element.children('.is-dropdown-submenu-parent').children('.is-dropdown-submenu').addClass('first-sub'); 4394 4395// this.$menuItems = this.$element.find('[role="menuitem"]'); 4396// this.$tabs = this.$element.children('[role="menuitem"]'); 4397// this.$tabs.find('ul.is-dropdown-submenu').addClass(this.options.verticalClass); 4398 4399// if (this.$element.hasClass(this.options.rightClass) || this.options.alignment === 'right' || Foundation.rtl()) { 4400// this.options.alignment = 'right'; 4401// subs.addClass('opens-left'); 4402// } else { 4403// subs.addClass('opens-right'); 4404// } 4405// this.changed = false; 4406// this._events(); 4407// } 4408// }, { 4409// key: '_events', 4410 4411// /** 4412// * Adds event listeners to elements within the menu 4413// * @private 4414// * @function 4415// */ 4416// value: function _events() { 4417// var _this = this, 4418// hasTouch = 'ontouchstart' in window || typeof window.ontouchstart !== 'undefined', 4419// parClass = 'is-dropdown-submenu-parent'; 4420 4421// if (this.options.clickOpen || hasTouch) { 4422// this.$menuItems.on('click.zf.dropdownmenu touchstart.zf.dropdownmenu', function (e) { 4423// var $elem = $(e.target).parentsUntil('ul', '.' + parClass), 4424// hasSub = $elem.hasClass(parClass), 4425// hasClicked = $elem.attr('data-is-click') === 'true', 4426// $sub = $elem.children('.is-dropdown-submenu'); 4427 4428// if (hasSub) { 4429// if (hasClicked) { 4430// if (!_this.options.closeOnClick || !_this.options.clickOpen && !hasTouch || _this.options.forceFollow && hasTouch) { 4431// return; 4432// } else { 4433// e.stopImmediatePropagation(); 4434// e.preventDefault(); 4435// _this._hide($elem); 4436// } 4437// } else { 4438// e.preventDefault(); 4439// e.stopImmediatePropagation(); 4440// _this._show($elem.children('.is-dropdown-submenu')); 4441// $elem.add($elem.parentsUntil(_this.$element, '.' + parClass)).attr('data-is-click', true); 4442// } 4443// } else { 4444// return; 4445// } 4446// }); 4447// } 4448 4449// if (!this.options.disableHover) { 4450// this.$menuItems.on('mouseenter.zf.dropdownmenu', function (e) { 4451// e.stopImmediatePropagation(); 4452// var $elem = $(this), 4453// hasSub = $elem.hasClass(parClass); 4454 4455// if (hasSub) { 4456// clearTimeout(_this.delay); 4457// _this.delay = setTimeout(function () { 4458// _this._show($elem.children('.is-dropdown-submenu')); 4459// }, _this.options.hoverDelay); 4460// } 4461// }).on('mouseleave.zf.dropdownmenu', function (e) { 4462// var $elem = $(this), 4463// hasSub = $elem.hasClass(parClass); 4464// if (hasSub && _this.options.autoclose) { 4465// if ($elem.attr('data-is-click') === 'true' && _this.options.clickOpen) { 4466// return false; 4467// } 4468 4469// clearTimeout(_this.delay); 4470// _this.delay = setTimeout(function () { 4471// _this._hide($elem); 4472// }, _this.options.closingTime); 4473// } 4474// }); 4475// } 4476// this.$menuItems.on('keydown.zf.dropdownmenu', function (e) { 4477// var $element = $(e.target).parentsUntil('ul', '[role="menuitem"]'), 4478// isTab = _this.$tabs.index($element) > -1, 4479// $elements = isTab ? _this.$tabs : $element.siblings('li').add($element), 4480// $prevElement, 4481// $nextElement; 4482 4483// $elements.each(function (i) { 4484// if ($(this).is($element)) { 4485// $prevElement = $elements.eq(i - 1); 4486// $nextElement = $elements.eq(i + 1); 4487// return; 4488// } 4489// }); 4490 4491// var nextSibling = function () { 4492// if (!$element.is(':last-child')) $nextElement.children('a:first').focus(); 4493// }, 4494// prevSibling = function () { 4495// $prevElement.children('a:first').focus(); 4496// }, 4497// openSub = function () {
4498// var $sub = $element.children('ul.is-dropdown-submenu'); 4499// if ($sub.length) { 4500// _this._show($sub); 4501// $element.find('li > a:first').focus(); 4502// } else { 4503// return; 4504// } 4505// }, 4506// closeSub = function () { 4507// //if ($element.is(':first-child')) { 4508// var close = $element.parent('ul').parent('li'); 4509// close.children('a:first').focus(); 4510// _this._hide(close); 4511// //} 4512// }; 4513// var functions = { 4514// open: openSub, 4515// close: function () { 4516// _this._hide(_this.$element); 4517// _this.$menuItems.find('a:first').focus(); // focus to first element 4518// }, 4519// handled: function () { 4520// e.preventDefault(); 4521// e.stopImmediatePropagation(); 4522// } 4523// }; 4524 4525// if (isTab) { 4526// if (_this.vertical) { 4527// // vertical menu 4528// if (_this.options.alignment === 'left') { 4529// // left aligned 4530// $.extend(functions, { 4531// down: nextSibling, 4532// up: prevSibling, 4533// next: openSub, 4534// previous: closeSub 4535// }); 4536// } else { 4537// // right aligned 4538// $.extend(functions, { 4539// down: nextSibling, 4540// up: prevSibling, 4541// next: closeSub, 4542// previous: openSub 4543// }); 4544// } 4545// } else { 4546// // horizontal menu 4547// $.extend(functions, { 4548// next: nextSibling, 4549// previous: prevSibling, 4550// down: openSub, 4551// up: closeSub 4552// }); 4553// } 4554// } else { 4555// // not tabs -> one sub 4556// if (_this.options.alignment === 'left') { 4557// // left aligned 4558// $.extend(functions, { 4559// next: openSub, 4560// previous: closeSub, 4561// down: nextSibling, 4562// up: prevSibling 4563// }); 4564// } else { 4565// // right aligned 4566// $.extend(functions, { 4567// next: closeSub, 4568// previous: openSub, 4569// down: nextSibling, 4570// up: prevSibling 4571// }); 4572// } 4573// } 4574// Foundation.Keyboard.handleKey(e, 'DropdownMenu', functions); 4575// }); 4576// } 4577 4578// /** 4579// * Adds an event handler to the body to close any dropdowns on a click. 4580// * @function 4581// * @private 4582// */ 4583 4584// }, { 4585// key: '_addBodyHandler', 4586// value: function _addBodyHandler() { 4587// var $body = $(document.body), 4588// _this = this; 4589// $body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu').on('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu', function (e) { 4590// var $link = _this.$element.find(e.target); 4591// if ($link.length) { 4592// return; 4593// } 4594 4595// _this._hide(); 4596// $body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu'); 4597// }); 4598// } 4599 4600// /** 4601// * Opens a dropdown pane, and checks for collisions first. 4602// * @param {jQuery} $sub - ul element that is a submenu to show 4603// * @function 4604// * @private 4605// * @fires DropdownMenu#show 4606// */ 4607 4608// }, { 4609// key: '_show', 4610// value: function _show($sub) { 4611// var idx = this.$tabs.index(this.$tabs.filter(function (i, el) { 4612// return $(el).find($sub).length > 0; 4613// })); 4614// var $sibs = $sub.parent('li.is-dropdown-submenu-parent').siblings('li.is-dropdown-submenu-parent'); 4615// this._hide($sibs, idx); 4616// $sub.css('visibility', 'hidden').addClass('js-dropdown-active').attr({ 'aria-hidden': false }).parent('li.is-dropdown-submenu-parent').addClass('is-active').attr({ 'aria-expanded': true }); 4617// var clear = Foundation.Box.ImNotTouchingYou($sub, null, true); 4618// if (!clear) { 4619// var oldClass = this.options.alignment === 'left' ? '-right' : '-left', 4620// $parentLi = $sub.parent('.is-dropdown-submenu-parent'); 4621// $parentLi.removeClass('opens' + oldClass).addClass('opens-' + this.options.alignment); 4622// clear = Foundation.Box.ImNotTouchingYou($sub, null, true); 4623// if (!clear) { 4624// $parentLi.removeClass('opens-' + this.options.alignment).addClass('opens-inner'); 4625// } 4626// this.changed = true; 4627// } 4628// $sub.css('visibility', ''); 4629// if (this.options.closeOnClick) { 4630// this._addBodyHandler(); 4631// } 4632// /** 4633// * Fires when the new dropdown pane is visible. 4634// * @event DropdownMenu#show 4635// */ 4636// this.$element.trigger('show.zf.dropdownmenu', [$sub]); 4637// } 4638 4639// /** 4640// * Hides a single, currently open dropdown pane, if passed a parameter, otherwise, hides everything. 4641// * @function 4642// * @param {jQuery} $elem - element with a submenu to hide 4643// * @param {Number} idx - index of the $tabs collection to hide 4644// * @private 4645// */ 4646 4647// }, { 4648// key: '_hide', 4649// value: function _hide($elem, idx) { 4650// var $toClose; 4651// if ($elem && $elem.length) { 4652// $toClose = $elem; 4653// } else if (idx !== undefined) { 4654// $toClose = this.$tabs.not(function (i, el) { 4655// return i === idx; 4656// }); 4657// } else { 4658// $toClose = this.$element; 4659// } 4660// var somethingToClose = $toClose.hasClass('is-active') || $toClose.find('.is-active').length > 0; 4661 4662// if (somethingToClose) { 4663// $toClose.find('li.is-active').add($toClose).attr({ 4664// 'aria-expanded': false, 4665// 'data-is-click': false 4666// }).removeClass('is-active'); 4667 4668// $toClose.find('ul.js-dropdown-active').attr({ 4669// 'aria-hidden': true 4670// }).removeClass('js-dropdown-active'); 4671 4672// if (this.changed || $toClose.find('opens-inner').length) { 4673// var oldClass = this.options.alignment === 'left' ? 'right' : 'left'; 4674// $toClose.find('li.is-dropdown-submenu-parent').add($toClose).removeClass('opens-inner opens-' + this.options.alignment).addClass('opens-' + oldClass); 4675// this.changed = false;
4676// } 4677// /** 4678// * Fires when the open menus are closed. 4679// * @event DropdownMenu#hide 4680// */ 4681// this.$element.trigger('hide.zf.dropdownmenu', [$toClose]); 4682// } 4683// } 4684 4685// /** 4686// * Destroys the plugin. 4687// * @function 4688// */ 4689 4690// }, { 4691// key: 'destroy', 4692// value: function destroy() { 4693// this.$menuItems.off('.zf.dropdownmenu').removeAttr('data-is-click').removeClass('is-right-arrow is-left-arrow is-down-arrow opens-right opens-left opens-inner'); 4694// $(document.body).off('.zf.dropdownmenu'); 4695// Foundation.Nest.Burn(this.$element, 'dropdown'); 4696// Foundation.unregisterPlugin(this); 4697// } 4698// }]); 4699 4700// return DropdownMenu; 4701// }(); 4702 4703// /** 4704// * Default settings for plugin 4705// */ 4706 4707 4708// DropdownMenu.defaults = { 4709// /** 4710// * Disallows hover events from opening submenus 4711// * @option 4712// * @example false 4713// */ 4714// disableHover: false, 4715// /** 4716// * Allow a submenu to automatically close on a mouseleave event, if not clicked open. 4717// * @option 4718// * @example true 4719// */ 4720// autoclose: true, 4721// /** 4722// * Amount of time to delay opening a submenu on hover event. 4723// * @option 4724// * @example 50 4725// */ 4726// hoverDelay: 50, 4727// /** 4728// * Allow a submenu to open/remain open on parent click event. Allows cursor to move away from menu. 4729// * @option 4730// * @example true 4731// */ 4732// clickOpen: false, 4733// /** 4734// * Amount of time to delay closing a submenu on a mouseleave event. 4735// * @option 4736// * @example 500 4737// */ 4738 4739// closingTime: 500, 4740// /** 4741// * Position of the menu relative to what direction the submenus should open. Handled by JS. 4742// * @option 4743// * @example 'left' 4744// */ 4745// alignment: 'left', 4746// /** 4747// * Allow clicks on the body to close any open submenus. 4748// * @option 4749// * @example true 4750// */ 4751// closeOnClick: true, 4752// /** 4753// * Class applied to vertical oriented menus, Foundation default is `vertical`. Update this if using your own class. 4754// * @option 4755// * @example 'vertical' 4756// */ 4757// verticalClass: 'vertical', 4758// /** 4759// * Class applied to right-side oriented menus, Foundation default is `align-right`. Update this if using your own class. 4760// * @option 4761// * @example 'align-right' 4762// */ 4763// rightClass: 'align-right', 4764// /** 4765// * Boolean to force overide the clicking of links to perform default action, on second touch event for mobile. 4766// * @option 4767// * @example false 4768// */ 4769// forceFollow: true 4770// }; 4771 4772// // Window exports 4773// Foundation.plugin(DropdownMenu, 'DropdownMenu'); 4774// }(jQuery); 4775'use strict'; 4776 4777var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4778 4779function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4780 4781!function ($) { 4782 4783 /** 4784 * Equalizer module. 4785 * @module foundation.equalizer 4786 */ 4787 4788 var Equalizer = function () { 4789 /** 4790 * Creates a new instance of Equalizer. 4791 * @class 4792 * @fires Equalizer#init 4793 * @param {Object} element - jQuery object to add the trigger to. 4794 * @param {Object} options - Overrides to the default plugin settings. 4795 */ 4796 4797 function Equalizer(element, options) { 4798 _classCallCheck(this, Equalizer); 4799 4800 this.$element = element; 4801 this.options = $.extend({}, Equalizer.defaults, this.$element.data(), options); 4802 4803 this._init(); 4804 4805 Foundation.registerPlugin(this, 'Equalizer'); 4806 } 4807 4808 /** 4809 * Initializes the Equalizer plugin and calls functions to get equalizer functioning on load. 4810 * @private 4811 */ 4812 4813 4814 _createClass(Equalizer, [{ 4815 key: '_init', 4816 value: function _init() { 4817 var eqId = this.$element.attr('data-equalizer') || ''; 4818 var $watched = this.$element.find('[data-equalizer-watch="' + eqId + '"]'); 4819 4820 this.$watched = $watched.length ? $watched : this.$element.find('[data-equalizer-watch]'); 4821 this.$element.attr('data-resize', eqId || Foundation.GetYoDigits(6, 'eq')); 4822 4823 this.hasNested = this.$element.find('[data-equalizer]').length > 0; 4824 this.isNested = this.$element.parentsUntil(document.body, '[data-equalizer]').length > 0; 4825 this.isOn = false;
4826 4827 var imgs = this.$element.find('img'); 4828 var tooSmall; 4829 if (this.options.equalizeOn) { 4830 tooSmall = this._checkMQ(); 4831 $(window).on('changed.zf.mediaquery', this._checkMQ.bind(this)); 4832 } else { 4833 this._events(); 4834 } 4835 if (tooSmall !== undefined && tooSmall === false || tooSmall === undefined) { 4836 if (imgs.length) { 4837 Foundation.onImagesLoaded(imgs, this._reflow.bind(this)); 4838 } else { 4839 this._reflow(); 4840 } 4841 } 4842 } 4843 4844 /** 4845 * Removes event listeners if the breakpoint is too small. 4846 * @private 4847 */ 4848 4849 }, { 4850 key: '_pauseEvents', 4851 value: function _pauseEvents() { 4852 this.isOn = false; 4853 this.$element.off('.zf.equalizer resizeme.zf.trigger'); 4854 } 4855 4856 /** 4857 * Initializes events for Equalizer. 4858 * @private 4859 */ 4860 4861 }, { 4862 key: '_events', 4863 value: function _events() { 4864 var _this = this; 4865 this._pauseEvents(); 4866 if (this.hasNested) { 4867 this.$element.on('postequalized.zf.equalizer', function (e) { 4868 if (e.target !== _this.$element[0]) { 4869 _this._reflow(); 4870 } 4871 }); 4872 } else { 4873 this.$element.on('resizeme.zf.trigger', this._reflow.bind(this)); 4874 } 4875 this.isOn = true; 4876 } 4877 4878 /** 4879 * Checks the current breakpoint to the minimum required size. 4880 * @private 4881 */ 4882 4883 }, { 4884 key: '_checkMQ', 4885 value: function _checkMQ() { 4886 var tooSmall = !Foundation.MediaQuery.atLeast(this.options.equalizeOn); 4887 if (tooSmall) { 4888 if (this.isOn) { 4889 this._pauseEvents(); 4890 this.$watched.css('height', 'auto'); 4891 } 4892 } else { 4893 if (!this.isOn) { 4894 this._events(); 4895 } 4896 } 4897 return tooSmall; 4898 } 4899 4900 /** 4901 * A noop version for the plugin 4902 * @private 4903 */ 4904 4905 }, { 4906 key: '_killswitch', 4907 value: function _killswitch() { 4908 return; 4909 } 4910 4911 /** 4912 * Calls necessary functions to update Equalizer upon DOM change 4913 * @private 4914 */ 4915 4916 }, { 4917 key: '_reflow', 4918 value: function _reflow() { 4919 if (!this.options.equalizeOnStack) { 4920 if (this._isStacked()) { 4921 this.$watched.css('height', 'auto'); 4922 return false; 4923 } 4924 } 4925 if (this.options.equalizeByRow) { 4926 this.getHeightsByRow(this.applyHeightByRow.bind(this)); 4927 } else { 4928 this.getHeights(this.applyHeight.bind(this)); 4929 } 4930 } 4931 4932 /** 4933 * Manually determines if the first 2 elements are *NOT* stacked. 4934 * @private 4935 */ 4936 4937 }, { 4938 key: '_isStacked', 4939 value: function _isStacked() { 4940 return this.$watched[0].offsetTop !== this.$watched[1].offsetTop; 4941 } 4942 4943 /** 4944 * Finds the outer heights of children contained within an Equalizer parent and returns them in an array 4945 * @param {Function} cb - A non-optional callback to return the heights array to. 4946 * @returns {Array} heights - An array of heights of children within Equalizer container 4947 */ 4948 4949 }, { 4950 key: 'getHeights', 4951 value: function getHeights(cb) { 4952 var heights = []; 4953 for (var i = 0, len = this.$watched.length; i < len; i++) { 4954 this.$watched[i].style.height = 'auto'; 4955 heights.push(this.$watched[i].offsetHeight); 4956 } 4957 cb(heights); 4958 } 4959 4960 /** 4961 * Finds the outer heights of children contained within an Equalizer parent and returns them in an array 4962 * @param {Function} cb - A non-optional callback to return the heights array to. 4963 * @returns {Array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child 4964 */ 4965 4966 }, { 4967 key: 'getHeightsByRow', 4968 value: function getHeightsByRow(cb) { 4969 var lastElTopOffset = this.$watched.first().offset().top, 4970 groups = [], 4971 group = 0; 4972 //group by Row 4973 groups[group] = []; 4974 for (var i = 0, len = this.$watched.length; i < len; i++) { 4975 this.$watched[i].style.height = 'auto'; 4976 //maybe could use this.$watched[i].offsetTop 4977 var elOffsetTop = $(this.$watched[i]).offset().top; 4978 if (elOffsetTop != lastElTopOffset) { 4979 group++; 4980 groups[group] = []; 4981 lastElTopOffset = elOffsetTop; 4982 } 4983 groups[group].push([this.$watched[i], this.$watched[i].offsetHeight]); 4984 } 4985 4986 for (var j = 0, ln = groups.length; j < ln; j++) { 4987 var heights = $(groups[j]).map(function () { 4988 return this[1]; 4989 }).get(); 4990 var max = Math.max.apply(null, heights); 4991 groups[j].push(max); 4992 } 4993 cb(groups); 4994 } 4995 4996 /** 4997 * Changes the CSS height property of each child in an Equalizer parent to match the tallest 4998 * @param {array} heights - An array of heights of children within Equalizer container 4999 * @fires Equalizer#preequalized 5000 * @fires Equalizer#postequalized 5001 */ 5002 5003 }, {
5004 key: 'applyHeight', 5005 value: function applyHeight(heights) { 5006 var max = Math.max.apply(null, heights); 5007 /** 5008 * Fires before the heights are applied 5009 * @event Equalizer#preequalized 5010 */ 5011 this.$element.trigger('preequalized.zf.equalizer'); 5012 5013 this.$watched.css('height', max); 5014 5015 /** 5016 * Fires when the heights have been applied 5017 * @event Equalizer#postequalized 5018 */ 5019 this.$element.trigger('postequalized.zf.equalizer'); 5020 } 5021 5022 /** 5023 * Changes the CSS height property of each child in an Equalizer parent to match the tallest by row 5024 * @param {array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child 5025 * @fires Equalizer#preequalized 5026 * @fires Equalizer#preequalizedRow 5027 * @fires Equalizer#postequalizedRow 5028 * @fires Equalizer#postequalized 5029 */ 5030 5031 }, { 5032 key: 'applyHeightByRow', 5033 value: function applyHeightByRow(groups) { 5034 /** 5035 * Fires before the heights are applied 5036 */ 5037 this.$element.trigger('preequalized.zf.equalizer'); 5038 for (var i = 0, len = groups.length; i < len; i++) { 5039 var groupsILength = groups[i].length, 5040 max = groups[i][groupsILength - 1]; 5041 if (groupsILength <= 2) { 5042 $(groups[i][0][0]).css({ 'height': 'auto' }); 5043 continue; 5044 } 5045 /** 5046 * Fires before the heights per row are applied 5047 * @event Equalizer#preequalizedRow 5048 */ 5049 this.$element.trigger('preequalizedrow.zf.equalizer'); 5050 for (var j = 0, lenJ = groupsILength - 1; j < lenJ; j++) { 5051 $(groups[i][j][0]).css({ 'height': max }); 5052 } 5053 /** 5054 * Fires when the heights per row have been applied 5055 * @event Equalizer#postequalizedRow 5056 */ 5057 this.$element.trigger('postequalizedrow.zf.equalizer'); 5058 } 5059 /** 5060 * Fires when the heights have been applied 5061 */ 5062 this.$element.trigger('postequalized.zf.equalizer'); 5063 } 5064 5065 /** 5066 * Destroys an instance of Equalizer. 5067 * @function 5068 */ 5069 5070 }, { 5071 key: 'destroy', 5072 value: function destroy() { 5073 this._pauseEvents(); 5074 this.$watched.css('height', 'auto'); 5075 5076 Foundation.unregisterPlugin(this); 5077 } 5078 }]); 5079 5080 return Equalizer; 5081 }(); 5082 5083 /** 5084 * Default settings for plugin 5085 */ 5086 5087 5088 Equalizer.defaults = { 5089 /** 5090 * Enable height equalization when stacked on smaller screens. 5091 * @option 5092 * @example true 5093 */ 5094 equalizeOnStack: true, 5095 /** 5096 * Enable height equalization row by row. 5097 * @option 5098 * @example false 5099 */ 5100 equalizeByRow: false, 5101 /** 5102 * String representing the minimum breakpoint size the plugin should equalize heights on. 5103 * @option 5104 * @example 'medium' 5105 */ 5106 equalizeOn: '' 5107 }; 5108 5109 // Window exports 5110 Foundation.plugin(Equalizer, 'Equalizer'); 5111}(jQuery); 5112'use strict'; 5113 5114var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 5115 5116function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 5117 5118!function ($) { 5119 5120 /** 5121 * Interchange module. 5122 * @module foundation.interchange 5123 * @requires foundation.util.mediaQuery 5124 * @requires foundation.util.timerAndImageLoader 5125 */ 5126 5127 var Interchange = function () { 5128 /** 5129 * Creates a new instance of Interchange. 5130 * @class 5131 * @fires Interchange#init 5132 * @param {Object} element - jQuery object to add the trigger to. 5133 * @param {Object} options - Overrides to the default plugin settings. 5134 */ 5135 5136 function Interchange(element, options) { 5137 _classCallCheck(this, Interchange); 5138 5139 this.$element = element; 5140 this.options = $.extend({}, Interchange.defaults, options); 5141 this.rules = []; 5142 this.currentPath = ''; 5143 5144 this._init(); 5145 this._events(); 5146 5147 Foundation.registerPlugin(this, 'Interchange'); 5148 } 5149 5150 /** 5151 * Initializes the Interchange plugin and calls functions to get interchange functioning on load. 5152 * @function 5153 * @private 5154 */ 5155 5156 5157 _createClass(Interchange, [{ 5158 key: '_init', 5159 value: function _init() { 5160 this._addBreakpoints(); 5161 this._generateRules(); 5162 this._reflow(); 5163 } 5164 5165 /** 5166 * Initializes events for Interchange. 5167 * @function 5168 * @private 5169 */ 5170 5171 }, {
5172 key: '_events', 5173 value: function _events() { 5174 $(window).on('resize.zf.interchange', Foundation.util.throttle(this._reflow.bind(this), 50)); 5175 } 5176 5177 /** 5178 * Calls necessary functions to update Interchange upon DOM change 5179 * @function 5180 * @private 5181 */ 5182 5183 }, { 5184 key: '_reflow', 5185 value: function _reflow() { 5186 var match; 5187 5188 // Iterate through each rule, but only save the last match 5189 for (var i in this.rules) { 5190 var rule = this.rules[i]; 5191 5192 if (window.matchMedia(rule.query).matches) { 5193 match = rule; 5194 } 5195 } 5196 5197 if (match) { 5198 this.replace(match.path); 5199 } 5200 } 5201 5202 /** 5203 * Gets the Foundation breakpoints and adds them to the Interchange.SPECIAL_QUERIES object. 5204 * @function 5205 * @private 5206 */ 5207 5208 }, { 5209 key: '_addBreakpoints', 5210 value: function _addBreakpoints() { 5211 for (var i in Foundation.MediaQuery.queries) { 5212 var query = Foundation.MediaQuery.queries[i]; 5213 Interchange.SPECIAL_QUERIES[query.name] = query.value; 5214 } 5215 } 5216 5217 /** 5218 * Checks the Interchange element for the provided media query + content pairings 5219 * @function 5220 * @private 5221 * @param {Object} element - jQuery object that is an Interchange instance 5222 * @returns {Array} scenarios - Array of objects that have 'mq' and 'path' keys with corresponding keys 5223 */ 5224 5225 }, { 5226 key: '_generateRules', 5227 value: function _generateRules(element) { 5228 var rulesList = []; 5229 var rules; 5230 5231 if (this.options.rules) { 5232 rules = this.options.rules; 5233 } else { 5234 rules = this.$element.data('interchange').match(/\[.*?\]/g); 5235 } 5236 5237 for (var i in rules) { 5238 var rule = rules[i].slice(1, -1).split(', '); 5239 var path = rule.slice(0, -1).join(''); 5240 var query = rule[rule.length - 1]; 5241 5242 if (Interchange.SPECIAL_QUERIES[query]) { 5243 query = Interchange.SPECIAL_QUERIES[query]; 5244 } 5245 5246 rulesList.push({ 5247 path: path, 5248 query: query 5249 }); 5250 } 5251 5252 this.rules = rulesList; 5253 } 5254 5255 /** 5256 * Update the `src` property of an image, or change the HTML of a container, to the specified path. 5257 * @function 5258 * @param {String} path - Path to the image or HTML partial. 5259 * @fires Interchange#replaced 5260 */ 5261 5262 }, { 5263 key: 'replace', 5264 value: function replace(path) { 5265 if (this.currentPath === path) return; 5266 5267 var _this = this, 5268 trigger = 'replaced.zf.interchange'; 5269 5270 // Replacing images 5271 if (this.$element[0].nodeName === 'IMG') { 5272 this.$element.attr('src', path).load(function () { 5273 _this.currentPath = path; 5274 }).trigger(trigger); 5275 } 5276 // Replacing background images 5277 else if (path.match(/\.(gif|jpg|jpeg|tiff|png)([?#].*)?/i)) { 5278 this.$element.css({ 'background-image': 'url(' + path + ')' }).trigger(trigger); 5279 } 5280 // Replacing HTML 5281 else { 5282 $.get(path, function (response) { 5283 _this.$element.html(response).trigger(trigger); 5284 $(response).foundation(); 5285 _this.currentPath = path; 5286 }); 5287 } 5288 5289 /** 5290 * Fires when content in an Interchange element is done being loaded. 5291 * @event Interchange#replaced 5292 */ 5293 // this.$element.trigger('replaced.zf.interchange'); 5294 } 5295 5296 /** 5297 * Destroys an instance of interchange. 5298 * @function 5299 */ 5300 5301 }, { 5302 key: 'destroy', 5303 value: function destroy() { 5304 //TODO this. 5305 } 5306 }]); 5307 5308 return Interchange; 5309 }(); 5310 5311 /** 5312 * Default settings for plugin 5313 */ 5314 5315 5316 Interchange.defaults = { 5317 /** 5318 * Rules to be applied to Interchange elements. Set with the `data-interchange` array notation. 5319 * @option 5320 */ 5321 rules: null 5322 }; 5323 5324 Interchange.SPECIAL_QUERIES = { 5325 'landscape': 'screen and (orientation: landscape)', 5326 'portrait': 'screen and (orientation: portrait)', 5327 'retina': 'only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx)' 5328 }; 5329 5330 // Window exports 5331 Foundation.plugin(Interchange, 'Interchange'); 5332}(jQuery); 5333'use strict'; 5334 5335var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 5336 5337function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 5338 5339!function ($) { 5340 5341 /** 5342 * Magellan module. 5343 * @module foundation.magellan 5344 */ 5345 5346 var Magellan = function () { 5347 /** 5348 * Creates a new instance of Magellan. 5349 * @class 5350 * @fires Magellan#init 5351 * @param {Object} element - jQuery object to add the trigger to. 5352 * @param {Object} options - Overrides to the default plugin settings. 5353 */ 5354 5355 function Magellan(element, options) { 5356 _classCallCheck(this, Magellan); 5357 5358 this.$element = element; 5359 this.options = $.extend({}, Magellan.defaults, this.$element.data(), options); 5360 5361 this._init(); 5362 5363 Foundation.registerPlugin(this, 'Magellan'); 5364 } 5365 5366 /** 5367 * Initializes the Magellan plugin and calls functions to get equalizer functioning on load. 5368 * @private 5369 */ 5370 5371 5372 _createClass(Magellan, [{ 5373 key: '_init', 5374 value: function _init() { 5375 var id = this.$element[0].id || Foundation.GetYoDigits(6, 'magellan'); 5376 var _this = this; 5377 this.$targets = $('[data-magellan-target]'); 5378 this.$links = this.$element.find('a'); 5379 this.$element.attr({ 5380 'data-resize': id, 5381 'data-scroll': id, 5382 'id': id 5383 }); 5384 this.$active = $(); 5385 this.scrollPos = parseInt(window.pageYOffset, 10); 5386 5387 this._events(); 5388 } 5389 5390 /** 5391 * Calculates an array of pixel values that are the demarcation lines between locations on the page. 5392 * Can be invoked if new elements are added or the size of a location changes. 5393 * @function 5394 */ 5395 5396 }, {
5397 key: 'calcPoints', 5398 value: function calcPoints() { 5399 var _this = this, 5400 body = document.body, 5401 html = document.documentElement; 5402 5403 this.points = []; 5404 this.winHeight = Math.round(Math.max(window.innerHeight, html.clientHeight)); 5405 this.docHeight = Math.round(Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight)); 5406 5407 this.$targets.each(function () { 5408 var $tar = $(this), 5409 pt = Math.round($tar.offset().top - _this.options.threshold); 5410 $tar.targetPoint = pt; 5411 _this.points.push(pt); 5412 }); 5413 } 5414 5415 /** 5416 * Initializes events for Magellan. 5417 * @private 5418 */ 5419 5420 }, { 5421 key: '_events', 5422 value: function _events() { 5423 var _this = this, 5424 $body = $('html, body'), 5425 opts = { 5426 duration: _this.options.animationDuration, 5427 easing: _this.options.animationEasing 5428 }; 5429 $(window).one('load', function () { 5430 if (_this.options.deepLinking) { 5431 if (location.hash) { 5432 _this.scrollToLoc(location.hash); 5433 } 5434 } 5435 _this.calcPoints(); 5436 _this._updateActive(); 5437 }); 5438 5439 this.$element.on({ 5440 'resizeme.zf.trigger': this.reflow.bind(this), 5441 'scrollme.zf.trigger': this._updateActive.bind(this) 5442 }).on('click.zf.magellan', 'a[href^="#"]', function (e) { 5443 e.preventDefault(); 5444 var arrival = this.getAttribute('href'); 5445 _this.scrollToLoc(arrival); 5446 }); 5447 } 5448 5449 /** 5450 * Function to scroll to a given location on the page. 5451 * @param {String} loc - a properly formatted jQuery id selector. Example: '#foo' 5452 * @function 5453 */ 5454 5455 }, { 5456 key: 'scrollToLoc', 5457 value: function scrollToLoc(loc) { 5458 var scrollPos = Math.round($(loc).offset().top - this.options.threshold / 2 - this.options.barOffset); 5459 5460 $('html, body').stop(true).animate({ scrollTop: scrollPos }, this.options.animationDuration, this.options.animationEasing); 5461 } 5462 5463 /** 5464 * Calls necessary functions to update Magellan upon DOM change 5465 * @function 5466 */ 5467 5468 }, { 5469 key: 'reflow', 5470 value: function reflow() { 5471 this.calcPoints(); 5472 this._updateActive(); 5473 } 5474 5475 /** 5476 * Updates the visibility of an active location link, and updates the url hash for the page, if deepLinking enabled. 5477 * @private 5478 * @function 5479 * @fires Magellan#update 5480 */ 5481 5482 }, { 5483 key: '_updateActive', 5484 value: function _updateActive() /*evt, elem, scrollPos*/{ 5485 var winPos = /*scrollPos ||*/parseInt(window.pageYOffset, 10), 5486 curIdx; 5487 5488 if (winPos + this.winHeight === this.docHeight) { 5489 curIdx = this.points.length - 1; 5490 } else if (winPos < this.points[0]) { 5491 curIdx = 0; 5492 } else { 5493 var isDown = this.scrollPos < winPos, 5494 _this = this, 5495 curVisible = this.points.filter(function (p, i) { 5496 return isDown ? p <= winPos : p - _this.options.threshold <= winPos; //&& winPos >= _this.points[i -1] - _this.options.threshold; 5497 }); 5498 curIdx = curVisible.length ? curVisible.length - 1 : 0; 5499 } 5500 5501 this.$active.removeClass(this.options.activeClass); 5502 this.$active = this.$links.eq(curIdx).addClass(this.options.activeClass); 5503 5504 if (this.options.deepLinking) { 5505 var hash = this.$active[0].getAttribute('href'); 5506 if (window.history.pushState) { 5507 window.history.pushState(null, null, hash); 5508 } else { 5509 window.location.hash = hash; 5510 } 5511 } 5512 5513 this.scrollPos = winPos; 5514 /** 5515 * Fires when magellan is finished updating to the new active element. 5516 * @event Magellan#update 5517 */ 5518 this.$element.trigger('update.zf.magellan', [this.$active]); 5519 } 5520 5521 /** 5522 * Destroys an instance of Magellan and resets the url of the window. 5523 * @function 5524 */ 5525 5526 }, {
5527 key: 'destroy', 5528 value: function destroy() { 5529 this.$element.off('.zf.trigger .zf.magellan').find('.' + this.options.activeClass).removeClass(this.options.activeClass); 5530 5531 if (this.options.deepLinking) { 5532 var hash = this.$active[0].getAttribute('href'); 5533 window.location.hash.replace(hash, ''); 5534 } 5535 5536 Foundation.unregisterPlugin(this); 5537 } 5538 }]); 5539 5540 return Magellan; 5541 }(); 5542 5543 /** 5544 * Default settings for plugin 5545 */ 5546 5547 5548 Magellan.defaults = { 5549 /** 5550 * Amount of time, in ms, the animated scrolling should take between locations. 5551 * @option 5552 * @example 500 5553 */ 5554 animationDuration: 500, 5555 /** 5556 * Animation style to use when scrolling between locations. 5557 * @option 5558 * @example 'ease-in-out' 5559 */ 5560 animationEasing: 'linear', 5561 /** 5562 * Number of pixels to use as a marker for location changes. 5563 * @option 5564 * @example 50 5565 */ 5566 threshold: 50, 5567 /** 5568 * Class applied to the active locations link on the magellan container. 5569 * @option 5570 * @example 'active' 5571 */ 5572 activeClass: 'active', 5573 /** 5574 * Allows the script to manipulate the url of the current page, and if supported, alter the history. 5575 * @option 5576 * @example true 5577 */ 5578 deepLinking: false, 5579 /** 5580 * Number of pixels to offset the scroll of the page on item click if using a sticky nav bar. 5581 * @option 5582 * @example 25 5583 */ 5584 barOffset: 0 5585 }; 5586 5587 // Window exports 5588 Foundation.plugin(Magellan, 'Magellan'); 5589}(jQuery); 5590'use strict'; 5591 5592var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 5593 5594function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 5595 5596!function ($) { 5597 5598 /** 5599 * OffCanvas module. 5600 * @module foundation.offcanvas 5601 * @requires foundation.util.mediaQuery 5602 * @requires foundation.util.triggers 5603 * @requires foundation.util.motion 5604 */ 5605 5606 var OffCanvas = function () { 5607 /** 5608 * Creates a new instance of an off-canvas wrapper. 5609 * @class 5610 * @fires OffCanvas#init 5611 * @param {Object} element - jQuery object to initialize. 5612 * @param {Object} options - Overrides to the default plugin settings. 5613 */ 5614 5615 function OffCanvas(element, options) { 5616 _classCallCheck(this, OffCanvas); 5617 5618 this.$element = element; 5619 this.options = $.extend({}, OffCanvas.defaults, this.$element.data(), options); 5620 this.$lastTrigger = $(); 5621 5622 this._init(); 5623 this._events(); 5624 5625 Foundation.registerPlugin(this, 'OffCanvas'); 5626 } 5627 5628 /** 5629 * Initializes the off-canvas wrapper by adding the exit overlay (if needed). 5630 * @function 5631 * @private 5632 */ 5633 5634 5635 _createClass(OffCanvas, [{ 5636 key: '_init', 5637 value: function _init() { 5638 var id = this.$element.attr('id'); 5639 5640 this.$element.attr('aria-hidden', 'true'); 5641 5642 // Find triggers that affect this element and add aria-expanded to them 5643 $(document).find('[data-open="' + id + '"], [data-close="' + id + '"], [data-toggle="' + id + '"]').attr('aria-expanded', 'false').attr('aria-controls', id); 5644 5645 // Add a close trigger over the body if necessary 5646 if (this.options.closeOnClick) { 5647 if ($('.js-off-canvas-exit').length) { 5648 this.$exiter = $('.js-off-canvas-exit'); 5649 } else { 5650 var exiter = document.createElement('div'); 5651 exiter.setAttribute('class', 'js-off-canvas-exit'); 5652 $('[data-off-canvas-content]').append(exiter); 5653 5654 this.$exiter = $(exiter); 5655 } 5656 } 5657 5658 this.options.isRevealed = this.options.isRevealed || new RegExp(this.options.revealClass, 'g').test(this.$element[0].className); 5659 5660 if (this.options.isRevealed) { 5661 this.options.revealOn = this.options.revealOn || this.$element[0].className.match(/(reveal-for-medium|reveal-for-large)/g)[0].split('-')[2]; 5662 this._setMQChecker(); 5663 } 5664 if (!this.options.transitionTime) { 5665 this.options.transitionTime = parseFloat(window.getComputedStyle($('[data-off-canvas-wrapper]')[0]).transitionDuration) * 1000; 5666 } 5667 } 5668 5669 /** 5670 * Adds event handlers to the off-canvas wrapper and the exit overlay. 5671 * @function 5672 * @private 5673 */ 5674 5675 }, {
5676 key: '_events', 5677 value: function _events() { 5678 this.$element.off('.zf.trigger .zf.offcanvas').on({ 5679 'open.zf.trigger': this.open.bind(this), 5680 'close.zf.trigger': this.close.bind(this), 5681 'toggle.zf.trigger': this.toggle.bind(this), 5682 'keydown.zf.offcanvas': this._handleKeyboard.bind(this) 5683 }); 5684 5685 if (this.options.closeOnClick && this.$exiter.length) { 5686 this.$exiter.on({ 'click.zf.offcanvas': this.close.bind(this) }); 5687 } 5688 } 5689 5690 /** 5691 * Applies event listener for elements that will reveal at certain breakpoints. 5692 * @private 5693 */ 5694 5695 }, { 5696 key: '_setMQChecker', 5697 value: function _setMQChecker() { 5698 var _this = this; 5699 5700 $(window).on('changed.zf.mediaquery', function () { 5701 if (Foundation.MediaQuery.atLeast(_this.options.revealOn)) { 5702 _this.reveal(true); 5703 } else { 5704 _this.reveal(false); 5705 } 5706 }).one('load.zf.offcanvas', function () { 5707 if (Foundation.MediaQuery.atLeast(_this.options.revealOn)) { 5708 _this.reveal(true); 5709 } 5710 }); 5711 } 5712 5713 /** 5714 * Handles the revealing/hiding the off-canvas at breakpoints, not the same as open. 5715 * @param {Boolean} isRevealed - true if element should be revealed. 5716 * @function 5717 */ 5718 5719 }, { 5720 key: 'reveal', 5721 value: function reveal(isRevealed) { 5722 var $closer = this.$element.find('[data-close]'); 5723 if (isRevealed) { 5724 this.close(); 5725 this.isRevealed = true; 5726 // if (!this.options.forceTop) { 5727 // var scrollPos = parseInt(window.pageYOffset); 5728 // this.$element[0].style.transform = 'translate(0,' + scrollPos + 'px)'; 5729 // } 5730 // if (this.options.isSticky) { this._stick(); } 5731 this.$element.off('open.zf.trigger toggle.zf.trigger'); 5732 if ($closer.length) { 5733 $closer.hide(); 5734 } 5735 } else { 5736 this.isRevealed = false; 5737 // if (this.options.isSticky || !this.options.forceTop) { 5738 // this.$element[0].style.transform = ''; 5739 // $(window).off('scroll.zf.offcanvas'); 5740 // } 5741 this.$element.on({ 5742 'open.zf.trigger': this.open.bind(this), 5743 'toggle.zf.trigger': this.toggle.bind(this) 5744 }); 5745 if ($closer.length) { 5746 $closer.show(); 5747 } 5748 } 5749 } 5750 5751 /** 5752 * Opens the off-canvas menu. 5753 * @function 5754 * @param {Object} event - Event object passed from listener. 5755 * @param {jQuery} trigger - element that triggered the off-canvas to open. 5756 * @fires OffCanvas#opened 5757 */ 5758 5759 }, { 5760 key: 'open', 5761 value: function open(event, trigger) { 5762 if (this.$element.hasClass('is-open') || this.isRevealed) { 5763 return; 5764 } 5765 var _this = this, 5766 $body = $(document.body); 5767 5768 if (this.options.forceTop) { 5769 $('body').scrollTop(0); 5770 } 5771 // window.pageYOffset = 0; 5772 5773 // if (!this.options.forceTop) { 5774 // var scrollPos = parseInt(window.pageYOffset); 5775 // this.$element[0].style.transform = 'translate(0,' + scrollPos + 'px)'; 5776 // if (this.$exiter.length) { 5777 // this.$exiter[0].style.transform = 'translate(0,' + scrollPos + 'px)'; 5778 // } 5779 // } 5780 /** 5781 * Fires when the off-canvas menu opens. 5782 * @event OffCanvas#opened 5783 */ 5784 Foundation.Move(this.options.transitionTime, this.$element, function () { 5785 $('[data-off-canvas-wrapper]').addClass('is-off-canvas-open is-open-' + _this.options.position); 5786 5787 _this.$element.addClass('is-open'); 5788 5789 // if (_this.options.isSticky) { 5790 // _this._stick(); 5791 // } 5792 }); 5793 this.$element.attr('aria-hidden', 'false').trigger('opened.zf.offcanvas'); 5794 5795 if (this.options.closeOnClick) { 5796 this.$exiter.addClass('is-visible'); 5797 } 5798 5799 if (trigger) { 5800 this.$lastTrigger = trigger.attr('aria-expanded', 'true'); 5801 } 5802 5803 if (this.options.autoFocus) { 5804 this.$element.one(Foundation.transitionend(this.$element), function () { 5805 _this.$element.find('a, button').eq(0).focus(); 5806 }); 5807 } 5808 5809 if (this.options.trapFocus) { 5810 $('[data-off-canvas-content]').attr('tabindex', '-1'); 5811 this._trapFocus(); 5812 } 5813 } 5814 5815 /** 5816 * Traps focus within the offcanvas on open. 5817 * @private 5818 */ 5819 5820 }, {
5821 key: '_trapFocus', 5822 value: function _trapFocus() { 5823 var focusable = Foundation.Keyboard.findFocusable(this.$element), 5824 first = focusable.eq(0), 5825 last = focusable.eq(-1); 5826 5827 focusable.off('.zf.offcanvas').on('keydown.zf.offcanvas', function (e) { 5828 if (e.which === 9 || e.keycode === 9) { 5829 if (e.target === last[0] && !e.shiftKey) { 5830 e.preventDefault(); 5831 first.focus(); 5832 } 5833 if (e.target === first[0] && e.shiftKey) { 5834 e.preventDefault(); 5835 last.focus(); 5836 } 5837 } 5838 }); 5839 } 5840 5841 /** 5842 * Allows the offcanvas to appear sticky utilizing translate properties. 5843 * @private 5844 */ 5845 // OffCanvas.prototype._stick = function() { 5846 // var elStyle = this.$element[0].style; 5847 // 5848 // if (this.options.closeOnClick) { 5849 // var exitStyle = this.$exiter[0].style; 5850 // } 5851 // 5852 // $(window).on('scroll.zf.offcanvas', function(e) { 5853 // console.log(e); 5854 // var pageY = window.pageYOffset; 5855 // elStyle.transform = 'translate(0,' + pageY + 'px)'; 5856 // if (exitStyle !== undefined) { exitStyle.transform = 'translate(0,' + pageY + 'px)'; } 5857 // }); 5858 // // this.$element.trigger('stuck.zf.offcanvas'); 5859 // }; 5860 /** 5861 * Closes the off-canvas menu. 5862 * @function 5863 * @param {Function} cb - optional cb to fire after closure. 5864 * @fires OffCanvas#closed 5865 */ 5866 5867 }, { 5868 key: 'close', 5869 value: function close(cb) { 5870 if (!this.$element.hasClass('is-open') || this.isRevealed) { 5871 return; 5872 } 5873 5874 var _this = this; 5875 5876 // Foundation.Move(this.options.transitionTime, this.$element, function() { 5877 $('[data-off-canvas-wrapper]').removeClass('is-off-canvas-open is-open-' + _this.options.position); 5878 _this.$element.removeClass('is-open'); 5879 // Foundation._reflow(); 5880 // }); 5881 this.$element.attr('aria-hidden', 'true') 5882 /** 5883 * Fires when the off-canvas menu opens. 5884 * @event OffCanvas#closed 5885 */ 5886 .trigger('closed.zf.offcanvas'); 5887 // if (_this.options.isSticky || !_this.options.forceTop) { 5888 // setTimeout(function() { 5889 // _this.$element[0].style.transform = ''; 5890 // $(window).off('scroll.zf.offcanvas'); 5891 // }, this.options.transitionTime); 5892 // } 5893 if (this.options.closeOnClick) { 5894 this.$exiter.removeClass('is-visible'); 5895 } 5896 5897 this.$lastTrigger.attr('aria-expanded', 'false'); 5898 if (this.options.trapFocus) { 5899 $('[data-off-canvas-content]').removeAttr('tabindex'); 5900 } 5901 } 5902 5903 /** 5904 * Toggles the off-canvas menu open or closed. 5905 * @function 5906 * @param {Object} event - Event object passed from listener. 5907 * @param {jQuery} trigger - element that triggered the off-canvas to open. 5908 */ 5909 5910 }, { 5911 key: 'toggle', 5912 value: function toggle(event, trigger) { 5913 if (this.$element.hasClass('is-open')) { 5914 this.close(event, trigger); 5915 } else { 5916 this.open(event, trigger); 5917 } 5918 } 5919 5920 /** 5921 * Handles keyboard input when detected. When the escape key is pressed, the off-canvas menu closes, and focus is restored to the element that opened the menu. 5922 * @function 5923 * @private 5924 */ 5925 5926 }, { 5927 key: '_handleKeyboard', 5928 value: function _handleKeyboard(event) { 5929 if (event.which !== 27) return; 5930 5931 event.stopPropagation(); 5932 event.preventDefault(); 5933 this.close(); 5934 this.$lastTrigger.focus(); 5935 } 5936 5937 /** 5938 * Destroys the offcanvas plugin. 5939 * @function 5940 */ 5941 5942 }, { 5943 key: 'destroy', 5944 value: function destroy() { 5945 this.close(); 5946 this.$element.off('.zf.trigger .zf.offcanvas'); 5947 this.$exiter.off('.zf.offcanvas'); 5948 5949 Foundation.unregisterPlugin(this); 5950 } 5951 }]); 5952 5953 return OffCanvas; 5954 }(); 5955 5956 OffCanvas.defaults = { 5957 /** 5958 * Allow the user to click outside of the menu to close it. 5959 * @option 5960 * @example true 5961 */ 5962 closeOnClick: true, 5963 5964 /** 5965 * Amount of time in ms the open and close transition requires. If none selected, pulls from body style. 5966 * @option 5967 * @example 500 5968 */ 5969 transitionTime: 0, 5970 5971 /** 5972 * Direction the offcanvas opens from. Determines class applied to body. 5973 * @option 5974 * @example left 5975 */ 5976 position: 'left', 5977 5978 /** 5979 * Force the page to scroll to top on open. 5980 * @option 5981 * @example true 5982 */ 5983 forceTop: true, 5984 5985 /** 5986 * Allow the offcanvas to remain open for certain breakpoints. 5987 * @option 5988 * @example false 5989 */ 5990 isRevealed: false, 5991 5992 /** 5993 * Breakpoint at which to reveal. JS will use a RegExp to target standard classes, if changing classnames, pass your class with the `revealClass` option. 5994 * @option 5995 * @example reveal-for-large 5996 */ 5997 revealOn: null, 5998 5999 /** 6000 * Force focus to the offcanvas on open. If true, will focus the opening trigger on close. 6001 * @option 6002 * @example true 6003 */ 6004 autoFocus: true, 6005 6006 /** 6007 * Class used to force an offcanvas to remain open. Foundation defaults for this are `reveal-for-large` & `reveal-for-medium`. 6008 * @option 6009 * TODO improve the regex testing for this. 6010 * @example reveal-for-large 6011 */ 6012 revealClass: 'reveal-for-', 6013 6014 /** 6015 * Triggers optional focus trapping when opening an offcanvas. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes. 6016 * @option 6017 * @example true 6018 */ 6019 trapFocus: false 6020 }; 6021 6022 // Window exports 6023 Foundation.plugin(OffCanvas, 'OffCanvas'); 6024}(jQuery); 6025'use strict'; 6026 6027var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 6028 6029function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6030 6031!function ($) { 6032 6033 /** 6034 * Orbit module. 6035 * @module foundation.orbit 6036 * @requires foundation.util.keyboard 6037 * @requires foundation.util.motion 6038 * @requires foundation.util.timerAndImageLoader 6039 * @requires foundation.util.touch 6040 */ 6041 6042 var Orbit = function () { 6043 /** 6044 * Creates a new instance of an orbit carousel. 6045 * @class 6046 * @param {jQuery} element - jQuery object to make into an Orbit Carousel. 6047 * @param {Object} options - Overrides to the default plugin settings. 6048 */ 6049 6050 function Orbit(element, options) { 6051 _classCallCheck(this, Orbit); 6052 6053 this.$element = element; 6054 this.options = $.extend({}, Orbit.defaults, this.$element.data(), options); 6055 6056 this._init(); 6057
6058 Foundation.registerPlugin(this, 'Orbit'); 6059 Foundation.Keyboard.register('Orbit', { 6060 'ltr': { 6061 'ARROW_RIGHT': 'next', 6062 'ARROW_LEFT': 'previous' 6063 }, 6064 'rtl': { 6065 'ARROW_LEFT': 'next', 6066 'ARROW_RIGHT': 'previous' 6067 } 6068 }); 6069 } 6070 6071 /** 6072 * Initializes the plugin by creating jQuery collections, setting attributes, and starting the animation. 6073 * @function 6074 * @private 6075 */ 6076 6077 6078 _createClass(Orbit, [{ 6079 key: '_init', 6080 value: function _init() { 6081 this.$wrapper = this.$element.find('.' + this.options.containerClass); 6082 this.$slides = this.$element.find('.' + this.options.slideClass); 6083 var $images = this.$element.find('img'), 6084 initActive = this.$slides.filter('.is-active'); 6085 6086 if (!initActive.length) { 6087 this.$slides.eq(0).addClass('is-active'); 6088 } 6089 6090 if (!this.options.useMUI) { 6091 this.$slides.addClass('no-motionui'); 6092 } 6093 6094 if ($images.length) { 6095 Foundation.onImagesLoaded($images, this._prepareForOrbit.bind(this)); 6096 } else { 6097 this._prepareForOrbit(); //hehe 6098 } 6099 6100 if (this.options.bullets) { 6101 this._loadBullets(); 6102 } 6103 6104 this._events(); 6105 6106 if (this.options.autoPlay && this.$slides.length > 1) { 6107 this.geoSync(); 6108 } 6109 6110 if (this.options.accessible) { 6111 // allow wrapper to be focusable to enable arrow navigation 6112 this.$wrapper.attr('tabindex', 0); 6113 } 6114 } 6115 6116 /** 6117 * Creates a jQuery collection of bullets, if they are being used. 6118 * @function 6119 * @private 6120 */ 6121 6122 }, { 6123 key: '_loadBullets', 6124 value: function _loadBullets() { 6125 this.$bullets = this.$element.find('.' + this.options.boxOfBullets).find('button'); 6126 } 6127 6128 /** 6129 * Sets a `timer` object on the orbit, and starts the counter for the next slide. 6130 * @function 6131 */ 6132 6133 }, { 6134 key: 'geoSync', 6135 value: function geoSync() { 6136 var _this = this; 6137 this.timer = new Foundation.Timer(this.$element, { 6138 duration: this.options.timerDelay, 6139 infinite: false 6140 }, function () { 6141 _this.changeSlide(true); 6142 }); 6143 this.timer.start(); 6144 } 6145 6146 /** 6147 * Sets wrapper and slide heights for the orbit. 6148 * @function 6149 * @private 6150 */ 6151 6152 }, { 6153 key: '_prepareForOrbit', 6154 value: function _prepareForOrbit() { 6155 var _this = this; 6156 this._setWrapperHeight(function (max) { 6157 _this._setSlideHeight(max); 6158 }); 6159 } 6160 6161 /** 6162 * Calulates the height of each slide in the collection, and uses the tallest one for the wrapper height. 6163 * @function 6164 * @private 6165 * @param {Function} cb - a callback function to fire when complete. 6166 */ 6167 6168 }, { 6169 key: '_setWrapperHeight', 6170 value: function _setWrapperHeight(cb) { 6171 //rewrite this to `for` loop 6172 var max = 0, 6173 temp, 6174 counter = 0; 6175 6176 this.$slides.each(function () { 6177 temp = this.getBoundingClientRect().height; 6178 $(this).attr('data-slide', counter); 6179 6180 if (counter) { 6181 //if not the first slide, set css position and display property 6182 $(this).css({ 'position': 'relative', 'display': 'none' }); 6183 } 6184 max = temp > max ? temp : max; 6185 counter++; 6186 }); 6187 6188 if (counter === this.$slides.length) { 6189 this.$wrapper.css({ 'height': max }); //only change the wrapper height property once. 6190 cb(max); //fire callback with max height dimension. 6191 } 6192 } 6193 6194 /** 6195 * Sets the max-height of each slide. 6196 * @function 6197 * @private 6198 */ 6199 6200 }, { 6201 key: '_setSlideHeight', 6202 value: function _setSlideHeight(height) { 6203 this.$slides.each(function () { 6204 $(this).css('max-height', height); 6205 }); 6206 } 6207 6208 /** 6209 * Adds event listeners to basically everything within the element. 6210 * @function 6211 * @private 6212 */ 6213 6214 }, {
6215 key: '_events', 6216 value: function _events() { 6217 var _this = this; 6218 6219 //*************************************** 6220 //**Now using custom event - thanks to:** 6221 //** Yohai Ararat of Toronto ** 6222 //*************************************** 6223 if (this.$slides.length > 1) { 6224 6225 if (this.options.swipe) { 6226 this.$slides.off('swipeleft.zf.orbit swiperight.zf.orbit').on('swipeleft.zf.orbit', function (e) { 6227 e.preventDefault(); 6228 _this.changeSlide(true); 6229 }).on('swiperight.zf.orbit', function (e) { 6230 e.preventDefault(); 6231 _this.changeSlide(false); 6232 }); 6233 } 6234 //*************************************** 6235 6236 if (this.options.autoPlay) { 6237 this.$slides.on('click.zf.orbit', function () { 6238 _this.$element.data('clickedOn', _this.$element.data('clickedOn') ? false : true); 6239 _this.timer[_this.$element.data('clickedOn') ? 'pause' : 'start'](); 6240 }); 6241 6242 if (this.options.pauseOnHover) { 6243 this.$element.on('mouseenter.zf.orbit', function () { 6244 _this.timer.pause(); 6245 }).on('mouseleave.zf.orbit', function () { 6246 if (!_this.$element.data('clickedOn')) { 6247 _this.timer.start(); 6248 } 6249 }); 6250 } 6251 } 6252 6253 if (this.options.navButtons) { 6254 var $controls = this.$element.find('.' + this.options.nextClass + ', .' + this.options.prevClass); 6255 $controls.attr('tabindex', 0) 6256 //also need to handle enter/return and spacebar key presses 6257 .on('click.zf.orbit touchend.zf.orbit', function () { 6258 _this.changeSlide($(this).hasClass(_this.options.nextClass)); 6259 }); 6260 } 6261 6262 if (this.options.bullets) { 6263 this.$bullets.on('click.zf.orbit touchend.zf.orbit', function () { 6264 if (/is-active/g.test(this.className)) { 6265 return false; 6266 } //if this is active, kick out of function. 6267 var idx = $(this).data('slide'), 6268 ltr = idx > _this.$slides.filter('.is-active').data('slide'), 6269 $slide = _this.$slides.eq(idx); 6270 6271 _this.changeSlide(ltr, $slide, idx); 6272 }); 6273 } 6274 6275 this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function (e) { 6276 // handle keyboard event with keyboard util 6277 Foundation.Keyboard.handleKey(e, 'Orbit', { 6278 next: function () { 6279 _this.changeSlide(true); 6280 }, 6281 previous: function () { 6282 _this.changeSlide(false); 6283 }, 6284 handled: function () { 6285 // if bullet is focused, make sure focus moves 6286 if ($(e.target).is(_this.$bullets)) { 6287 _this.$bullets.filter('.is-active').focus(); 6288 } 6289 } 6290 }); 6291 }); 6292 } 6293 } 6294 6295 /** 6296 * Changes the current slide to a new one. 6297 * @function 6298 * @param {Boolean} isLTR - flag if the slide should move left to right. 6299 * @param {jQuery} chosenSlide - the jQuery element of the slide to show next, if one is selected. 6300 * @param {Number} idx - the index of the new slide in its collection, if one chosen. 6301 * @fires Orbit#slidechange 6302 */ 6303 6304 }, { 6305 key: 'changeSlide', 6306 value: function changeSlide(isLTR, chosenSlide, idx) { 6307 var $curSlide = this.$slides.filter('.is-active').eq(0); 6308 6309 if (/mui/g.test($curSlide[0].className)) { 6310 return false; 6311 } //if the slide is currently animating, kick out of the function 6312 6313 var $firstSlide = this.$slides.first(), 6314 $lastSlide = this.$slides.last(), 6315 dirIn = isLTR ? 'Right' : 'Left', 6316 dirOut = isLTR ? 'Left' : 'Right', 6317 _this = this, 6318 $newSlide; 6319 6320 if (!chosenSlide) { 6321 //most of the time, this will be auto played or clicked from the navButtons. 6322 $newSlide = isLTR ? //if wrapping enabled, check to see if there is a `next` or `prev` sibling, if not, select the first or last slide to fill in. if wrapping not enabled, attempt to select `next` or `prev`, if there's nothing there, the function will kick out on next step. CRAZY NESTED TERNARIES!!!!! 6323 this.options.infiniteWrap ? $curSlide.next('.' + this.options.slideClass).length ? $curSlide.next('.' + this.options.slideClass) : $firstSlide : $curSlide.next('.' + this.options.slideClass) : //pick next slide if moving left to right 6324 this.options.infiniteWrap ? $curSlide.prev('.' + this.options.slideClass).length ? $curSlide.prev('.' + this.options.slideClass) : $lastSlide : $curSlide.prev('.' + this.options.slideClass); //pick prev slide if moving right to left 6325 } else { 6326 $newSlide = chosenSlide; 6327 } 6328 6329 if ($newSlide.length) { 6330 if (this.options.bullets) { 6331 idx = idx || this.$slides.index($newSlide); //grab index to update bullets 6332 this._updateBullets(idx); 6333 } 6334 6335 if (this.options.useMUI) { 6336 Foundation.Motion.animateIn($newSlide.addClass('is-active').css({ 'position': 'absolute', 'top': 0 }), this.options['animInFrom' + dirIn], function () { 6337 $newSlide.css({ 'position': 'relative', 'display': 'block' }).attr('aria-live', 'polite'); 6338 }); 6339 6340 Foundation.Motion.animateOut($curSlide.removeClass('is-active'), this.options['animOutTo' + dirOut], function () { 6341 $curSlide.removeAttr('aria-live'); 6342 if (_this.options.autoPlay && !_this.timer.isPaused) { 6343 _this.timer.restart(); 6344 } 6345 //do stuff? 6346 }); 6347 } else { 6348 $curSlide.removeClass('is-active is-in').removeAttr('aria-live').hide(); 6349 $newSlide.addClass('is-active is-in').attr('aria-live', 'polite').show(); 6350 if (this.options.autoPlay && !this.timer.isPaused) { 6351 this.timer.restart(); 6352 } 6353 } 6354 /** 6355 * Triggers when the slide has finished animating in. 6356 * @event Orbit#slidechange 6357 */
6358 this.$element.trigger('slidechange.zf.orbit', [$newSlide]); 6359 } 6360 } 6361 6362 /** 6363 * Updates the active state of the bullets, if displayed. 6364 * @function 6365 * @private 6366 * @param {Number} idx - the index of the current slide. 6367 */ 6368 6369 }, { 6370 key: '_updateBullets', 6371 value: function _updateBullets(idx) { 6372 var $oldBullet = this.$element.find('.' + this.options.boxOfBullets).find('.is-active').removeClass('is-active').blur(), 6373 span = $oldBullet.find('span:last').detach(), 6374 $newBullet = this.$bullets.eq(idx).addClass('is-active').append(span); 6375 } 6376 6377 /** 6378 * Destroys the carousel and hides the element. 6379 * @function 6380 */ 6381 6382 }, { 6383 key: 'destroy', 6384 value: function destroy() { 6385 this.$element.off('.zf.orbit').find('*').off('.zf.orbit').end().hide(); 6386 Foundation.unregisterPlugin(this); 6387 } 6388 }]); 6389 6390 return Orbit; 6391 }(); 6392 6393 Orbit.defaults = { 6394 /** 6395 * Tells the JS to look for and loadBullets. 6396 * @option 6397 * @example true 6398 */ 6399 bullets: true, 6400 /** 6401 * Tells the JS to apply event listeners to nav buttons 6402 * @option 6403 * @example true 6404 */ 6405 navButtons: true, 6406 /** 6407 * motion-ui animation class to apply 6408 * @option 6409 * @example 'slide-in-right' 6410 */ 6411 animInFromRight: 'slide-in-right', 6412 /** 6413 * motion-ui animation class to apply 6414 * @option 6415 * @example 'slide-out-right' 6416 */ 6417 animOutToRight: 'slide-out-right', 6418 /** 6419 * motion-ui animation class to apply 6420 * @option 6421 * @example 'slide-in-left' 6422 * 6423 */ 6424 animInFromLeft: 'slide-in-left', 6425 /** 6426 * motion-ui animation class to apply 6427 * @option 6428 * @example 'slide-out-left' 6429 */ 6430 animOutToLeft: 'slide-out-left', 6431 /** 6432 * Allows Orbit to automatically animate on page load. 6433 * @option 6434 * @example true 6435 */ 6436 autoPlay: true, 6437 /** 6438 * Amount of time, in ms, between slide transitions 6439 * @option 6440 * @example 5000 6441 */ 6442 timerDelay: 5000, 6443 /** 6444 * Allows Orbit to infinitely loop through the slides 6445 * @option 6446 * @example true 6447 */ 6448 infiniteWrap: true, 6449 /** 6450 * Allows the Orbit slides to bind to swipe events for mobile, requires an additional util library 6451 * @option 6452 * @example true 6453 */ 6454 swipe: true, 6455 /** 6456 * Allows the timing function to pause animation on hover. 6457 * @option 6458 * @example true 6459 */ 6460 pauseOnHover: true, 6461 /** 6462 * Allows Orbit to bind keyboard events to the slider, to animate frames with arrow keys 6463 * @option 6464 * @example true 6465 */ 6466 accessible: true, 6467 /** 6468 * Class applied to the container of Orbit 6469 * @option 6470 * @example 'orbit-container' 6471 */ 6472 containerClass: 'orbit-container', 6473 /** 6474 * Class applied to individual slides. 6475 * @option 6476 * @example 'orbit-slide' 6477 */ 6478 slideClass: 'orbit-slide', 6479 /** 6480 * Class applied to the bullet container. You're welcome. 6481 * @option 6482 * @example 'orbit-bullets' 6483 */ 6484 boxOfBullets: 'orbit-bullets', 6485 /** 6486 * Class applied to the `next` navigation button. 6487 * @option 6488 * @example 'orbit-next' 6489 */ 6490 nextClass: 'orbit-next', 6491 /** 6492 * Class applied to the `previous` navigation button. 6493 * @option 6494 * @example 'orbit-previous' 6495 */ 6496 prevClass: 'orbit-previous', 6497 /** 6498 * Boolean to flag the js to use motion ui classes or not. Default to true for backwards compatability. 6499 * @option 6500 * @example true 6501 */ 6502 useMUI: true 6503 }; 6504 6505 // Window exports 6506 Foundation.plugin(Orbit, 'Orbit'); 6507}(jQuery); 6508'use strict'; 6509 6510var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 6511 6512function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6513 6514!function ($) { 6515 6516 /** 6517 * ResponsiveMenu module. 6518 * @module foundation.responsiveMenu 6519 * @requires foundation.util.triggers 6520 * @requires foundation.util.mediaQuery 6521 * @requires foundation.util.accordionMenu 6522 * @requires foundation.util.drilldown 6523 * @requires foundation.util.dropdown-menu 6524 */ 6525 6526 var ResponsiveMenu = function () { 6527 /** 6528 * Creates a new instance of a responsive menu. 6529 * @class 6530 * @fires ResponsiveMenu#init 6531 * @param {jQuery} element - jQuery object to make into a dropdown menu. 6532 * @param {Object} options - Overrides to the default plugin settings. 6533 */ 6534 6535 function ResponsiveMenu(element, options) { 6536 _classCallCheck(this, ResponsiveMenu); 6537 6538 this.$element = $(element); 6539 this.rules = this.$element.data('responsive-menu'); 6540 this.currentMq = null; 6541 this.currentPlugin = null; 6542 6543 this._init(); 6544 this._events(); 6545 6546 Foundation.registerPlugin(this, 'ResponsiveMenu'); 6547 } 6548 6549 /** 6550 * Initializes the Menu by parsing the classes from the 'data-ResponsiveMenu' attribute on the element. 6551 * @function 6552 * @private 6553 */ 6554 6555 6556 _createClass(ResponsiveMenu, [{ 6557 key: '_init', 6558 value: function _init() { 6559 var rulesTree = {}; 6560 6561 // Parse rules from "classes" in data attribute 6562 var rules = this.rules.split(' '); 6563 6564 // Iterate through every rule found 6565 for (var i = 0; i < rules.length; i++) { 6566 var rule = rules[i].split('-'); 6567 var ruleSize = rule.length > 1 ? rule[0] : 'small'; 6568 var rulePlugin = rule.length > 1 ? rule[1] : rule[0]; 6569 6570 if (MenuPlugins[rulePlugin] !== null) { 6571 rulesTree[ruleSize] = MenuPlugins[rulePlugin]; 6572 } 6573 } 6574 6575 this.rules = rulesTree; 6576 6577 if (!$.isEmptyObject(rulesTree)) { 6578 this._checkMediaQueries(); 6579 } 6580 } 6581 6582 /** 6583 * Initializes events for the Menu. 6584 * @function 6585 * @private 6586 */ 6587 6588 }, {
6589 key: '_events', 6590 value: function _events() { 6591 var _this = this; 6592 6593 $(window).on('changed.zf.mediaquery', function () { 6594 _this._checkMediaQueries(); 6595 }); 6596 // $(window).on('resize.zf.ResponsiveMenu', function() { 6597 // _this._checkMediaQueries(); 6598 // }); 6599 } 6600 6601 /** 6602 * Checks the current screen width against available media queries. If the media query has changed, and the plugin needed has changed, the plugins will swap out. 6603 * @function 6604 * @private 6605 */ 6606 6607 }, { 6608 key: '_checkMediaQueries', 6609 value: function _checkMediaQueries() { 6610 var matchedMq, 6611 _this = this; 6612 // Iterate through each rule and find the last matching rule 6613 $.each(this.rules, function (key) { 6614 if (Foundation.MediaQuery.atLeast(key)) { 6615 matchedMq = key; 6616 } 6617 }); 6618 6619 // No match? No dice 6620 if (!matchedMq) return; 6621 6622 // Plugin already initialized? We good 6623 if (this.currentPlugin instanceof this.rules[matchedMq].plugin) return; 6624 6625 // Remove existing plugin-specific CSS classes 6626 $.each(MenuPlugins, function (key, value) { 6627 _this.$element.removeClass(value.cssClass); 6628 }); 6629 6630 // Add the CSS class for the new plugin 6631 this.$element.addClass(this.rules[matchedMq].cssClass); 6632 6633 // Create an instance of the new plugin 6634 if (this.currentPlugin) this.currentPlugin.destroy(); 6635 this.currentPlugin = new this.rules[matchedMq].plugin(this.$element, {}); 6636 } 6637 6638 /** 6639 * Destroys the instance of the current plugin on this element, as well as the window resize handler that switches the plugins out. 6640 * @function 6641 */ 6642 6643 }, { 6644 key: 'destroy', 6645 value: function destroy() { 6646 this.currentPlugin.destroy(); 6647 $(window).off('.zf.ResponsiveMenu'); 6648 Foundation.unregisterPlugin(this); 6649 } 6650 }]); 6651 6652 return ResponsiveMenu; 6653 }(); 6654 6655 ResponsiveMenu.defaults = {}; 6656 6657 // The plugin matches the plugin classes with these plugin instances. 6658 var MenuPlugins = { 6659 dropdown: { 6660 cssClass: 'dropdown', 6661 plugin: Foundation._plugins['dropdown-menu'] || null 6662 }, 6663 drilldown: { 6664 cssClass: 'drilldown', 6665 plugin: Foundation._plugins['drilldown'] || null 6666 }, 6667 accordion: { 6668 cssClass: 'accordion-menu', 6669 plugin: Foundation._plugins['accordion-menu'] || null 6670 } 6671 }; 6672 6673 // Window exports 6674 Foundation.plugin(ResponsiveMenu, 'ResponsiveMenu'); 6675}(jQuery); 6676'use strict'; 6677 6678var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 6679 6680function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6681 6682!function ($) { 6683 6684 /** 6685 * ResponsiveToggle module. 6686 * @module foundation.responsiveToggle 6687 * @requires foundation.util.mediaQuery 6688 */ 6689 6690 var ResponsiveToggle = function () { 6691 /** 6692 * Creates a new instance of Tab Bar. 6693 * @class 6694 * @fires ResponsiveToggle#init 6695 * @param {jQuery} element - jQuery object to attach tab bar functionality to. 6696 * @param {Object} options - Overrides to the default plugin settings. 6697 */ 6698 6699 function ResponsiveToggle(element, options) { 6700 _classCallCheck(this, ResponsiveToggle); 6701 6702 this.$element = $(element); 6703 this.options = $.extend({}, ResponsiveToggle.defaults, this.$element.data(), options); 6704 6705 this._init(); 6706 this._events(); 6707 6708 Foundation.registerPlugin(this, 'ResponsiveToggle'); 6709 } 6710 6711 /** 6712 * Initializes the tab bar by finding the target element, toggling element, and running update(). 6713 * @function 6714 * @private 6715 */ 6716 6717 6718 _createClass(ResponsiveToggle, [{ 6719 key: '_init', 6720 value: function _init() { 6721 var targetID = this.$element.data('responsive-toggle'); 6722 if (!targetID) { 6723 console.error('Your tab bar needs an ID of a Menu as the value of data-tab-bar.'); 6724 } 6725 6726 this.$targetMenu = $('#' + targetID); 6727 this.$toggler = this.$element.find('[data-toggle]'); 6728 6729 this._update(); 6730 } 6731 6732 /** 6733 * Adds necessary event handlers for the tab bar to work. 6734 * @function 6735 * @private 6736 */ 6737 6738 }, {
6739 key: '_events', 6740 value: function _events() { 6741 var _this = this; 6742 6743 $(window).on('changed.zf.mediaquery', this._update.bind(this)); 6744 6745 this.$toggler.on('click.zf.responsiveToggle', this.toggleMenu.bind(this)); 6746 } 6747 6748 /** 6749 * Checks the current media query to determine if the tab bar should be visible or hidden. 6750 * @function 6751 * @private 6752 */ 6753 6754 }, { 6755 key: '_update', 6756 value: function _update() { 6757 // Mobile 6758 if (!Foundation.MediaQuery.atLeast(this.options.hideFor)) { 6759 this.$element.show(); 6760 this.$targetMenu.hide(); 6761 } 6762 6763 // Desktop 6764 else { 6765 this.$element.hide(); 6766 this.$targetMenu.show(); 6767 } 6768 } 6769 6770 /** 6771 * Toggles the element attached to the tab bar. The toggle only happens if the screen is small enough to allow it. 6772 * @function 6773 * @fires ResponsiveToggle#toggled 6774 */ 6775 6776 }, { 6777 key: 'toggleMenu', 6778 value: function toggleMenu() { 6779 if (!Foundation.MediaQuery.atLeast(this.options.hideFor)) { 6780 this.$targetMenu.toggle(0); 6781 6782 /** 6783 * Fires when the element attached to the tab bar toggles. 6784 * @event ResponsiveToggle#toggled 6785 */ 6786 this.$element.trigger('toggled.zf.responsiveToggle'); 6787 } 6788 } 6789 }, { 6790 key: 'destroy', 6791 value: function destroy() { 6792 //TODO this... 6793 } 6794 }]); 6795 6796 return ResponsiveToggle; 6797 }(); 6798 6799 ResponsiveToggle.defaults = { 6800 /** 6801 * The breakpoint after which the menu is always shown, and the tab bar is hidden. 6802 * @option 6803 * @example 'medium' 6804 */ 6805 hideFor: 'medium' 6806 }; 6807 6808 // Window exports 6809 Foundation.plugin(ResponsiveToggle, 'ResponsiveToggle'); 6810}(jQuery); 6811'use strict'; 6812 6813var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 6814 6815function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6816 6817!function ($) { 6818 6819 /** 6820 * Reveal module. 6821 * @module foundation.reveal 6822 * @requires foundation.util.keyboard 6823 * @requires foundation.util.box 6824 * @requires foundation.util.triggers 6825 * @requires foundation.util.mediaQuery 6826 * @requires foundation.util.motion if using animations 6827 */ 6828 6829 var Reveal = function () { 6830 /** 6831 * Creates a new instance of Reveal. 6832 * @class 6833 * @param {jQuery} element - jQuery object to use for the modal. 6834 * @param {Object} options - optional parameters. 6835 */ 6836 6837 function Reveal(element, options) { 6838 _classCallCheck(this, Reveal); 6839 6840 this.$element = element; 6841 this.options = $.extend({}, Reveal.defaults, this.$element.data(), options); 6842 this._init(); 6843 6844 Foundation.registerPlugin(this, 'Reveal'); 6845 Foundation.Keyboard.register('Reveal', { 6846 'ENTER': 'open', 6847 'SPACE': 'open', 6848 'ESCAPE': 'close', 6849 'TAB': 'tab_forward', 6850 'SHIFT_TAB': 'tab_backward' 6851 }); 6852 } 6853 6854 /** 6855 * Initializes the modal by adding the overlay and close buttons, (if selected). 6856 * @private 6857 */ 6858 6859 6860 _createClass(Reveal, [{ 6861 key: '_init', 6862 value: function _init() { 6863 this.id = this.$element.attr('id'); 6864 this.isActive = false; 6865 this.cached = { mq: Foundation.MediaQuery.current }; 6866 this.isiOS = iPhoneSniff(); 6867 6868 if (this.isiOS) { 6869 this.$element.addClass('is-ios'); 6870 } 6871 6872 this.$anchor = $('[data-open="' + this.id + '"]').length ? $('[data-open="' + this.id + '"]') : $('[data-toggle="' + this.id + '"]'); 6873 6874 if (this.$anchor.length) { 6875 var anchorId = this.$anchor[0].id || Foundation.GetYoDigits(6, 'reveal'); 6876 6877 this.$anchor.attr({ 6878 'aria-controls': this.id, 6879 'id': anchorId, 6880 'aria-haspopup': true, 6881 'tabindex': 0 6882 }); 6883 this.$element.attr({ 'aria-labelledby': anchorId }); 6884 } 6885 6886 if (this.options.fullScreen || this.$element.hasClass('full')) { 6887 this.options.fullScreen = true;
6888 this.options.overlay = false; 6889 } 6890 if (this.options.overlay && !this.$overlay) { 6891 this.$overlay = this._makeOverlay(this.id); 6892 } 6893 6894 this.$element.attr({ 6895 'role': 'dialog', 6896 'aria-hidden': true, 6897 'data-yeti-box': this.id, 6898 'data-resize': this.id 6899 }); 6900 6901 if (this.$overlay) { 6902 this.$element.detach().appendTo(this.$overlay); 6903 } else { 6904 this.$element.detach().appendTo($('body')); 6905 this.$element.addClass('without-overlay'); 6906 } 6907 this._events(); 6908 if (this.options.deepLink && window.location.hash === '#' + this.id) { 6909 $(window).one('load.zf.reveal', this.open.bind(this)); 6910 } 6911 } 6912 6913 /** 6914 * Creates an overlay div to display behind the modal. 6915 * @private 6916 */ 6917 6918 }, { 6919 key: '_makeOverlay', 6920 value: function _makeOverlay(id) { 6921 var $overlay = $('<div></div>').addClass('reveal-overlay').attr({ 'tabindex': -1, 'aria-hidden': true }).appendTo('body'); 6922 return $overlay; 6923 } 6924 6925 /** 6926 * Updates position of modal 6927 * TODO: Figure out if we actually need to cache these values or if it doesn't matter 6928 * @private 6929 */ 6930 6931 }, { 6932 key: '_updatePosition', 6933 value: function _updatePosition() { 6934 var width = this.$element.outerWidth(); 6935 var outerWidth = $(window).width(); 6936 var height = this.$element.outerHeight(); 6937 var outerHeight = $(window).height(); 6938 var left = parseInt((outerWidth - width) / 2, 10); 6939 var top; 6940 if (height > outerHeight) { 6941 top = parseInt(Math.min(100, outerHeight / 10), 10); 6942 } else { 6943 top = parseInt((outerHeight - height) / 4, 10); 6944 } 6945 this.$element.css({ top: top + 'px' }); 6946 // only worry about left if we don't have an overlay, otherwise we're perfectly in the middle 6947 if (!this.$overlay) { 6948 this.$element.css({ left: left + 'px' }); 6949 } 6950 } 6951 6952 /** 6953 * Adds event handlers for the modal. 6954 * @private 6955 */ 6956 6957 }, { 6958 key: '_events', 6959 value: function _events() { 6960 var _this = this; 6961 6962 this.$element.on({ 6963 'open.zf.trigger': this.open.bind(this), 6964 'close.zf.trigger': this.close.bind(this), 6965 'toggle.zf.trigger': this.toggle.bind(this), 6966 'resizeme.zf.trigger': function () { 6967 _this._updatePosition(); 6968 } 6969 }); 6970 6971 if (this.$anchor.length) { 6972 this.$anchor.on('keydown.zf.reveal', function (e) { 6973 if (e.which === 13 || e.which === 32) { 6974 e.stopPropagation(); 6975 e.preventDefault(); 6976 _this.open(); 6977 } 6978 }); 6979 } 6980 6981 if (this.options.closeOnClick && this.options.overlay) { 6982 this.$overlay.off('.zf.reveal').on('click.zf.reveal', function (e) { 6983 if (e.target === _this.$element[0] || $.contains(_this.$element[0], e.target)) { 6984 return; 6985 } 6986 _this.close(); 6987 }); 6988 } 6989 if (this.options.deepLink) { 6990 $(window).on('popstate.zf.reveal:' + this.id, this._handleState.bind(this)); 6991 } 6992 } 6993 6994 /** 6995 * Handles modal methods on back/forward button clicks or any other event that triggers popstate. 6996 * @private 6997 */ 6998 6999 }, { 7000 key: '_handleState', 7001 value: function _handleState(e) { 7002 if (window.location.hash === '#' + this.id && !this.isActive) { 7003 this.open(); 7004 } else { 7005 this.close(); 7006 } 7007 } 7008 7009 /** 7010 * Opens the modal controlled by `this.$anchor`, and closes all others by default. 7011 * @function 7012 * @fires Reveal#closeme 7013 * @fires Reveal#open 7014 */ 7015 7016 }, { 7017 key: 'open', 7018 value: function open() { 7019 var _this2 = this; 7020 7021 if (this.options.deepLink) { 7022 var hash = '#' + this.id; 7023 7024 if (window.history.pushState) { 7025 window.history.pushState(null, null, hash); 7026 } else { 7027 window.location.hash = hash; 7028 } 7029 } 7030 7031 this.isActive = true; 7032 7033 // Make elements invisible, but remove display: none so we can get size and positioning 7034 this.$element.css({ 'visibility': 'hidden' }).show().scrollTop(0); 7035 if (this.options.overlay) { 7036 this.$overlay.css({ 'visibility': 'hidden' }).show(); 7037 } 7038 7039 this._updatePosition(); 7040 7041 this.$element.hide().css({ 'visibility': '' }); 7042 7043 if (this.$overlay) { 7044 this.$overlay.css({ 'visibility': '' }).hide(); 7045 } 7046 7047 if (!this.options.multipleOpened) { 7048 /** 7049 * Fires immediately before the modal opens. 7050 * Closes any other modals that are currently open 7051 * @event Reveal#closeme 7052 */ 7053 this.$element.trigger('closeme.zf.reveal', this.id); 7054 } 7055 7056 // Motion UI method of reveal 7057 if (this.options.animationIn) { 7058 if (this.options.overlay) { 7059 Foundation.Motion.animateIn(this.$overlay, 'fade-in'); 7060 } 7061 Foundation.Motion.animateIn(this.$element, this.options.animationIn, function () { 7062 this.focusableElements = Foundation.Keyboard.findFocusable(this.$element); 7063 }); 7064 } 7065 // jQuery method of reveal 7066 else { 7067 if (this.options.overlay) { 7068 this.$overlay.show(0); 7069 } 7070 this.$element.show(this.options.showDelay); 7071 } 7072 7073 // handle accessibility 7074 this.$element.attr({ 7075 'aria-hidden': false, 7076 'tabindex': -1 7077 }).focus(); 7078 7079 /** 7080 * Fires when the modal has successfully opened. 7081 * @event Reveal#open 7082 */ 7083 this.$element.trigger('open.zf.reveal'); 7084 7085 if (this.isiOS) { 7086 var scrollPos = window.pageYOffset; 7087 $('html, body').addClass('is-reveal-open').scrollTop(scrollPos); 7088 } else { 7089 $('body').addClass('is-reveal-open'); 7090 } 7091 7092 $('body').addClass('is-reveal-open').attr('aria-hidden', this.options.overlay || this.options.fullScreen ? true : false); 7093 7094 setTimeout(function () { 7095 _this2._extraHandlers(); 7096 }, 0); 7097 } 7098 7099 /** 7100 * Adds extra event handlers for the body and window if necessary. 7101 * @private 7102 */ 7103 7104 }, {
7105 key: '_extraHandlers', 7106 value: function _extraHandlers() { 7107 var _this = this; 7108 this.focusableElements = Foundation.Keyboard.findFocusable(this.$element); 7109 7110 if (!this.options.overlay && this.options.closeOnClick && !this.options.fullScreen) { 7111 $('body').on('click.zf.reveal', function (e) { 7112 if (e.target === _this.$element[0] || $.contains(_this.$element[0], e.target)) { 7113 return; 7114 } 7115 _this.close(); 7116 }); 7117 } 7118 7119 if (this.options.closeOnEsc) { 7120 $(window).on('keydown.zf.reveal', function (e) { 7121 Foundation.Keyboard.handleKey(e, 'Reveal', { 7122 close: function () { 7123 if (_this.options.closeOnEsc) { 7124 _this.close(); 7125 _this.$anchor.focus(); 7126 } 7127 } 7128 }); 7129 if (_this.focusableElements.length === 0) { 7130 // no focusable elements inside the modal at all, prevent tabbing in general 7131 e.preventDefault(); 7132 } 7133 }); 7134 } 7135 7136 // lock focus within modal while tabbing 7137 this.$element.on('keydown.zf.reveal', function (e) { 7138 var $target = $(this); 7139 // handle keyboard event with keyboard util 7140 Foundation.Keyboard.handleKey(e, 'Reveal', { 7141 tab_forward: function () { 7142 if (_this.$element.find(':focus').is(_this.focusableElements.eq(-1))) { 7143 // left modal downwards, setting focus to first element 7144 _this.focusableElements.eq(0).focus(); 7145 e.preventDefault(); 7146 } 7147 }, 7148 tab_backward: function () { 7149 if (_this.$element.find(':focus').is(_this.focusableElements.eq(0)) || _this.$element.is(':focus')) { 7150 // left modal upwards, setting focus to last element 7151 _this.focusableElements.eq(-1).focus(); 7152 e.preventDefault(); 7153 } 7154 }, 7155 open: function () { 7156 if (_this.$element.find(':focus').is(_this.$element.find('[data-close]'))) { 7157 setTimeout(function () { 7158 // set focus back to anchor if close button has been activated 7159 _this.$anchor.focus(); 7160 }, 1); 7161 } else if ($target.is(_this.focusableElements)) { 7162 // dont't trigger if acual element has focus (i.e. inputs, links, ...) 7163 _this.open(); 7164 } 7165 }, 7166 close: function () { 7167 if (_this.options.closeOnEsc) { 7168 _this.close(); 7169 _this.$anchor.focus(); 7170 } 7171 } 7172 }); 7173 }); 7174 } 7175 7176 /** 7177 * Closes the modal. 7178 * @function 7179 * @fires Reveal#closed 7180 */ 7181 7182 }, { 7183 key: 'close', 7184 value: function close() { 7185 if (!this.isActive || !this.$element.is(':visible')) { 7186 return false; 7187 } 7188 var _this = this; 7189 7190 // Motion UI method of hiding 7191 if (this.options.animationOut) { 7192 if (this.options.overlay) { 7193 Foundation.Motion.animateOut(this.$overlay, 'fade-out', finishUp); 7194 } else { 7195 finishUp(); 7196 } 7197 7198 Foundation.Motion.animateOut(this.$element, this.options.animationOut); 7199 } 7200 // jQuery method of hiding 7201 else { 7202 if (this.options.overlay) { 7203 this.$overlay.hide(0, finishUp); 7204 } else { 7205 finishUp(); 7206 } 7207 7208 this.$element.hide(this.options.hideDelay); 7209 } 7210 7211 // Conditionals to remove extra event listeners added on open 7212 if (this.options.closeOnEsc) { 7213 $(window).off('keydown.zf.reveal'); 7214 } 7215 7216 if (!this.options.overlay && this.options.closeOnClick) { 7217 $('body').off('click.zf.reveal'); 7218 } 7219 7220 this.$element.off('keydown.zf.reveal'); 7221 7222 function finishUp() { 7223 if (_this.isiOS) { 7224 $('html, body').removeClass('is-reveal-open'); 7225 } else { 7226 $('body').removeClass('is-reveal-open'); 7227 } 7228 7229 $('body').attr({ 7230 'aria-hidden': false, 7231 'tabindex': '' 7232 }); 7233 7234 _this.$element.attr('aria-hidden', true); 7235 7236 /** 7237 * Fires when the modal is done closing. 7238 * @event Reveal#closed 7239 */ 7240 _this.$element.trigger('closed.zf.reveal'); 7241 } 7242 7243 /** 7244 * Resets the modal content 7245 * This prevents a running video to keep going in the background 7246 */ 7247 if (this.options.resetOnClose) { 7248 this.$element.html(this.$element.html()); 7249 } 7250 7251 this.isActive = false;
7252 if (_this.options.deepLink) { 7253 if (window.history.replaceState) { 7254 window.history.replaceState("", document.title, window.location.pathname); 7255 } else { 7256 window.location.hash = ''; 7257 } 7258 } 7259 } 7260 7261 /** 7262 * Toggles the open/closed state of a modal. 7263 * @function 7264 */ 7265 7266 }, { 7267 key: 'toggle', 7268 value: function toggle() { 7269 if (this.isActive) { 7270 this.close(); 7271 } else { 7272 this.open(); 7273 } 7274 } 7275 }, { 7276 key: 'destroy', 7277 7278 7279 /** 7280 * Destroys an instance of a modal. 7281 * @function 7282 */ 7283 value: function destroy() { 7284 if (this.options.overlay) { 7285 this.$overlay.hide().off().remove(); 7286 } 7287 this.$element.hide().off(); 7288 this.$anchor.off('.zf'); 7289 $(window).off('.zf.reveal:' + this.id); 7290 7291 Foundation.unregisterPlugin(this); 7292 } 7293 }]); 7294 7295 return Reveal; 7296 }(); 7297 7298 Reveal.defaults = { 7299 /** 7300 * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide. 7301 * @option 7302 * @example 'slide-in-left' 7303 */ 7304 animationIn: '', 7305 /** 7306 * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide. 7307 * @option 7308 * @example 'slide-out-right' 7309 */ 7310 animationOut: '', 7311 /** 7312 * Time, in ms, to delay the opening of a modal after a click if no animation used. 7313 * @option 7314 * @example 10 7315 */ 7316 showDelay: 0, 7317 /** 7318 * Time, in ms, to delay the closing of a modal after a click if no animation used. 7319 * @option 7320 * @example 10 7321 */ 7322 hideDelay: 0, 7323 /** 7324 * Allows a click on the body/overlay to close the modal. 7325 * @option 7326 * @example true 7327 */ 7328 closeOnClick: true, 7329 /** 7330 * Allows the modal to close if the user presses the `ESCAPE` key. 7331 * @option 7332 * @example true 7333 */ 7334 closeOnEsc: true, 7335 /** 7336 * If true, allows multiple modals to be displayed at once. 7337 * @option 7338 * @example false 7339 */ 7340 multipleOpened: false, 7341 /** 7342 * Distance, in pixels, the modal should push down from the top of the screen. 7343 * @option 7344 * @example 100 7345 */ 7346 vOffset: 100, 7347 /** 7348 * Distance, in pixels, the modal should push in from the side of the screen. 7349 * @option 7350 * @example 0 7351 */ 7352 hOffset: 0, 7353 /** 7354 * Allows the modal to be fullscreen, completely blocking out the rest of the view. JS checks for this as well. 7355 * @option 7356 * @example false 7357 */ 7358 fullScreen: false, 7359 /** 7360 * Percentage of screen height the modal should push up from the bottom of the view. 7361 * @option 7362 * @example 10 7363 */ 7364 btmOffsetPct: 10, 7365 /** 7366 * Allows the modal to generate an overlay div, which will cover the view when modal opens. 7367 * @option 7368 * @example true 7369 */ 7370 overlay: true, 7371 /** 7372 * Allows the modal to remove and reinject markup on close. Should be true if using video elements w/o using provider's api, otherwise, videos will continue to play in the background. 7373 * @option 7374 * @example false 7375 */ 7376 resetOnClose: false, 7377 /** 7378 * Allows the modal to alter the url on open/close, and allows the use of the `back` button to close modals. ALSO, allows a modal to auto-maniacally open on page load IF the hash === the modal's user-set id. 7379 * @option 7380 * @example false 7381 */ 7382 deepLink: false 7383 }; 7384 7385 // Window exports 7386 Foundation.plugin(Reveal, 'Reveal'); 7387 7388 function iPhoneSniff() { 7389 return (/iP(ad|hone|od).*OS/.test(window.navigator.userAgent) 7390 ); 7391 } 7392}(jQuery); 7393'use strict'; 7394 7395var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 7396 7397function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7398 7399!function ($) { 7400 7401 /** 7402 * Slider module. 7403 * @module foundation.slider 7404 * @requires foundation.util.motion 7405 * @requires foundation.util.triggers 7406 * @requires foundation.util.keyboard 7407 * @requires foundation.util.touch 7408 */ 7409 7410 var Slider = function () { 7411 /** 7412 * Creates a new instance of a drilldown menu. 7413 * @class 7414 * @param {jQuery} element - jQuery object to make into an accordion menu. 7415 * @param {Object} options - Overrides to the default plugin settings. 7416 */ 7417 7418 function Slider(element, options) { 7419 _classCallCheck(this, Slider); 7420 7421 this.$element = element; 7422 this.options = $.extend({}, Slider.defaults, this.$element.data(), options); 7423 7424 this._init(); 7425 7426 Foundation.registerPlugin(this, 'Slider'); 7427 Foundation.Keyboard.register('Slider', { 7428 'ltr': { 7429 'ARROW_RIGHT': 'increase', 7430 'ARROW_UP': 'increase', 7431 'ARROW_DOWN': 'decrease', 7432 'ARROW_LEFT': 'decrease', 7433 'SHIFT_ARROW_RIGHT': 'increase_fast', 7434 'SHIFT_ARROW_UP': 'increase_fast', 7435 'SHIFT_ARROW_DOWN': 'decrease_fast', 7436 'SHIFT_ARROW_LEFT': 'decrease_fast' 7437 }, 7438 'rtl': { 7439 'ARROW_LEFT': 'increase', 7440 'ARROW_RIGHT': 'decrease', 7441 'SHIFT_ARROW_LEFT': 'increase_fast', 7442 'SHIFT_ARROW_RIGHT': 'decrease_fast' 7443 } 7444 }); 7445 } 7446 7447 /** 7448 * Initilizes the plugin by reading/setting attributes, creating collections and setting the initial position of the handle(s). 7449 * @function 7450 * @private 7451 */ 7452 7453 7454 _createClass(Slider, [{ 7455 key: '_init', 7456 value: function _init() { 7457 this.inputs = this.$element.find('input');
7458 this.handles = this.$element.find('[data-slider-handle]'); 7459 7460 this.$handle = this.handles.eq(0); 7461 this.$input = this.inputs.length ? this.inputs.eq(0) : $('#' + this.$handle.attr('aria-controls')); 7462 this.$fill = this.$element.find('[data-slider-fill]').css(this.options.vertical ? 'height' : 'width', 0); 7463 7464 var isDbl = false, 7465 _this = this; 7466 if (this.options.disabled || this.$element.hasClass(this.options.disabledClass)) { 7467 this.options.disabled = true; 7468 this.$element.addClass(this.options.disabledClass); 7469 } 7470 if (!this.inputs.length) { 7471 this.inputs = $().add(this.$input); 7472 this.options.binding = true; 7473 } 7474 this._setInitAttr(0); 7475 this._events(this.$handle); 7476 7477 if (this.handles[1]) { 7478 this.options.doubleSided = true; 7479 this.$handle2 = this.handles.eq(1); 7480 this.$input2 = this.inputs.length > 1 ? this.inputs.eq(1) : $('#' + this.$handle2.attr('aria-controls')); 7481 7482 if (!this.inputs[1]) { 7483 this.inputs = this.inputs.add(this.$input2); 7484 } 7485 isDbl = true; 7486 7487 this._setHandlePos(this.$handle, this.options.initialStart, true, function () { 7488 7489 _this._setHandlePos(_this.$handle2, _this.options.initialEnd, true); 7490 }); 7491 // this.$handle.triggerHandler('click.zf.slider'); 7492 this._setInitAttr(1); 7493 this._events(this.$handle2); 7494 } 7495 7496 if (!isDbl) { 7497 this._setHandlePos(this.$handle, this.options.initialStart, true); 7498 } 7499 } 7500 7501 /** 7502 * Sets the position of the selected handle and fill bar. 7503 * @function 7504 * @private 7505 * @param {jQuery} $hndl - the selected handle to move. 7506 * @param {Number} location - floating point between the start and end values of the slider bar. 7507 * @param {Function} cb - callback function to fire on completion. 7508 * @fires Slider#moved 7509 */ 7510 7511 }, { 7512 key: '_setHandlePos', 7513 value: function _setHandlePos($hndl, location, noInvert, cb) { 7514 //might need to alter that slightly for bars that will have odd number selections. 7515 location = parseFloat(location); //on input change events, convert string to number...grumble. 7516 7517 // prevent slider from running out of bounds, if value exceeds the limits set through options, override the value to min/max 7518 if (location < this.options.start) { 7519 location = this.options.start; 7520 } else if (location > this.options.end) { 7521 location = this.options.end; 7522 } 7523 7524 var isDbl = this.options.doubleSided; 7525 7526 if (isDbl) { 7527 //this block is to prevent 2 handles from crossing eachother. Could/should be improved. 7528 if (this.handles.index($hndl) === 0) { 7529 var h2Val = parseFloat(this.$handle2.attr('aria-valuenow')); 7530 location = location >= h2Val ? h2Val - this.options.step : location; 7531 } else { 7532 var h1Val = parseFloat(this.$handle.attr('aria-valuenow')); 7533 location = location <= h1Val ? h1Val + this.options.step : location; 7534 } 7535 } 7536 7537 //this is for single-handled vertical sliders, it adjusts the value to account for the slider being "upside-down" 7538 //for click and drag events, it's weird due to the scale(-1, 1) css property 7539 if (this.options.vertical && !noInvert) { 7540 location = this.options.end - location; 7541 } 7542 7543 var _this = this, 7544 vert = this.options.vertical, 7545 hOrW = vert ? 'height' : 'width', 7546 lOrT = vert ? 'top' : 'left', 7547 handleDim = $hndl[0].getBoundingClientRect()[hOrW], 7548 elemDim = this.$element[0].getBoundingClientRect()[hOrW], 7549 7550 //percentage of bar min/max value based on click or drag point 7551 pctOfBar = percent(location, this.options.end).toFixed(2), 7552 7553 //number of actual pixels to shift the handle, based on the percentage obtained above 7554 pxToMove = (elemDim - handleDim) * pctOfBar, 7555 7556 //percentage of bar to shift the handle 7557 movement = (percent(pxToMove, elemDim) * 100).toFixed(this.options.decimal); 7558 //fixing the decimal value for the location number, is passed to other methods as a fixed floating-point value 7559 location = parseFloat(location.toFixed(this.options.decimal)); 7560 // declare empty object for css adjustments, only used with 2 handled-sli
7560ders 7561 var css = {}; 7562 7563 this._setValues($hndl, location); 7564 7565 // TODO update to calculate based on values set to respective inputs?? 7566 if (isDbl) { 7567 var isLeftHndl = this.handles.index($hndl) === 0, 7568 7569 //empty variable, will be used for min-height/width for fill bar 7570 dim, 7571 7572 //percentage w/h of the handle compared to the slider bar 7573 handlePct = ~ ~(percent(handleDim, elemDim) * 100); 7574 //if left handle, the math is slightly different than if it's the right handle, and the left/top property needs to be changed for the fill bar 7575 if (isLeftHndl) { 7576 //left or top percentage value to apply to the fill bar. 7577 css[lOrT] = movement + '%'; 7578 //calculate the new min-height/width for the fill bar. 7579 dim = parseFloat(this.$handle2[0].style[lOrT]) - movement + handlePct; 7580 //this callback is necessary to prevent errors and allow the proper placement and initialization of a 2-handled slider 7581 //plus, it means we don't care if 'dim' isNaN on init, it won't be in the future. 7582 if (cb && typeof cb === 'function') { 7583 cb(); 7584 } //this is only needed for the initialization of 2 handled sliders 7585 } else { 7586 //just caching the value of the left/bottom handle's left/top property 7587 var handlePos = parseFloat(this.$handle[0].style[lOrT]); 7588 //calculate the new min-height/width for the fill bar. Use isNaN to prevent false positives for numbers <= 0 7589 //based on the percentage of movement of the handle being manipulated, less the opposing handle's left/top position, plus the percentage w/h of the handle itself 7590 dim = movement - (isNaN(handlePos) ? this.options.initialStart / ((this.options.end - this.options.start) / 100) : handlePos) + handlePct; 7591 } 7592 // assign the min-height/width to our css object 7593 css['min-' + hOrW] = dim + '%'; 7594 } 7595 7596 this.$element.one('finished.zf.animate', function () { 7597 /** 7598 * Fires when the handle is done moving. 7599 * @event Slider#moved 7600 */ 7601 _this.$element.trigger('moved.zf.slider', [$hndl]); 7602 }); 7603 7604 //because we don't know exactly how the handle will be moved, check the amount of time it should take to move. 7605 var moveTime = this.$element.data('dragging') ? 1000 / 60 : this.options.moveTime; 7606 7607 Foundation.Move(moveTime, $hndl, function () { 7608 //adjusting the left/top property of the handle, based on the percentage calculated above 7609 $hndl.css(lOrT, movement + '%'); 7610 7611 if (!_this.options.doubleSided) { 7612 //if single-handled, a simple method to expand the fill bar 7613 _this.$fill.css(hOrW, pctOfBar * 100 + '%'); 7614 } else { 7615 //otherwise, use the css object we created above 7616 _this.$fill.css(css); 7617 } 7618 }); 7619 } 7620 7621 /** 7622 * Sets the initial attribute for the slider element. 7623 * @function 7624 * @private 7625 * @param {Number} idx - index of the current handle/input to use. 7626 */ 7627 7628 }, { 7629 key: '_setInitAttr', 7630 value: function _setInitAttr(idx) { 7631 var id = this.inputs.eq(idx).attr('id') || Foundation.GetYoDigits(6, 'slider'); 7632 this.inputs.eq(idx).attr({ 7633 'id': id, 7634 'max': this.options.end, 7635 'min': this.options.start, 7636 'step': this.options.step 7637 }); 7638 this.handles.eq(idx).attr({ 7639 'role': 'slider', 7640 'aria-controls': id, 7641 'aria-valuemax': this.options.end, 7642 'aria-valuemin': this.options.start, 7643 'aria-valuenow': idx === 0 ? this.options.initialStart : this.options.initialEnd, 7644 'aria-orientation': this.options.vertical ? 'vertical' : 'horizontal', 7645 'tabindex': 0 7646 }); 7647 } 7648 7649 /** 7650 * Sets the input and `aria-valuenow` values for the slider element. 7651 * @function 7652 * @private 7653 * @param {jQuery} $handle - the currently selected handle. 7654 * @param {Number} val - floating point of the new value. 7655 */ 7656 7657 }, {
7658 key: '_setValues', 7659 value: function _setValues($handle, val) { 7660 var idx = this.options.doubleSided ? this.handles.index($handle) : 0; 7661 this.inputs.eq(idx).val(val); 7662 $handle.attr('aria-valuenow', val); 7663 } 7664 7665 /** 7666 * Handles events on the slider element. 7667 * Calculates the new location of the current handle. 7668 * If there are two handles and the bar was clicked, it determines which handle to move. 7669 * @function 7670 * @private 7671 * @param {Object} e - the `event` object passed from the listener. 7672 * @param {jQuery} $handle - the current handle to calculate for, if selected. 7673 * @param {Number} val - floating point number for the new value of the slider. 7674 * TODO clean this up, there's a lot of repeated code between this and the _setHandlePos fn. 7675 */ 7676 7677 }, { 7678 key: '_handleEvent', 7679 value: function _handleEvent(e, $handle, val) { 7680 var value, hasVal; 7681 if (!val) { 7682 //click or drag events 7683 e.preventDefault(); 7684 var _this = this, 7685 vertical = this.options.vertical, 7686 param = vertical ? 'height' : 'width', 7687 direction = vertical ? 'top' : 'left', 7688 pageXY = vertical ? e.pageY : e.pageX, 7689 halfOfHandle = this.$handle[0].getBoundingClientRect()[param] / 2, 7690 barDim = this.$element[0].getBoundingClientRect()[param], 7691 barOffset = this.$element.offset()[direction] - pageXY, 7692 7693 //if the cursor position is less than or greater than the elements bounding coordinates, set coordinates within those bounds 7694 barXY = barOffset > 0 ? -halfOfHandle : barOffset - halfOfHandle < -barDim ? barDim : Math.abs(barOffset), 7695 offsetPct = percent(barXY, barDim); 7696 value = (this.options.end - this.options.start) * offsetPct; 7697 7698 // turn everything around for RTL, yay math! 7699 if (Foundation.rtl() && !this.options.vertical) { 7700 value = this.options.end - value; 7701 } 7702 7703 value = _this._adjustValue(null, value); 7704 //boolean flag for the setHandlePos fn, specifically for vertical sliders 7705 hasVal = false;
7706 7707 if (!$handle) { 7708 //figure out which handle it is, pass it to the next function. 7709 var firstHndlPos = absPosition(this.$handle, direction, barXY, param), 7710 secndHndlPos = absPosition(this.$handle2, direction, barXY, param); 7711 $handle = firstHndlPos <= secndHndlPos ? this.$handle : this.$handle2; 7712 } 7713 } else { 7714 //change event on input 7715 value = this._adjustValue(null, val); 7716 hasVal = true; 7717 } 7718 7719 this._setHandlePos($handle, value, hasVal); 7720 } 7721 7722 /** 7723 * Adjustes value for handle in regard to step value. returns adjusted value 7724 * @function 7725 * @private 7726 * @param {jQuery} $handle - the selected handle. 7727 * @param {Number} value - value to adjust. used if $handle is falsy 7728 */ 7729 7730 }, { 7731 key: '_adjustValue', 7732 value: function _adjustValue($handle, value) { 7733 var val, 7734 step = this.options.step, 7735 div = parseFloat(step / 2), 7736 left, 7737 prev_val, 7738 next_val; 7739 if (!!$handle) { 7740 val = parseFloat($handle.attr('aria-valuenow')); 7741 } else { 7742 val = value; 7743 } 7744 left = val % step; 7745 prev_val = val - left; 7746 next_val = prev_val + step; 7747 if (left === 0) { 7748 return val; 7749 } 7750 val = val >= prev_val + div ? next_val : prev_val; 7751 return val; 7752 } 7753 7754 /** 7755 * Adds event listeners to the slider elements. 7756 * @function 7757 * @private 7758 * @param {jQuery} $handle - the current handle to apply listeners to. 7759 */ 7760 7761 }, { 7762 key: '_events', 7763 value: function _events($handle) { 7764 if (this.options.disabled) { 7765 return false; 7766 } 7767 7768 var _this = this, 7769 curHandle, 7770 timer; 7771 7772 this.inputs.off('change.zf.slider').on('change.zf.slider', function (e) { 7773 var idx = _this.inputs.index($(this)); 7774 _this._handleEvent(e, _this.handles.eq(idx), $(this).val()); 7775 }); 7776 7777 if (this.options.clickSelect) { 7778 this.$element.off('click.zf.slider').on('click.zf.slider', function (e) { 7779 if (_this.$element.data('dragging')) { 7780 return false; 7781 } 7782 7783 if (!$(e.target).is('[data-slider-handle]')) { 7784 if (_this.options.doubleSided) { 7785 _this._handleEvent(e); 7786 } else { 7787 _this._handleEvent(e, _this.$handle); 7788 } 7789 } 7790 }); 7791 } 7792 7793 if (this.options.draggable) { 7794 this.handles.addTouch(); 7795 7796 var $body = $('body'); 7797 $handle.off('mousedown.zf.slider').on('mousedown.zf.slider', function (e) { 7798 $handle.addClass('is-dragging'); 7799 _this.$fill.addClass('is-dragging'); // 7800 _this.$element.data('dragging', true); 7801 7802 curHandle = $(e.currentTarget); 7803 7804 $body.on('mousemove.zf.slider', function (e) { 7805 e.preventDefault(); 7806 7807 _this._handleEvent(e, curHandle); 7808 }).on('mouseup.zf.slider', function (e) { 7809 _this._handleEvent(e, curHandle); 7810 7811 $handle.removeClass('is-dragging'); 7812 _this.$fill.removeClass('is-dragging'); 7813 _this.$element.data('dragging', false); 7814 7815 $body.off('mousemove.zf.slider mouseup.zf.slider'); 7816 }); 7817 }); 7818 } 7819 7820 $handle.off('keydown.zf.slider').on('keydown.zf.slider', function (e) { 7821 var _$handle = $(this), 7822 idx = _this.options.doubleSided ? _this.handles.index(_$handle) : 0, 7823 oldValue = parseFloat(_this.inputs.eq(idx).val()), 7824 newValue; 7825 7826 // handle keyboard event with keyboard util 7827 Foundation.Keyboard.handleKey(e, 'Slider', { 7828 decrease: function () { 7829 newValue = oldValue - _this.options.step; 7830 }, 7831 increase: function () { 7832 newValue = oldValue + _this.options.step; 7833 }, 7834 decrease_fast: function () { 7835 newValue = oldValue - _this.options.step * 10; 7836 }, 7837 increase_fast: function () { 7838 newValue = oldValue + _this.options.step * 10; 7839 }, 7840 handled: function () { 7841 // only set handle pos when event was handled specially 7842 e.preventDefault(); 7843 _this._setHandlePos(_$handle, newValue, true); 7844 } 7845 }); 7846 /*if (newValue) { // if pressed key has special function, update value 7847 e.preventDefault(); 7848 _this._setHandlePos(_$handle, newValue); 7849 }*/ 7850 }); 7851 } 7852 7853 /** 7854 * Destroys the slider plugin. 7855 */ 7856 7857 }, {
7858 key: 'destroy', 7859 value: function destroy() { 7860 this.handles.off('.zf.slider'); 7861 this.inputs.off('.zf.slider'); 7862 this.$element.off('.zf.slider'); 7863 7864 Foundation.unregisterPlugin(this); 7865 } 7866 }]); 7867 7868 return Slider; 7869 }(); 7870 7871 Slider.defaults = { 7872 /** 7873 * Minimum value for the slider scale. 7874 * @option 7875 * @example 0 7876 */ 7877 start: 0, 7878 /** 7879 * Maximum value for the slider scale. 7880 * @option 7881 * @example 100 7882 */ 7883 end: 100, 7884 /** 7885 * Minimum value change per change event. 7886 * @option 7887 * @example 1 7888 */ 7889 step: 1, 7890 /** 7891 * Value at which the handle/input *(left handle/first input)* should be set to on initialization. 7892 * @option 7893 * @example 0 7894 */ 7895 initialStart: 0, 7896 /** 7897 * Value at which the right handle/second input should be set to on initialization. 7898 * @option 7899 * @example 100 7900 */ 7901 initialEnd: 100, 7902 /** 7903 * Allows the input to be located outside the container and visible. Set to by the JS 7904 * @option 7905 * @example false 7906 */ 7907 binding: false, 7908 /** 7909 * Allows the user to click/tap on the slider bar to select a value. 7910 * @option 7911 * @example true 7912 */ 7913 clickSelect: true, 7914 /** 7915 * Set to true and use the `vertical` class to change alignment to vertical. 7916 * @option 7917 * @example false 7918 */ 7919 vertical: false, 7920 /** 7921 * Allows the user to drag the slider handle(s) to select a value. 7922 * @option 7923 * @example true 7924 */ 7925 draggable: true, 7926 /** 7927 * Disables the slider and prevents event listeners from being applied. Double checked by JS with `disabledClass`. 7928 * @option 7929 * @example false 7930 */ 7931 disabled: false, 7932 /** 7933 * Allows the use of two handles. Double checked by the JS. Changes some logic handling. 7934 * @option 7935 * @example false 7936 */ 7937 doubleSided: false, 7938 /** 7939 * Potential future feature. 7940 */ 7941 // steps: 100, 7942 /** 7943 * Number of decimal places the plugin should go to for floating point precision. 7944 * @option 7945 * @example 2 7946 */ 7947 decimal: 2, 7948 /** 7949 * Time delay for dragged elements. 7950 */ 7951 // dragDelay: 0, 7952 /** 7953 * Time, in ms, to animate the movement of a slider handle if user clicks/taps on the bar. Needs to be manually set if updating the transition time in the Sass settings. 7954 * @option 7955 * @example 200 7956 */ 7957 moveTime: 200, //update this if changing the transition time in the sass 7958 /** 7959 * Class applied to disabled sliders. 7960 * @option 7961 * @example 'disabled' 7962 */ 7963 disabledClass: 'disabled', 7964 /** 7965 * Will invert the default layout for a vertical<span data-tooltip title="who would do this???"> </span>slider. 7966 * @option 7967 * @example false 7968 */ 7969 invertVertical: false 7970 }; 7971 7972 function percent(frac, num) { 7973 return frac / num; 7974 } 7975 function absPosition($handle, dir, clickPos, param) { 7976 return Math.abs($handle.position()[dir] + $handle[param]() / 2 - clickPos); 7977 } 7978 7979 // Window exports 7980 Foundation.plugin(Slider, 'Slider'); 7981}(jQuery); 7982 7983//*********this is in case we go to static, absolute positions instead of dynamic positioning******** 7984// this.setSteps(function() { 7985// _this._events(); 7986// var initStart = _this.options.positions[_this.options.initialStart - 1] || null; 7987// var initEnd = _this.options.initialEnd ? _this.options.position[_this.options.initialEnd - 1] : null; 7988// if (initStart || initEnd) { 7989// _this._handleEvent(initStart, initEnd); 7990// } 7991// }); 7992 7993//***********the other part of absolute positions************* 7994// Slider.prototype.setSteps = function(cb) { 7995// var posChange = this.$element.outerWidth() / this.options.steps; 7996// var counter = 0 7997// while(counter < this.options.steps) { 7998// if (counter) { 7999// this.options.positions.push(this.options.positions[counter - 1] + posChange); 8000// } else { 8001// this.options.positions.push(posChange); 8002// } 8003// counter++; 8004// } 8005// cb(); 8006// }; 8007'use strict'; 8008 8009var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8010 8011function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8012 8013!function ($) { 8014 8015 /** 8016 * Sticky module. 8017 * @module foundation.sticky 8018 * @requires foundation.util.triggers 8019 * @requires foundation.util.mediaQuery 8020 */ 8021 8022 var Sticky = function () { 8023 /** 8024 * Creates a new instance of a sticky thing. 8025 * @class 8026 * @param {jQuery} element - jQuery object to make sticky. 8027 * @param {Object} options - options object passed when creating the element programmatically. 8028 */ 8029 8030 function Sticky(element, options) { 8031 _classCallCheck(this, Sticky); 8032 8033 this.$element = element; 8034 this.options = $.extend({}, Sticky.defaults, this.$element.data(), options); 8035 8036 this._init(); 8037 8038 Foundation.registerPlugin(this, 'Sticky'); 8039 } 8040 8041 /** 8042 * Initializes the sticky element by adding classes, getting/setting dimensions, breakpoints and attributes 8043 * @function 8044 * @private 8045 */ 8046 8047 8048 _createClass(Sticky, [{ 8049 key: '_init', 8050 value: function _init() { 8051 var $parent = this.$element.parent('[data-sticky-container]'), 8052 id = this.$element[0].id || Foundation.GetYoDigits(6, 'sticky'), 8053 _this = this; 8054 8055 if (!$parent.length) { 8056 this.wasWrapped = true; 8057 } 8058 this.$container = $parent.length ? $parent : $(this.options.container).wrapInner(this.$element); 8059 this.$container.addClass(this.options.containerClass); 8060 8061 this.$element.addClass(this.options.stickyClass).attr({ 'data-resize': id }); 8062 8063 this.scrollCount = this.options.checkEvery; 8064 this.isStuck = false;
8065 $(window).one('load.zf.sticky', function () { 8066 if (_this.options.anchor !== '') { 8067 _this.$anchor = $('#' + _this.options.anchor); 8068 } else { 8069 _this._parsePoints(); 8070 } 8071 8072 _this._setSizes(function () { 8073 _this._calc(false); 8074 }); 8075 _this._events(id.split('-').reverse().join('-')); 8076 }); 8077 } 8078 8079 /** 8080 * If using multiple elements as anchors, calculates the top and bottom pixel values the sticky thing should stick and unstick on. 8081 * @function 8082 * @private 8083 */ 8084 8085 }, { 8086 key: '_parsePoints', 8087 value: function _parsePoints() { 8088 var top = this.options.topAnchor, 8089 btm = this.options.btmAnchor, 8090 pts = [top, btm], 8091 breaks = {}; 8092 if (top && btm) { 8093 8094 for (var i = 0, len = pts.length; i < len && pts[i]; i++) { 8095 var pt; 8096 if (typeof pts[i] === 'number') { 8097 pt = pts[i]; 8098 } else { 8099 var place = pts[i].split(':'), 8100 anchor = $('#' + place[0]); 8101 8102 pt = anchor.offset().top; 8103 if (place[1] && place[1].toLowerCase() === 'bottom') { 8104 pt += anchor[0].getBoundingClientRect().height; 8105 } 8106 } 8107 breaks[i] = pt; 8108 } 8109 } else { 8110 breaks = { 0: 1, 1: document.documentElement.scrollHeight }; 8111 } 8112 8113 this.points = breaks; 8114 return; 8115 } 8116 8117 /** 8118 * Adds event handlers for the scrolling element. 8119 * @private 8120 * @param {String} id - psuedo-random id for unique scroll event listener. 8121 */ 8122 8123 }, { 8124 key: '_events', 8125 value: function _events(id) { 8126 var _this = this, 8127 scrollListener = this.scrollListener = 'scroll.zf.' + id; 8128 if (this.isOn) { 8129 return; 8130 } 8131 if (this.canStick) { 8132 this.isOn = true; 8133 $(window).off(scrollListener).on(scrollListener, function (e) { 8134 if (_this.scrollCount === 0) { 8135 _this.scrollCount = _this.options.checkEvery; 8136 _this._setSizes(function () { 8137 _this._calc(false, window.pageYOffset); 8138 }); 8139 } else { 8140 _this.scrollCount--; 8141 _this._calc(false, window.pageYOffset); 8142 } 8143 }); 8144 } 8145 8146 this.$element.off('resizeme.zf.trigger').on('resizeme.zf.trigger', function (e, el) { 8147 _this._setSizes(function () { 8148 _this._calc(false); 8149 if (_this.canStick) { 8150 if (!_this.isOn) { 8151 _this._events(id); 8152 } 8153 } else if (_this.isOn) { 8154 _this._pauseListeners(scrollListener); 8155 } 8156 }); 8157 }); 8158 } 8159 8160 /** 8161 * Removes event handlers for scroll and change events on anchor. 8162 * @fires Sticky#pause 8163 * @param {String} scrollListener - unique, namespaced scroll listener attached to `window` 8164 */ 8165 8166 }, { 8167 key: '_pauseListeners', 8168 value: function _pauseListeners(scrollListener) { 8169 this.isOn = false; 8170 $(window).off(scrollListener); 8171 8172 /** 8173 * Fires when the plugin is paused due to resize event shrinking the view. 8174 * @event Sticky#pause 8175 * @private 8176 */ 8177 this.$element.trigger('pause.zf.sticky'); 8178 } 8179 8180 /** 8181 * Called on every `scroll` event and on `_init` 8182 * fires functions based on booleans and cached values 8183 * @param {Boolean} checkSizes - true if plugin should recalculate sizes and breakpoints. 8184 * @param {Number} scroll - current scroll position passed from scroll event cb function. If not passed, defaults to `window.pageYOffset`. 8185 */ 8186 8187 }, { 8188 key: '_calc', 8189 value: function _calc(checkSizes, scroll) { 8190 if (checkSizes) { 8191 this._setSizes(); 8192 } 8193 8194 if (!this.canStick) { 8195 if (this.isStuck) { 8196 this._removeSticky(true); 8197 } 8198 return false; 8199 } 8200 8201 if (!scroll) { 8202 scroll = window.pageYOffset; 8203 } 8204 8205 if (scroll >= this.topPoint) { 8206 if (scroll <= this.bottomPoint) { 8207 if (!this.isStuck) { 8208 this._setSticky(); 8209 } 8210 } else { 8211 if (this.isStuck) { 8212 this._removeSticky(false); 8213 } 8214 } 8215 } else { 8216 if (this.isStuck) { 8217 this._removeSticky(true); 8218 } 8219 } 8220 } 8221 8222 /** 8223 * Causes the $element to become stuck. 8224 * Adds `position: fixed;`, and helper classes. 8225 * @fires Sticky#stuckto 8226 * @function 8227 * @private 8228 */ 8229 8230 }, {
8231 key: '_setSticky', 8232 value: function _setSticky() { 8233 var stickTo = this.options.stickTo, 8234 mrgn = stickTo === 'top' ? 'marginTop' : 'marginBottom', 8235 notStuckTo = stickTo === 'top' ? 'bottom' : 'top', 8236 css = {}; 8237 8238 css[mrgn] = this.options[mrgn] + 'em'; 8239 css[stickTo] = 0; 8240 css[notStuckTo] = 'auto'; 8241 css['left'] = this.$container.offset().left + parseInt(window.getComputedStyle(this.$container[0])["padding-left"], 10); 8242 this.isStuck = true; 8243 this.$element.removeClass('is-anchored is-at-' + notStuckTo).addClass('is-stuck is-at-' + stickTo).css(css) 8244 /** 8245 * Fires when the $element has become `position: fixed;` 8246 * Namespaced to `top` or `bottom`, e.g. `sticky.zf.stuckto:top` 8247 * @event Sticky#stuckto 8248 */ 8249 .trigger('sticky.zf.stuckto:' + stickTo); 8250 } 8251 8252 /** 8253 * Causes the $element to become unstuck. 8254 * Removes `position: fixed;`, and helper classes. 8255 * Adds other helper classes. 8256 * @param {Boolean} isTop - tells the function if the $element should anchor to the top or bottom of its $anchor element. 8257 * @fires Sticky#unstuckfrom 8258 * @private 8259 */ 8260 8261 }, { 8262 key: '_removeSticky', 8263 value: function _removeSticky(isTop) { 8264 var stickTo = this.options.stickTo, 8265 stickToTop = stickTo === 'top', 8266 css = {}, 8267 anchorPt = (this.points ? this.points[1] - this.points[0] : this.anchorHeight) - this.elemHeight, 8268 mrgn = stickToTop ? 'marginTop' : 'marginBottom', 8269 notStuckTo = stickToTop ? 'bottom' : 'top', 8270 topOrBottom = isTop ? 'top' : 'bottom'; 8271 8272 css[mrgn] = 0; 8273 8274 if (isTop && !stickToTop || stickToTop && !isTop) { 8275 css[stickTo] = anchorPt; 8276 css[notStuckTo] = 0; 8277 } else { 8278 css[stickTo] = 0; 8279 css[notStuckTo] = anchorPt; 8280 } 8281 8282 css['left'] = ''; 8283 this.isStuck = false; 8284 this.$element.removeClass('is-stuck is-at-' + stickTo).addClass('is-anchored is-at-' + topOrBottom).css(css) 8285 /** 8286 * Fires when the $element has become anchored. 8287 * Namespaced to `top` or `bottom`, e.g. `sticky.zf.unstuckfrom:bottom` 8288 * @event Sticky#unstuckfrom 8289 */ 8290 .trigger('sticky.zf.unstuckfrom:' + topOrBottom); 8291 } 8292 8293 /** 8294 * Sets the $element and $container sizes for plugin. 8295 * Calls `_setBreakPoints`. 8296 * @param {Function} cb - optional callback function to fire on completion of `_setBreakPoints`. 8297 * @private 8298 */ 8299 8300 }, { 8301 key: '_setSizes', 8302 value: function _setSizes(cb) { 8303 this.canStick = Foundation.MediaQuery.atLeast(this.options.stickyOn); 8304 if (!this.canStick) { 8305 cb(); 8306 } 8307 var _this = this, 8308 newElemWidth = this.$container[0].getBoundingClientRect().width, 8309 comp = window.getComputedStyle(this.$container[0]), 8310 pdng = parseInt(comp['padding-right'], 10); 8311 8312 if (this.$anchor && this.$anchor.length) { 8313 this.anchorHeight = this.$anchor[0].getBoundingClientRect().height; 8314 } else { 8315 this._parsePoints(); 8316 } 8317 8318 this.$element.css({ 8319 'max-width': newElemWidth - pdng + 'px' 8320 }); 8321 8322 var newContainerHeight = this.$element[0].getBoundingClientRect().height || this.containerHeight; 8323 this.containerHeight = newContainerHeight; 8324 this.$container.css({ 8325 height: newContainerHeight 8326 }); 8327 this.elemHeight = newContainerHeight; 8328 8329 if (this.isStuck) { 8330 this.$element.css({ "left": this.$container.offset().left + parseInt(comp['padding-left'], 10) }); 8331 } 8332 8333 this._setBreakPoints(newContainerHeight, function () { 8334 if (cb) { 8335 cb(); 8336 } 8337 }); 8338 } 8339 8340 /** 8341 * Sets the upper and lower breakpoints for the element to become sticky/unsticky. 8342 * @param {Number} elemHeight - px value for sticky.$element height, calculated by `_setSizes`. 8343 * @param {Function} cb - optional callback function to be called on completion. 8344 * @private 8345 */ 8346 8347 }, {
8348 key: '_setBreakPoints', 8349 value: function _setBreakPoints(elemHeight, cb) { 8350 if (!this.canStick) { 8351 if (cb) { 8352 cb(); 8353 } else { 8354 return false; 8355 } 8356 } 8357 var mTop = emCalc(this.options.marginTop), 8358 mBtm = emCalc(this.options.marginBottom), 8359 topPoint = this.points ? this.points[0] : this.$anchor.offset().top, 8360 bottomPoint = this.points ? this.points[1] : topPoint + this.anchorHeight, 8361 8362 // topPoint = this.$anchor.offset().top || this.points[0], 8363 // bottomPoint = topPoint + this.anchorHeight || this.points[1], 8364 winHeight = window.innerHeight; 8365 8366 if (this.options.stickTo === 'top') { 8367 topPoint -= mTop; 8368 bottomPoint -= elemHeight + mTop; 8369 } else if (this.options.stickTo === 'bottom') { 8370 topPoint -= winHeight - (elemHeight + mBtm); 8371 bottomPoint -= winHeight - mBtm; 8372 } else { 8373 //this would be the stickTo: both option... tricky 8374 } 8375 8376 this.topPoint = topPoint; 8377 this.bottomPoint = bottomPoint; 8378 8379 if (cb) { 8380 cb(); 8381 } 8382 } 8383 8384 /** 8385 * Destroys the current sticky element. 8386 * Resets the element to the top position first. 8387 * Removes event listeners, JS-added css properties and classes, and unwraps the $element if the JS added the $container. 8388 * @function 8389 */ 8390 8391 }, { 8392 key: 'destroy', 8393 value: function destroy() { 8394 this._removeSticky(true); 8395 8396 this.$element.removeClass(this.options.stickyClass + ' is-anchored is-at-top').css({ 8397 height: '', 8398 top: '', 8399 bottom: '', 8400 'max-width': '' 8401 }).off('resizeme.zf.trigger'); 8402 8403 this.$anchor.off('change.zf.sticky'); 8404 $(window).off(this.scrollListener); 8405 8406 if (this.wasWrapped) { 8407 this.$element.unwrap(); 8408 } else { 8409 this.$container.removeClass(this.options.containerClass).css({ 8410 height: '' 8411 }); 8412 } 8413 Foundation.unregisterPlugin(this); 8414 } 8415 }]); 8416 8417 return Sticky; 8418 }(); 8419 8420 Sticky.defaults = { 8421 /** 8422 * Customizable container template. Add your own classes for styling and sizing. 8423 * @option 8424 * @example '<div data-sticky-container class="small-6 columns"></div>' 8425 */ 8426 container: '<div data-sticky-container></div>', 8427 /** 8428 * Location in the view the element sticks to. 8429 * @option 8430 * @example 'top' 8431 */ 8432 stickTo: 'top', 8433 /** 8434 * If anchored to a single element, the id of that element. 8435 * @option 8436 * @example 'exampleId' 8437 */ 8438 anchor: '', 8439 /** 8440 * If using more than one element as anchor points, the id of the top anchor. 8441 * @option 8442 * @example 'exampleId:top' 8443 */ 8444 topAnchor: '', 8445 /** 8446 * If using more than one element as anchor points, the id of the bottom anchor. 8447 * @option 8448 * @example 'exampleId:bottom' 8449 */ 8450 btmAnchor: '', 8451 /** 8452 * Margin, in `em`'s to apply to the top of the element when it becomes sticky. 8453 * @option 8454 * @example 1 8455 */ 8456 marginTop: 1, 8457 /** 8458 * Margin, in `em`'s to apply to the bottom of the element when it becomes sticky. 8459 * @option 8460 * @example 1 8461 */ 8462 marginBottom: 1, 8463 /** 8464 * Breakpoint string that is the minimum screen size an element should become sticky. 8465 * @option 8466 * @example 'medium' 8467 */ 8468 stickyOn: 'medium', 8469 /** 8470 * Class applied to sticky element, and removed on destruction. Foundation defaults to `sticky`. 8471 * @option 8472 * @example 'sticky' 8473 */ 8474 stickyClass: 'sticky', 8475 /** 8476 * Class applied to sticky container. Foundation defaults to `sticky-container`. 8477 * @option 8478 * @example 'sticky-container' 8479 */ 8480 containerClass: 'sticky-container', 8481 /** 8482 * Number of scroll events between the plugin's recalculating sticky points. Setting it to `0` will cause it to recalc every scroll event, setting it to `-1` will prevent recalc on scroll. 8483 * @option 8484 * @example 50 8485 */ 8486 checkEvery: -1 8487 }; 8488 8489 /** 8490 * Helper function to calculate em values 8491 * @param Number {em} - number of em's to calculate into pixels 8492 */ 8493 function emCalc(em) { 8494 return parseInt(window.getComputedStyle(document.body, null).fontSize, 10) * em; 8495 } 8496 8497 // Window exports 8498 Foundation.plugin(Sticky, 'Sticky'); 8499}(jQuery); 8500'use strict'; 8501 8502var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8503 8504function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8505 8506!function ($) { 8507 8508 /** 8509 * Tabs module. 8510 * @module foundation.tabs 8511 * @requires foundation.util.keyboard 8512 * @requires foundation.util.timerAndImageLoader if tabs contain images 8513 */ 8514 8515 var Tabs = function () { 8516 /** 8517 * Creates a new instance of tabs. 8518 * @class 8519 * @fires Tabs#init 8520 * @param {jQuery} element - jQuery object to make into tabs. 8521 * @param {Object} options - Overrides to the default plugin settings. 8522 */ 8523 8524 function Tabs(element, options) { 8525 _classCallCheck(this, Tabs); 8526 8527 this.$element = element; 8528 this.options = $.extend({}, Tabs.defaults, this.$element.data(), options); 8529 8530 this._init(); 8531 Foundation.registerPlugin(this, 'Tabs'); 8532 Foundation.Keyboard.register('Tabs', { 8533 'ENTER': 'open', 8534 'SPACE': 'open',
8535 'ARROW_RIGHT': 'next', 8536 'ARROW_UP': 'previous', 8537 'ARROW_DOWN': 'next', 8538 'ARROW_LEFT': 'previous' 8539 // 'TAB': 'next', 8540 // 'SHIFT_TAB': 'previous' 8541 }); 8542 } 8543 8544 /** 8545 * Initializes the tabs by showing and focusing (if autoFocus=true) the preset active tab. 8546 * @private 8547 */ 8548 8549 8550 _createClass(Tabs, [{ 8551 key: '_init', 8552 value: function _init() { 8553 var _this = this; 8554 8555 this.$tabTitles = this.$element.find('.' + this.options.linkClass); 8556 this.$tabContent = $('[data-tabs-content="' + this.$element[0].id + '"]'); 8557 8558 this.$tabTitles.each(function () { 8559 var $elem = $(this), 8560 $link = $elem.find('a'), 8561 isActive = $elem.hasClass('is-active'), 8562 hash = $link[0].hash.slice(1), 8563 linkId = $link[0].id ? $link[0].id : hash + '-label', 8564 $tabContent = $('#' + hash); 8565 8566 $elem.attr({ 'role': 'presentation' }); 8567 8568 $link.attr({ 8569 'role': 'tab', 8570 'aria-controls': hash, 8571 'aria-selected': isActive, 8572 'id': linkId 8573 }); 8574 8575 $tabContent.attr({ 8576 'role': 'tabpanel', 8577 'aria-hidden': !isActive, 8578 'aria-labelledby': linkId 8579 }); 8580 8581 if (isActive && _this.options.autoFocus) { 8582 $link.focus(); 8583 } 8584 }); 8585 8586 if (this.options.matchHeight) { 8587 var $images = this.$tabContent.find('img'); 8588 8589 if ($images.length) { 8590 Foundation.onImagesLoaded($images, this._setHeight.bind(this)); 8591 } else { 8592 this._setHeight(); 8593 } 8594 } 8595 8596 this._events(); 8597 } 8598 8599 /** 8600 * Adds event handlers for items within the tabs. 8601 * @private 8602 */ 8603 8604 }, { 8605 key: '_events', 8606 value: function _events() { 8607 this._addKeyHandler(); 8608 this._addClickHandler(); 8609 8610 if (this.options.matchHeight) { 8611 $(window).on('changed.zf.mediaquery', this._setHeight.bind(this)); 8612 } 8613 } 8614 8615 /** 8616 * Adds click handlers for items within the tabs. 8617 * @private 8618 */ 8619 8620 }, { 8621 key: '_addClickHandler', 8622 value: function _addClickHandler() { 8623 var _this = this; 8624 8625 this.$element.off('click.zf.tabs').on('click.zf.tabs', '.' + this.options.linkClass, function (e) { 8626 e.preventDefault(); 8627 e.stopPropagation(); 8628 if ($(this).hasClass('is-active')) { 8629 return; 8630 } 8631 _this._handleTabChange($(this)); 8632 }); 8633 } 8634 8635 /** 8636 * Adds keyboard event handlers for items within the tabs. 8637 * @private 8638 */ 8639 8640 }, { 8641 key: '_addKeyHandler', 8642 value: function _addKeyHandler() { 8643 var _this = this; 8644 var $firstTab = _this.$element.find('li:first-of-type'); 8645 var $lastTab = _this.$element.find('li:last-of-type'); 8646 8647 this.$tabTitles.off('keydown.zf.tabs').on('keydown.zf.tabs', function (e) { 8648 if (e.which === 9) return; 8649 e.stopPropagation(); 8650 e.preventDefault(); 8651 8652 var $element = $(this), 8653 $elements = $element.parent('ul').children('li'), 8654 $prevElement, 8655 $nextElement; 8656 8657 $elements.each(function (i) { 8658 if ($(this).is($element)) { 8659 if (_this.options.wrapOnKeys) { 8660 $prevElement = i === 0 ? $elements.last() : $elements.eq(i - 1); 8661 $nextElement = i === $elements.length - 1 ? $elements.first() : $elements.eq(i + 1); 8662 } else { 8663 $prevElement = $elements.eq(Math.max(0, i - 1)); 8664 $nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1)); 8665 } 8666 return; 8667 } 8668 }); 8669 8670 // handle keyboard event with keyboard util 8671 Foundation.Keyboard.handleKey(e, 'Tabs', { 8672 open: function () { 8673 $element.find('[role="tab"]').focus(); 8674 _this._handleTabChange($element); 8675 }, 8676 previous: function () { 8677 $prevElement.find('[role="tab"]').focus(); 8678 _this._handleTabChange($prevElement); 8679 }, 8680 next: function () { 8681 $nextElement.find('[role="tab"]').focus(); 8682 _this._handleTabChange($nextElement); 8683 } 8684 }); 8685 }); 8686 } 8687 8688 /** 8689 * Opens the tab `$targetContent` defined by `$target`. 8690 * @param {jQuery} $target - Tab to open. 8691 * @fires Tabs#change 8692 * @function 8693 */ 8694 8695 }, {
8696 key: '_handleTabChange', 8697 value: function _handleTabChange($target) { 8698 var $tabLink = $target.find('[role="tab"]'), 8699 hash = $tabLink[0].hash, 8700 $targetContent = this.$tabContent.find(hash), 8701 $oldTab = this.$element.find('.' + this.options.linkClass + '.is-active').removeClass('is-active').find('[role="tab"]').attr({ 'aria-selected': 'false' }); 8702 8703 $('#' + $oldTab.attr('aria-controls')).removeClass('is-active').attr({ 'aria-hidden': 'true' }); 8704 8705 $target.addClass('is-active'); 8706 8707 $tabLink.attr({ 'aria-selected': 'true' }); 8708 8709 $targetContent.addClass('is-active').attr({ 'aria-hidden': 'false' }); 8710 8711 /** 8712 * Fires when the plugin has successfully changed tabs. 8713 * @event Tabs#change 8714 */ 8715 this.$element.trigger('change.zf.tabs', [$target]); 8716 } 8717 8718 /** 8719 * Public method for selecting a content pane to display. 8720 * @param {jQuery | String} elem - jQuery object or string of the id of the pane to display. 8721 * @function 8722 */ 8723 8724 }, { 8725 key: 'selectTab', 8726 value: function selectTab(elem) { 8727 var idStr; 8728 8729 if (typeof elem === 'object') { 8730 idStr = elem[0].id; 8731 } else { 8732 idStr = elem; 8733 } 8734 8735 if (idStr.indexOf('#') < 0) { 8736 idStr = '#' + idStr; 8737 } 8738 8739 var $target = this.$tabTitles.find('[href="' + idStr + '"]').parent('.' + this.options.linkClass); 8740 8741 this._handleTabChange($target); 8742 } 8743 }, { 8744 key: '_setHeight', 8745 8746 /** 8747 * Sets the height of each panel to the height of the tallest panel. 8748 * If enabled in options, gets called on media query change. 8749 * If loading content via external source, can be called directly or with _reflow. 8750 * @function 8751 * @private 8752 */ 8753 value: function _setHeight() { 8754 var max = 0; 8755 this.$tabContent.find('.' + this.options.panelClass).css('height', '').each(function () { 8756 var panel = $(this), 8757 isActive = panel.hasClass('is-active'); 8758 8759 if (!isActive) { 8760 panel.css({ 'visibility': 'hidden', 'display': 'block' }); 8761 } 8762 8763 var temp = this.getBoundingClientRect().height; 8764 8765 if (!isActive) { 8766 panel.css({ 8767 'visibility': '', 8768 'display': '' 8769 }); 8770 } 8771 8772 max = temp > max ? temp : max; 8773 }).css('height', max + 'px'); 8774 } 8775 8776 /** 8777 * Destroys an instance of an tabs. 8778 * @fires Tabs#destroyed 8779 */ 8780 8781 }, { 8782 key: 'destroy', 8783 value: function destroy() { 8784 this.$element.find('.' + this.options.linkClass).off('.zf.tabs').hide().end().find('.' + this.options.panelClass).hide(); 8785 8786 if (this.options.matchHeight) { 8787 $(window).off('changed.zf.mediaquery'); 8788 } 8789 8790 Foundation.unregisterPlugin(this); 8791 } 8792 }]); 8793 8794 return Tabs; 8795 }(); 8796 8797 Tabs.defaults = { 8798 /** 8799 * Allows the window to scroll to content of active pane on load if set to true. 8800 * @option 8801 * @example false 8802 */ 8803 autoFocus: false, 8804 8805 /** 8806 * Allows keyboard input to 'wrap' around the tab links. 8807 * @option 8808 * @example true 8809 */ 8810 wrapOnKeys: true, 8811 8812 /** 8813 * Allows the tab content panes to match heights if set to true. 8814 * @option 8815 * @example false 8816 */ 8817 matchHeight: false, 8818 8819 /** 8820 * Class applied to `li`'s in tab link list. 8821 * @option 8822 * @example 'tabs-title' 8823 */ 8824 linkClass: 'tabs-title', 8825 8826 /** 8827 * Class applied to the content containers. 8828 * @option 8829 * @example 'tabs-panel' 8830 */ 8831 panelClass: 'tabs-panel' 8832 }; 8833 8834 function checkClass($elem) { 8835 return $elem.hasClass('is-active'); 8836 } 8837 8838 // Window exports 8839 Foundation.plugin(Tabs, 'Tabs'); 8840}(jQuery); 8841'use strict'; 8842 8843var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8844 8845function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8846 8847!function ($) { 8848 8849 /** 8850 * Toggler module. 8851 * @module foundation.toggler 8852 * @requires foundation.util.motion 8853 * @requires foundation.util.triggers 8854 */ 8855 8856 var Toggler = function () { 8857 /** 8858 * Creates a new instance of Toggler. 8859 * @class 8860 * @fires Toggler#init 8861 * @param {Object} element - jQuery object to add the trigger to. 8862 * @param {Object} options - Overrides to the default plugin settings. 8863 */ 8864 8865 function Toggler(element, options) { 8866 _classCallCheck(this, Toggler); 8867 8868 this.$element = element; 8869 this.options = $.extend({}, Toggler.defaults, element.data(), options); 8870 this.className = ''; 8871 8872 this._init(); 8873 this._events(); 8874 8875 Foundation.registerPlugin(this, 'Toggler'); 8876 } 8877 8878 /** 8879 * Initializes the Toggler plugin by parsing the toggle class from data-toggler, or animation classes from data-animate. 8880 * @function 8881 * @private 8882 */ 8883 8884 8885 _createClass(Toggler, [{ 8886 key: '_init', 8887 value: function _init() { 8888 var input; 8889 // Parse animation classes if they were set 8890 if (this.options.animate) { 8891 input = this.options.animate.split(' '); 8892 8893 this.animationIn = input[0]; 8894 this.animationOut = input[1] || null; 8895 } 8896 // Otherwise, parse toggle class 8897 else { 8898 input = this.$element.data('toggler'); 8899 // Allow for a . at the beginning of the string 8900 this.className = input[0] === '.' ? input.slice(1) : input; 8901 } 8902 8903 // Add ARIA attributes to triggers 8904 var id = this.$element[0].id; 8905 $('[data-open="' + id + '"], [data-close="' + id + '"], [data-toggle="' + id + '"]').attr('aria-controls', id); 8906 // If the target is hidden, add aria-hidden 8907 this.$element.attr('aria-expanded', this.$element.is(':hidden') ? false : true); 8908 } 8909 8910 /** 8911 * Initializes events for the toggle trigger. 8912 * @function 8913 * @private 8914 */ 8915 8916 }, {
8917 key: '_events', 8918 value: function _events() { 8919 this.$element.off('toggle.zf.trigger').on('toggle.zf.trigger', this.toggle.bind(this)); 8920 } 8921 8922 /** 8923 * Toggles the target class on the target element. An event is fired from the original trigger depending on if the resultant state was "on" or "off". 8924 * @function 8925 * @fires Toggler#on 8926 * @fires Toggler#off 8927 */ 8928 8929 }, { 8930 key: 'toggle', 8931 value: function toggle() { 8932 this[this.options.animate ? '_toggleAnimate' : '_toggleClass'](); 8933 } 8934 }, { 8935 key: '_toggleClass', 8936 value: function _toggleClass() { 8937 this.$element.toggleClass(this.className); 8938 8939 var isOn = this.$element.hasClass(this.className); 8940 if (isOn) { 8941 /** 8942 * Fires if the target element has the class after a toggle. 8943 * @event Toggler#on 8944 */ 8945 this.$element.trigger('on.zf.toggler'); 8946 } else { 8947 /** 8948 * Fires if the target element does not have the class after a toggle. 8949 * @event Toggler#off 8950 */ 8951 this.$element.trigger('off.zf.toggler'); 8952 } 8953 8954 this._updateARIA(isOn); 8955 } 8956 }, { 8957 key: '_toggleAnimate', 8958 value: function _toggleAnimate() { 8959 var _this = this; 8960 8961 if (this.$element.is(':hidden')) { 8962 Foundation.Motion.animateIn(this.$element, this.animationIn, function () { 8963 this.trigger('on.zf.toggler'); 8964 _this._updateARIA(true); 8965 }); 8966 } else { 8967 Foundation.Motion.animateOut(this.$element, this.animationOut, function () { 8968 this.trigger('off.zf.toggler'); 8969 _this._updateARIA(false); 8970 }); 8971 } 8972 } 8973 }, { 8974 key: '_updateARIA', 8975 value: function _updateARIA(isOn) { 8976 this.$element.attr('aria-expanded', isOn ? true : false); 8977 } 8978 8979 /** 8980 * Destroys the instance of Toggler on the element. 8981 * @function 8982 */ 8983 8984 }, { 8985 key: 'destroy', 8986 value: function destroy() { 8987 this.$element.off('.zf.toggler'); 8988 Foundation.unregisterPlugin(this); 8989 } 8990 }]); 8991 8992 return Toggler; 8993 }(); 8994 8995 Toggler.defaults = { 8996 /** 8997 * Tells the plugin if the element should animated when toggled. 8998 * @option 8999 * @example false 9000 */ 9001 animate: false 9002 }; 9003 9004 // Window exports 9005 Foundation.plugin(Toggler, 'Toggler'); 9006}(jQuery); 9007'use strict'; 9008 9009var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 9010 9011function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9012 9013!function ($) { 9014 9015 /** 9016 * Tooltip module. 9017 * @module foundation.tooltip 9018 * @requires foundation.util.box 9019 * @requires foundation.util.triggers 9020 */ 9021 9022 var Tooltip = function () { 9023 /** 9024 * Creates a new instance of a Tooltip. 9025 * @class 9026 * @fires Tooltip#init 9027 * @param {jQuery} element - jQuery object to attach a tooltip to. 9028 * @param {Object} options - object to extend the default configuration. 9029 */ 9030 9031 function Tooltip(element, options) { 9032 _classCallCheck(this, Tooltip); 9033 9034 this.$element = element; 9035 this.options = $.extend({}, Tooltip.defaults, this.$element.data(), options); 9036 9037 this.isActive = false; 9038 this.isClick = false; 9039 this._init(); 9040 9041 Foundation.registerPlugin(this, 'Tooltip'); 9042 } 9043 9044 /** 9045 * Initializes the tooltip by setting the creating the tip element, adding it's text, setting private variables and setting attributes on the anch
9045or. 9046 * @private 9047 */ 9048 9049 9050 _createClass(Tooltip, [{ 9051 key: '_init', 9052 value: function _init() { 9053 var elemId = this.$element.attr('aria-describedby') || Foundation.GetYoDigits(6, 'tooltip'); 9054 9055 this.options.positionClass = this._getPositionClass(this.$element); 9056 this.options.tipText = this.options.tipText || this.$element.attr('title'); 9057 this.template = this.options.template ? $(this.options.template) : this._buildTemplate(elemId); 9058 9059 this.template.appendTo(document.body).text(this.options.tipText).hide(); 9060 9061 this.$element.attr({ 9062 'title': '', 9063 'aria-describedby': elemId, 9064 'data-yeti-box': elemId, 9065 'data-toggle': elemId, 9066 'data-resize': elemId 9067 }).addClass(this.triggerClass); 9068 9069 //helper variables to track movement on collisions 9070 this.usedPositions = []; 9071 this.counter = 4; 9072 this.classChanged = false; 9073 9074 this._events(); 9075 } 9076 9077 /** 9078 * Grabs the current positioning class, if present, and returns the value or an empty string. 9079 * @private 9080 */ 9081 9082 }, { 9083 key: '_getPositionClass', 9084 value: function _getPositionClass(element) { 9085 if (!element) { 9086 return ''; 9087 } 9088 // var position = element.attr('class').match(/top|left|right/g); 9089 var position = element[0].className.match(/\b(top|left|right)\b/g); 9090 position = position ? position[0] : ''; 9091 return position; 9092 } 9093 }, { 9094 key: '_buildTemplate', 9095 9096 /** 9097 * builds the tooltip element, adds attributes, and returns the template. 9098 * @private 9099 */ 9100 value: function _buildTemplate(id) { 9101 var templateClasses = (this.options.tooltipClass + ' ' + this.options.positionClass + ' ' + this.options.templateClasses).trim(); 9102 var $template = $('<div></div>').addClass(templateClasses).attr({ 9103 'role': 'tooltip', 9104 'aria-hidden': true, 9105 'data-is-active': false, 9106 'data-is-focus': false, 9107 'id': id 9108 }); 9109 return $template; 9110 } 9111 9112 /** 9113 * Function that gets called if a collision event is detected. 9114 * @param {String} position - positioning class to try 9115 * @private 9116 */ 9117 9118 }, { 9119 key: '_reposition', 9120 value: function _reposition(position) { 9121 this.usedPositions.push(position ? position : 'bottom'); 9122 9123 //default, try switching to opposite side 9124 if (!position && this.usedPositions.indexOf('top') < 0) { 9125 this.template.addClass('top'); 9126 } else if (position === 'top' && this.usedPositions.indexOf('bottom') < 0) { 9127 this.template.removeClass(position); 9128 } else if (position === 'left' && this.usedPositions.indexOf('right') < 0) { 9129 this.template.removeClass(position).addClass('right'); 9130 } else if (position === 'right' && this.usedPositions.indexOf('left') < 0) { 9131 this.template.removeClass(position).addClass('left'); 9132 } 9133 9134 //if default change didn't work, try bottom or left first 9135 else if (!position && this.usedPositions.indexOf('top') > -1 && this.usedPositions.indexOf('left') < 0) { 9136 this.template.addClass('left'); 9137 } else if (position === 'top' && this.usedPositions.indexOf('bottom') > -1 && this.usedPositions.indexOf('left') < 0) { 9138 this.template.removeClass(position).addClass('left'); 9139 } else if (position === 'left' && this.usedPositions.indexOf('right') > -1 && this.usedPositions.indexOf('bottom') < 0) { 9140 this.template.removeClass(position); 9141 } else if (position === 'right' && this.usedPositions.indexOf('left') > -1 && this.usedPositions.indexOf('bottom') < 0) { 9142 this.template.removeClass(position); 9143 } 9144 //if nothing cleared, set to bottom 9145 else { 9146 this.template.removeClass(position); 9147 } 9148 this.classChanged = true; 9149 this.counter--; 9150 } 9151 9152 /** 9153 * sets the position class of an element and recursively calls itself until there are no more possible positions to attempt, or the tooltip element is no longer colliding. 9154 * if the tooltip is larger than the screen width, default to full width - any user selected margin 9155 * @private 9156 */ 9157 9158 }, {
9159 key: '_setPosition', 9160 value: function _setPosition() { 9161 var position = this._getPositionClass(this.template), 9162 $tipDims = Foundation.Box.GetDimensions(this.template), 9163 $anchorDims = Foundation.Box.GetDimensions(this.$element), 9164 direction = position === 'left' ? 'left' : position === 'right' ? 'left' : 'top', 9165 param = direction === 'top' ? 'height' : 'width', 9166 offset = param === 'height' ? this.options.vOffset : this.options.hOffset, 9167 _this = this; 9168 9169 if ($tipDims.width >= $tipDims.windowDims.width || !this.counter && !Foundation.Box.ImNotTouchingYou(this.template)) { 9170 this.template.offset(Foundation.Box.GetOffsets(this.template, this.$element, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({ 9171 // this.$element.offset(Foundation.GetOffsets(this.template, this.$element, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({ 9172 'width': $anchorDims.windowDims.width - this.options.hOffset * 2, 9173 'height': 'auto' 9174 }); 9175 return false; 9176 } 9177 9178 this.template.offset(Foundation.Box.GetOffsets(this.template, this.$element, 'center ' + (position || 'bottom'), this.options.vOffset, this.options.hOffset)); 9179 9180 while (!Foundation.Box.ImNotTouchingYou(this.template) && this.counter) { 9181 this._reposition(position); 9182 this._setPosition(); 9183 } 9184 } 9185 9186 /** 9187 * reveals the tooltip, and fires an event to close any other open tooltips on the page 9188 * @fires Tooltip#closeme 9189 * @fires Tooltip#show 9190 * @function 9191 */ 9192 9193 }, { 9194 key: 'show', 9195 value: function show() { 9196 if (this.options.showOn !== 'all' && !Foundation.MediaQuery.atLeast(this.options.showOn)) { 9197 // console.error('The screen is too small to display this tooltip'); 9198 return false; 9199 } 9200 9201 var _this = this; 9202 this.template.css('visibility', 'hidden').show(); 9203 this._setPosition(); 9204 9205 /** 9206 * Fires to close all other open tooltips on the page 9207 * @event Closeme#tooltip 9208 */ 9209 this.$element.trigger('closeme.zf.tooltip', this.template.attr('id')); 9210 9211 this.template.attr({ 9212 'data-is-active': true, 9213 'aria-hidden': false 9214 }); 9215 _this.isActive = true; 9216 // console.log(this.template); 9217 this.template.stop().hide().css('visibility', '').fadeIn(this.options.fadeInDuration, function () { 9218 //maybe do stuff? 9219 }); 9220 /** 9221 * Fires when the tooltip is shown 9222 * @event Tooltip#show 9223 */ 9224 this.$element.trigger('show.zf.tooltip'); 9225 } 9226 9227 /** 9228 * Hides the current tooltip, and resets the positioning class if it was changed due to collision 9229 * @fires Tooltip#hide 9230 * @function 9231 */ 9232 9233 }, { 9234 key: 'hide', 9235 value: function hide() { 9236 // console.log('hiding', this.$element.data('yeti-box')); 9237 var _this = this; 9238 this.template.stop().attr({ 9239 'aria-hidden': true, 9240 'data-is-active': false 9241 }).fadeOut(this.options.fadeOutDuration, function () { 9242 _this.isActive = false; 9243 _this.isClick = false; 9244 if (_this.classChanged) { 9245 _this.template.removeClass(_this._getPositionClass(_this.template)).addClass(_this.options.positionClass); 9246 9247 _this.usedPositions = []; 9248 _this.counter = 4; 9249 _this.classChanged = false; 9250 } 9251 }); 9252 /** 9253 * fires when the tooltip is hidden 9254 * @event Tooltip#hide 9255 */ 9256 this.$element.trigger('hide.zf.tooltip'); 9257 } 9258 9259 /** 9260 * adds event listeners for the tooltip and its anchor
9261 * TODO combine some of the listeners like focus and mouseenter, etc. 9262 * @private 9263 */ 9264 9265 }, { 9266 key: '_events', 9267 value: function _events() { 9268 var _this = this; 9269 var $template = this.template; 9270 var isFocus = false; 9271 9272 if (!this.options.disableHover) { 9273 9274 this.$element.on('mouseenter.zf.tooltip', function (e) { 9275 if (!_this.isActive) { 9276 _this.timeout = setTimeout(function () { 9277 _this.show(); 9278 }, _this.options.hoverDelay); 9279 } 9280 }).on('mouseleave.zf.tooltip', function (e) { 9281 clearTimeout(_this.timeout); 9282 if (!isFocus || !_this.isClick && _this.options.clickOpen) { 9283 _this.hide(); 9284 } 9285 }); 9286 } 9287 9288 if (this.options.clickOpen) { 9289 this.$element.on('mousedown.zf.tooltip', function (e) { 9290 e.stopImmediatePropagation(); 9291 if (_this.isClick) { 9292 _this.hide(); 9293 // _this.isClick = false; 9294 } else { 9295 _this.isClick = true; 9296 if ((_this.options.disableHover || !_this.$element.attr('tabindex')) && !_this.isActive) { 9297 _this.show(); 9298 } 9299 } 9300 }); 9301 } 9302 9303 if (!this.options.disableForTouch) { 9304 this.$element.on('tap.zf.tooltip touchend.zf.tooltip', function (e) { 9305 _this.isActive ? _this.hide() : _this.show(); 9306 }); 9307 } 9308 9309 this.$element.on({ 9310 // 'toggle.zf.trigger': this.toggle.bind(this), 9311 // 'close.zf.trigger': this.hide.bind(this) 9312 'close.zf.trigger': this.hide.bind(this) 9313 }); 9314 9315 this.$element.on('focus.zf.tooltip', function (e) { 9316 isFocus = true; 9317 // console.log(_this.isClick); 9318 if (_this.isClick) { 9319 return false; 9320 } else { 9321 // $(window) 9322 _this.show(); 9323 } 9324 }).on('focusout.zf.tooltip', function (e) { 9325 isFocus = false; 9326 _this.isClick = false; 9327 _this.hide(); 9328 }).on('resizeme.zf.trigger', function () { 9329 if (_this.isActive) { 9330 _this._setPosition(); 9331 } 9332 }); 9333 } 9334 9335 /** 9336 * adds a toggle method, in addition to the static show() & hide() functions 9337 * @function 9338 */ 9339 9340 }, { 9341 key: 'toggle', 9342 value: function toggle() { 9343 if (this.isActive) { 9344 this.hide(); 9345 } else { 9346 this.show(); 9347 } 9348 } 9349 9350 /** 9351 * Destroys an instance of tooltip, removes template element from the view. 9352 * @function 9353 */ 9354 9355 }, { 9356 key: 'destroy', 9357 value: function destroy() { 9358 this.$element.attr('title', this.template.text()).off('.zf.trigger .zf.tootip') 9359 // .removeClass('has-tip') 9360 .removeAttr('aria-describedby').removeAttr('data-yeti-box').removeAttr('data-toggle').removeAttr('data-resize'); 9361 9362 this.template.remove(); 9363 9364 Foundation.unregisterPlugin(this); 9365 } 9366 }]); 9367 9368 return Tooltip; 9369 }(); 9370 9371 Tooltip.defaults = { 9372 disableForTouch: false, 9373 /** 9374 * Time, in ms, before a tooltip should open on hover. 9375 * @option 9376 * @example 200 9377 */ 9378 hoverDelay: 200, 9379 /** 9380 * Time, in ms, a tooltip should take to fade into view. 9381 * @option 9382 * @example 150 9383 */ 9384 fadeInDuration: 150, 9385 /** 9386 * Time, in ms, a tooltip should take to fade out of view. 9387 * @option 9388 * @example 150 9389 */ 9390 fadeOutDuration: 150, 9391 /** 9392 * Disables hover events from opening the tooltip if set to true 9393 * @option 9394 * @example false 9395 */ 9396 disableHover: false, 9397 /** 9398 * Optional addtional classes to apply to the tooltip template on init. 9399 * @option 9400 * @example 'my-cool-tip-class' 9401 */ 9402 templateClasses: '', 9403 /** 9404 * Non-optional class added to tooltip templates. Foundation default is 'tooltip'. 9405 * @option 9406 * @example 'tooltip' 9407 */ 9408 tooltipClass: 'tooltip', 9409 /** 9410 * Class applied to the tooltip anchor element. 9411 * @option 9412 * @example 'has-tip' 9413 */ 9414 triggerClass: 'has-tip', 9415 /** 9416 * Minimum breakpoint size at which to open the tooltip. 9417 * @option 9418 * @example 'small' 9419 */ 9420 showOn: 'small', 9421 /** 9422 * Custom template to be used to generate markup for tooltip. 9423 * @option 9424 * @example '<div class="tooltip"></div>' 9425 */ 9426 template: '', 9427 /** 9428 * Text displayed in the tooltip template on open. 9429 * @option 9430 * @example 'Some cool space fact here.' 9431 */ 9432 tipText: '', 9433 touchCloseText: 'Presionar para cerrar.', 9434 /** 9435 * Allows the tooltip to remain open if triggered with a click or touch event. 9436 * @option 9437 * @example true 9438 */ 9439 clickOpen: true, 9440 /** 9441 * Additional positioning classes, set by the JS 9442 * @option 9443 * @example 'top' 9444 */ 9445 positionClass: '', 9446 /** 9447 * Distance, in pixels, the template should push away from the anch
9447or on the Y axis. 9448 * @option 9449 * @example 10 9450 */ 9451 vOffset: 10, 9452 /** 9453 * Distance, in pixels, the template should push away from the anchor on the X axis, if aligned to a side. 9454 * @option 9455 * @example 12 9456 */ 9457 hOffset: 12 9458 }; 9459 9460 /** 9461 * TODO utilize resize event trigger 9462 */ 9463 9464 // Window exports 9465 Foundation.plugin(Tooltip, 'Tooltip'); 9466}(jQuery);; 9467!function(n,e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):n.MotionUI=e(n.jQuery)}(this,function(n){"use strict";function e(e,a,r,u){function s(){e||a.hide(),m(),u&&u.apply(a)}function m(){a[0].style.transitionDuration=0,a.removeClass(d+" "+c+" "+r)}if(a=n(a).eq(0),a.length){if(null===o)return e?a.show():a.hide(),void u();var d=e?i[0]:i[1],c=e?t[0]:t[1];m(),a.addClass(r),a.css("transition","none"),requestAnimationFrame(function(){a.addClass(d),e&&a.show()}),requestAnimationFrame(function(){a[0].offsetWidth,a.css("transition",""),a.addClass(c)}),a.one("transitionend",s)}}!function(){Date.now||(Date.now=function(){return(new Date).getTime()});for(var n=["webkit","moz"],e=0;e<n.length&&!window.requestAnimationFrame;++e){var i=n[e];window.requestAnimationFrame=window[i+"RequestAnimationFrame"],window.cancelAnimationFrame=window[i+"CancelAnimationFrame"]||window[i+"CancelRequestAnimationFrame"]}if(/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent)||!window.requestAnimationFrame||!window.cancelAnimationFrame){var t=0;window.requestAnimationFrame=function(n){var e=Date.now(),i=Math.max(t+16,e);return setTimeout(function(){n(t=i)},i-e)},window.cancelAnimationFrame=clearTimeout}}();var i=["mui-enter","mui-leave"],t=["mui-enter-active","mui-leave-active"],o=function(){var n={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend"},e=window.document.createElement("div");for(var i in n)if("undefined"!=typeof e.style[i])return n[i];return null}(),a={animateIn:function(n,i,t){e(!0,n,i,t)},animateOut:function(n,i,t){e(!1,n,i,t)}};return a});; 9468(function ($, window) { 9469 'use strict' 9470 // Utility function. Causes the callback to only fire after a delay. If the 9471 // callback is called before the delay it waits. Useful for rapidly firing callbacks 9472 // like window.resize 9473 // ------------------------------------------------------------------- 9474 9475 var waterCore = {} 9476 9477 waterCore.waitForIdle = function (fn, delay) { 9478 var timer = null 9479 return function () { 9480 var context = this, 9481 args = arguments 9482 clearTimeout(timer) 9483 timer = setTimeout(function () { 9484 fn.apply(context, args) 9485 }, delay) 9486 } 9487 } 9488 9489 // Get the viewport width & height right away and use through out document. 9490 // ------------------------------------------------------------------- 9491 waterCore.viewportWidth = $(window).width() 9492 waterCore.viewportHeight = $(window).height() 9493 $(window).resize(waterCore.waitForIdle(function () { 9494 waterCore.viewportWidth = $(window).width() 9495 waterCore.viewportHeight = $(window).height() 9496 }, 200)) 9497 9498 window.waterCore = waterCore 9499// end viewport resizing 9500})(window.jQuery, window) 9501; 9502/** 9503 * @file 9504 * Placeholder file for custom sub-theme behaviors. 9505 * 9506 */ 9507(function ($, Drupal, window, document, waterCore) { 9508 'use strict' 9509 var userInfoObj; 9510 /** 9511 * ! Header Section 9512 * ------------------------------------------------------------------- 9513 */ 9514 9515 /** 9516 * ! - Search field place holder attribute. 9517 * location: header 9518 */ 9519 Drupal.behaviors.searchPlaceHolder = { 9520 attach: function (context, settings) { 9521 var searchFormInput = 'header section.search-block-form input.form-search' 9522 $(searchFormInput, context).once('search-place-holder').attr('placeholder', 'buscar') 9523 } 9524 } 9525 9526 /** 9527 * ! - Menu click funtion. 9528 * Open menus on click instead of roll-over. 9529 */ 9530 Drupal.behaviors.menuClickOpen = { 9531 attach: function (context, settings) { 9532 var mainMenuList = 'nav#block-ge-water-main-menu ul.dropdown.menu > li' 9533 var secondaryMenuList = 'nav#ge-secondary-navigation-block ul.dropdown.menu > li' 9534 var ssoAdminMenuList = 'nav#ge-sso-admin-block ul.dropdown.menu > li' 9535 var menuListCombined = mainMenuList + ', ' + secondaryMenuList + ', ' + ssoAdminMenuList 9536 9537 // Have to unbind click first because of Drupal contextual menu JS. 9538 // 5th Sep, 2018 -- Removed code $(mainMenuList + ' > a ,' + secondaryMenuList + ' > a ,' + ssoAdminMenuList + ' > a', context).once('menu-click-open').on('click', function () { 9539 $(secondaryMenuList + ' > a ,' + ssoAdminMenuList + ' > a', context).once('menu-click-open').on('click', function () { 9540 if ($(this).siblings('ul.menu').length) { 9541 if ($(this).parent('li').hasClass('open-submenu')) { 9542 $(this, context).parent('li').removeClass('open-submenu') 9543 } else {
9544 $(menuListCombined, context).removeClass('open-submenu') 9545 $(this, context).parent('li').addClass('open-submenu') 9546 } 9547 9548 return false 9549 } 9550 }) 9551 9552 // Code for drop-down of submenu items and add arrow 9553 $('nav#block-ge-water-main-menu ul.dropdown.menu > li > a').addClass('menuitemfirst'); 9554 $(mainMenuList).each(function () { 9555 if ($(this).children('ul.menu').length) { 9556 var arrowBtn = $(' <span class="isarrow fa fa-angle-down"></span>'); 9557 $($(this).children('a').get(0)).once().after(arrowBtn); 9558 /*** Commented for CRO 7 hover mainmenu open 9559 arrowBtn.click(function () { 9560 if ($(this).parent('li').hasClass('open-submenu')) { 9561 $(this, context).parent('li').removeClass('open-submenu'); 9562 } else { 9563 $(menuListCombined, context).removeClass('open-submenu'); 9564 $(this, context).parent('li').addClass('open-submenu'); 9565 } 9566 return false 9567 }); 9568 ***/ 9569 } 9570 }); 9571 9572 //CRO 7 hover mainmenu open. 9573 $(mainMenuList).hover(function (e) { 9574 if ($(this).hasClass('open-submenu')) { 9575 $(this, context).removeClass('open-submenu'); 9576 } else { 9577 $(menuListCombined, context).removeClass('open-submenu'); 9578 $(this, context).addClass('open-submenu'); 9579 } 9580 e.preventDefault(); 9581 return false; 9582 }); 9583 9584 /*** Commented for CRO 7 hover mainmenu open 9585 //Drop down functionality of submenu for tool menu. 9586 $(mainMenuList + ' .tool-menu').click(function (e) { 9587 if ($(this).parent('li').hasClass('open-submenu')) { 9588 $(this, context).parent('li').removeClass('open-submenu'); 9589 } else { 9590 $(menuListCombined, context).removeClass('open-submenu'); 9591 $(this, context).parent('li').addClass('open-submenu'); 9592 } 9593 e.preventDefault(); 9594 return false; 9595 }); 9596 ****/ 9597 9598 // Hide breadcrumd second block if there is no content in mobile. 9599 if ($('ul.breadBtn').find('li a').length === 0) { 9600 $('ul.breadBtn').hide(); 9601 // $('#block-ge-water-breadcrumbs .breadcrumb').css('margin-top', 15+"px"); 9602 $('#block-ge-water-breadcrumbs').css('width', 100+'%'); 9603 } 9604 //line-height of navigation set 9605 // var breadCrumbsheight = $('#block-ge-water-breadcrumbs').height(); 9606 // 9607 9608 /*** Commented for CRO 7 hover mainmenu open 9609 // Close drop-down on outside click 9610 $(document).once('document-click').click(function (e) { 9611 if (($(menuListCombined).hasClass('open-submenu')) && ($(e.target).closest(menuListCombined).length === 0)) { 9612 $(menuListCombined, context).removeClass('open-submenu') 9613 } 9614 }) 9615 ***/ 9616 } 9617 } 9618 9619 /** 9620 * ! - Menu mobile. 9621 */ 9622 Drupal.behaviors.mobileMenu = { 9623 attach: function (context, settings) { 9624 $('.mobile-icon', context).once('mobile-menu').click(function () { 9625 if ($('.mobile-icon').hasClass('mobile-menu-open')) { 9626 $('body, .mobile-icon', context).removeClass('mobile-menu-open') 9627 } else { 9628 $('body, .mobile-icon', context).addClass('mobile-menu-open') 9629 } 9630 }) 9631 9632 // Clone social icons to mobile menu. 9633 $('section#block-connectwithus-2 ul.social-media-list', context).once('clone-social-icons').clone().appendTo('#ge-secondary-navigation-block') 9634 } 9635 } 9636 9637 /** 9638 * ! - Apply class if text is "eStore". 9639 */ 9640 Drupal.behaviors.eStoreLabel = { 9641 attach: function (context, settings) { 9642 $('header nav#block-ge-water-main-menu ul.dropdown.menu', context).once('estore-label').find('li:contains("eStore")').addClass('estore') 9643 } 9644 } 9645 9646 /** 9647 * ! Content Section 9648 * ------------------------------------------------------------------- 9649 */ 9650 9651 /** 9652 * ! - foundation grid class names. 9653 */ 9654 Drupal.behaviors.columnPushPull = { 9655 attach: function (context, settings) { 9656 // Media cluster 9657 var mediaClusterOdd = 'body.node--type-emerging-trends .field-name-field-et-featured-media .field-item:nth-child(odd)' 9658 $(mediaClusterOdd, context).once('media-push').find('.medium-6:nth-child(1)').addClass('medium-push-6') 9659 $(mediaClusterOdd, context).once('media-pull').find('.medium-6:nth-child(2)').addClass('medium-pull-6') 9660 // Aboutus history 9661 var timelineEven = '.block-views-block-history-time-line-block-1 .views-row:nth-child(even)' 9662 $(timelineEven, context).once('timeline-push').find('.medium-3').addClass('medium-push-9') 9663 $(timelineEven, context).once('timeline-pull').find('.medium-9').addClass('medium-pull-3') 9664 } 9665 } 9666 9667 /** 9668 * ! - Expand / collapse text. 9669 */ 9670 Drupal.behaviors.expandCollapseText = { 9671 attach: function (context, settings) { 9672 if ($('blockquote.expandable').length) { 9673 $('<p class="expandable collapsed"><a href="#readmore" class="more">Leer más</a><a href="#readless" class="less">Leer menos</a></p>', context).once('add-collapse-text').insertBefore('blockquote.expandable') 9674 9675 $('p.expandable a', context).once('click-collapse-text').click(function () { 9676 if ($(this).parent().hasClass('collapsed')) { 9677 $(this).parent().removeClass('collapsed').addClass('expanded') 9678 $(this).parent().next().addClass('expanded') 9679 } else { 9680 $(this).parent().removeClass('expanded').addClass('collapsed') 9681 $(this).parent().next().removeClass('expanded') 9682 } 9683 9684 return false 9685 }) 9686 } 9687 } 9688 } 9689 9690 /** 9691 * ! - Equal heights for media cluster. 9692 */
9693 Drupal.behaviors.mediaClusterMaxHeight = { 9694 attach: function (context, settings) { 9695 //$(window, context).load(function () { 9696 $(window, context).on("load", function (e) { 9697 var mediaClusterMaxheight = function () { 9698 var mediaClusterItem = [ 9699 '.field-name-field-app-media-cluster .media-cluster-item .media-cluster-inner', 9700 '.field-name-field-et-media-cluster .media-cluster-item .media-cluster-inner', 9701 '.field-name-field-industry-media-cluster .media-cluster-item .media-cluster-inner', 9702 '.field-name-field-product-highlight-media > .field-items > .field-item', 9703 '.field-name-field-lp-media-cluster > .field-items > .field-item' 9704 ] 9705 9706 // Clear out max-height on each resize. 9707 $(mediaClusterItem.join(','), context).css('min-height', '') 9708 9709 // Check is viewport is above 640px. 9710 if (waterCore.viewportWidth >= 640) { 9711 var maxHeight = 0 9712 9713 $(mediaClusterItem.join(','), context).each(function () { 9714 maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height() 9715 }) 9716 9717 $(mediaClusterItem.join(','), context).each(function () { 9718 $(this, context).css('min-height', maxHeight + 'px') 9719 }) 9720 } 9721 } 9722 9723 mediaClusterMaxheight() 9724 $(window).resize(waterCore.waitForIdle(function () { 9725 mediaClusterMaxheight() 9726 }, 200)) 9727 }) 9728 } 9729 } 9730 9731 /** 9732 * ! - Equal heights for homepage. 9733 */ 9734 Drupal.behaviors.homeContent = { 9735 attach: function (context, settings) { 9736 if ($('body.path-frontpage').length) { 9737 $(window, context).load(function () { 9738 var homeEqualHeightBottom = function () { 9739 var divContainers = [ 9740 '.field-name-field-page-content-cluster > .field-items > .field-item:nth-child(2)', 9741 '.field-name-field-page-content-cluster > .field-items > .field-item:nth-child(2) .field-name-field-pagelink-preview-image', 9742 '.field-name-field-page-content-cluster > .field-items > .field-item:nth-child(3)' 9743 ] 9744 9745 // Clear out max-height on each resize. 9746 $(divContainers.join(','), context).css('min-height', '') 9747 9748 // Check is viewport is above 640px. 9749 if (waterCore.viewportWidth >= 780) { 9750 var maxHeight = 0 9751 9752 $(divContainers.join(','), context).each(function () { 9753 maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height() 9754 }) 9755 9756 $(divContainers.join(','), context).each(function () { 9757 $(this, context).css('min-height', maxHeight + 'px') 9758 }) 9759 } 9760 } 9761 9762 homeEqualHeightBottom() 9763 $(window).resize(waterCore.waitForIdle(function () { 9764 homeEqualHeightBottom() 9765 }, 200)) 9766 9767 // Front carousel on hover show arrows 9768 var userAgent = navigator.userAgent // don't show on mobile devices. 9769 if (!(userAgent.match(/iPad/i) || userAgent.match(/iPhone/i) || userAgent.match(/Android/i))) { 9770 $('.orbit-container, .orbit-bullets', context).once('carousel-arrows-hover').hover( 9771 function () { 9772 $('.orbit-previous, .orbit-next', context).once('show-carousel-arrows').addClass('arrows-active') 9773 }, 9774 function () { 9775 $('.orbit-previous, .orbit-next', context).once('hide-carousel-arrows').removeClass('arrows-active') 9776 } 9777 ) 9778 } 9779 }) 9780 } 9781 } 9782 } 9783 9784 /** 9785 * ! - Online tools - Page scroll 9786 */ 9787 Drupal.behaviors.onlineToolsScroll = { 9788 attach: function (context, settings) { 9789 if ($('body.node--type-online-tools #online-tools-grid').length) { 9790 var countTools = 0 9791 $('.field-name-field-ot-tool-links > .field-items > .field-item h3.node-title span', context).once('each-tool').each(function () { 9792 // Add ID to each .field-item 9793 countTools++ 9794 $(this).parents('.field-item', context).once('apply-attr-id').attr('id', 'tool-item-' + countTools) 9795 // Add section title to scroll-menu. 9796 var sectionHead = $(this).text() 9797 $('<a href="#tool-item-' + countTools + '" class="tool-item-' + countTools + '">' + sectionHead + '</a>', context).once('append-scroll-menu').appendTo('#scroll-menu') 9798 }) 9799
9800 $('#scroll-menu a', context).once('anchor-click').click(function () { 9801 // Click to scroll to .field-item 9802 var scrollMenuID = $(this).attr('href') 9803 $('html, body', context).animate({ scrollTop: $('.field-item' + scrollMenuID).offset().top - 118 }, 500) 9804 9805 return false 9806 }) 9807 9808 // Window scroll. 9809 var distance = $('#scroll-menu').offset().top 9810 $(window).scroll(function () { 9811 // Add sticky scroll-menu to top. 9812 //if ($(window).scrollTop() >= distance) { 9813 //$('#online-tools-grid', context).addClass('stick') 9814 //} else { 9815 // $('#online-tools-grid', context).removeClass('stick') 9816 // } 9817 9818 // Highlight menu item on scroll. 9819 var countToolAnchors = 0 9820 $('.field-name-field-ot-tool-links > .field-items > .field-item h3.node-title span', context).once('hightlight-el').each(function () { 9821 countToolAnchors++ 9822 9823 if ($(window).scrollTop() >= $('.field-name-field-ot-tool-links .field-item#tool-item-' + countToolAnchors).offset().top - 60) { 9824 $('#scroll-menu a', context).removeClass('is-active') 9825 $('#scroll-menu a.tool-item-' + countToolAnchors, context).addClass('is-active') 9826 } else { 9827 $('#scroll-menu a.tool-item-' + countToolAnchors, context).removeClass('is-active') 9828 } 9829 }) 9830 }) 9831 } 9832 } 9833 } 9834 9835 /** 9836 * ! About Us Section 9837 * ------------------------------------------------------------------- 9838 */ 9839 9840 /** 9841 * ! - About us video gallery. 9842 */ 9843 Drupal.behaviors.videoGallery = { 9844 attach: function (context, settings) { 9845 if ($('.node--type-about-us').length) { 9846 var $loadFirstVideo = $('.field-name-field-aboutus-video-cluster .field-items .field-item:first-child').find('a.video-link').attr('href') 9847 $('.video-wrapper iframe').attr('src', $loadFirstVideo) 9848 9849 $('a.video-link').click(function () { 9850 var videoUrl = $(this).attr('href') 9851 $('.video-wrapper iframe').attr('src', videoUrl) 9852 9853 return false 9854 }) 9855 } 9856 } 9857 } 9858 9859 /** 9860 * ! - Customer care number change. 9861 */ 9862 Drupal.behaviors.telNumberChange = { 9863 attach: function (context, settings) { 9864 if ($('#call-customer-care').length) { 9865 $('select#dropdown-location-List', context).once('tel-number-change').change(function () { 9866 var $selectedNumner = $(this).find('option:selected').val() 9867 $('#call-customer-care', context).find('.tel').text($selectedNumner) 9868 }) 9869 } 9870 } 9871 } 9872 9873 /** 9874 * ! - Map pins/tool tips. 9875 */ 9876 Drupal.behaviors.mapPins = { 9877 attach: function (context, settings) { 9878 if ($('#map-locations').length) { 9879 $('#map-locations map area', context).once('map-click').click(function () { 9880 return false 9881 }) 9882 9883 $('#map-locations map area', context).once('map-hover').hover( 9884 function () { 9885 var rectcoords = $(this).attr('coords') 9886 var coordsID = $(this).attr('id') 9887 var coords = rectcoords.split(',') 9888 var $x = coords[0] 9889 var $y = coords[3] - 20 9890 $('.pin-tooltip.' + coordsID, context).addClass('active').css({'top': $y + 'px', 'left': $x + 'px'}) 9891 }, 9892 function () { 9893 var coordsID = $(this).attr('id') 9894 $('.pin-tooltip.' + coordsID, context).removeClass('active').css({'top': '', 'left': ''}) 9895 } 9896 ) 9897 } 9898 } 9899 } 9900 9901 /** 9902 * ! Products Section 9903 * ------------------------------------------------------------------- 9904 */ 9905 9906 /** 9907 * ! - Product Directory Header Image. 9908 */ 9909 Drupal.behaviors.productDirectory = { 9910 attach: function (context, settings) { 9911 if ($('.views-page.context-products').length) { 9912 var setProductDirectoryHeight = function () { 9913 var productDirectoryHeight = $('.block-views-block-products-block-1').height() 9914 $('.block-views-block-products-block-1', context).find('.header-preview-image').css('min-height', productDirectoryHeight) 9915 } 9916 setProductDirectoryHeight() 9917 $(window).resize(waterCore.waitForIdle(function () { 9918 $('.block-views-block-products-block-1', context).find('.header-preview-image').css('min-height', '') 9919 setProductDirectoryHeight() 9920 }, 200)) 9921 } 9922 } 9923 } 9924 9925 /** 9926 * ! - Product directory scroll. 9927 */ 9928 Drupal.behaviors.productDirectoryScroll = { 9929 attach: function (context, settings) { 9930 if ($('body.views-page.path-products').length) { 9931 $('<div class="return-top"><a href="#top">Volver arriba</a></div>', context).once('append-top').appendTo('#block-ge-water-content .views-view-grid.horizontal') 9932 9933 $('.return-top a', context).once('return-top').click(function () { 9934 $('html, body').animate({ 9935 scrollTop: 0 9936 }, 500) 9937 return false 9938 }) 9939 9940 $('.block-views-block-product-directory-menu-block-1', context).once('scroll-to').find('a').click(function () { 9941 var productMenuName = $(this).attr('href') 9942 console.log(productMenuName) 9943 $('html, body').animate({ scrollTop: $('#block-ge-water-content h3 ' + productMenuName).offset().top - 20 }, 500) 9944 return false 9945 }) 9946 } 9947 } 9948 } 9949 9950 /** 9951 * ! Misc Section 9952 * ------------------------------------------------------------------- 9953 */ 9954 9955 /** 9956 * ! - InSight Analytics & Savings Calculator Landing Page 9957 * Code copied from the old GE site. 9958 */ 9959 Drupal.behaviors.webformCalculators = { 9960 attach: function (context, settings) { 9961 // InSight Analytics 9962 if ($('body.node--type-landing-page.page-node-728').length) { 9963 $('input', context).keyup(function () { 9964 var firstValue = parseFloat($('#first').val()) 9965 var secondValue = parseFloat($('#second').val()) 9966 var thirdValue = parseFloat($('#third').val()) 9967 var fourthValue = parseFloat($('#fourth').val()) 9968 9969 $('#output1').html(secondValue * 160) 9970 var firstOutput = parseFloat($('#output1').text()) 9971 9972 $('#output2').html((thirdValue * firstOutput * firstValue * fourthValue * 24 * 365) / 1000) 9973 var secondOutput = parseFloat($('#output2').text()) 9974 9975 $('#output1').text(Number($('#output1').text()).toFixed(0)) 9976 $('#output2').text(Number($('#output2').text()).toFixed(0)) 9977 }) 9978 } 9979 9980 // Savings Calculator 9981 if ($('body.node--type-landing-page.page-node-706').length) { 9982 $('#flightHrsPerYr', context).blur(function () { 9983 if (isNaN($(this).val())) { 9984 $(this).val('') 9985 alert('Please enter valid input.') 9986 return false 9987 } 9988 9989 $('#highEnd', context).text(Number($(this).val()) * 150) 9990 $('#ultraCons', context).text(Number($(this).val()) * 40) 9991 }) 9992 } 9993 } 9994 } 9995 9996 /** 9997 * ! - Sitemap. 9998 */ 9999 Drupal.behaviors.siteMap = { 10000 attach: function (context, settings) { 10001 if ($('body.context-sitemap').length) {
10002 // Add class names based pulled from the link label. 10003 $('.sitemap-box-menu .content > ul.sitemap-menu > li', context).once('sitemap-classnames').each(function (index) { 10004 var expendedTitle = $(this).find('> a').text().replace(/[^\w\s]/gi, '').replace(/\s+/g, '-').toLowerCase() 10005 $(this).addClass(expendedTitle) 10006 }) 10007 10008 // Move the product links under Product. 10009 $('.block-views-block-sitemap-product-directory-block-1 .item-list', context).once('sitemap-append').appendTo('.sitemap-box-menu-main li.products') 10010 $('.block-views-block-sitemap-product-directory-block-1', context).once('sitemap-remove').remove() 10011 } 10012 } 10013 } 10014})(window.jQuery, window.Drupal, this, this.document, window.waterCore) 10015; 10016/* 10017 * @author Frank@DesignHammer 10018 * 10019 */ 10020 10021(function ($, jQuery) { 10022 'use strict' 10023 var localUrl = 'local.suezwater.com' 10024 var livereloadUrl = '//localhost:33729/livereload.js' 10025 10026 // Only run locally. 10027 if (window.location.href.indexOf(localUrl) > -1) { 10028 $(document).ready(function () { 10029 // Don't run when logged in. 10030 if (!$('body').hasClass('user-logged-in')) { 10031 $.getScript(livereloadUrl) 10032 .done(function (script, textStatus) { 10033 // console.log(textStatus); 10034 }) 10035 .fail(function (jqxhr, settings, exception) { 10036 // console.log('failed to load'); 10037 }) 10038 } 10039 }) 10040 } 10041})(window.jQuery) 10042; 10043(function ($, Drupal) { 10044 10045 $(document).foundation(); 10046 $(window).on('load', function () { 10047 //on load 10048 setDynamicHeight($(this)); 10049 setDynamicHeightPnSTab(); 10050 //set selected anchor on handbooks 10051 setActiveAnchorHandbook(); 10052 }); 10053 10054 $(".toggle-btn").click(function(){ 10055 $(".toggle-content").toggle(); 10056 }); 10057 $(".search-blog-post .button").click(function(){ 10058 $(".views-blog-post-listing").hide(); 10059 $(".featured-blog-post").hide(); 10060 }); 10061 10062 $(window).on('resize', function () { 10063 var win = $(this); 10064 if (win.width() >= 768) { 10065 var PanelId = $(".tabs-title.active").attr("rel"); 10066 $("#" + PanelId).fadeIn(); 10067 } 10068 10069 if (win.width() <= 768) { 10070 var PanelId = $(".tabs-title.active").attr("rel"); 10071 var drawid = $(".tab_drawer_heading[rel^='" + PanelId + "']") 10072 $("#" + PanelId).fadeIn(); 10073 $(drawid).children("#arrow").removeClass("fa-angle-right"); 10074 $(drawid).children("#arrow").addClass("fa-angle-up"); 10075 } 10076 //set dynamic heights of content 10077 //setDynamicHeight($(this)); 10078 10079 }); 10080 10081 $('#our-people .field-name-field-aboutus-our-people > .field-items > .field-item').flip({ 10082 trigger: 'hover', 10083 }); 10084 10085 function setDynamicHeight(win) { 10086 /* Set dynamic height for media cluster */ 10087 if (win.width() >= 414) { 10088 var maxBlockHieght = 210; 10089 $('#media-cluster-section .column').each(function (index) { 10090 var blockHieght = $(this).height(); 10091 if (blockHieght > maxBlockHieght) { 10092 maxBlockHieght = blockHieght; 10093 } 10094 }); 10095 $('#media-cluster-section .column').each(function (index) { 10096 $(this).find('.thumbnail').css('height', maxBlockHieght); 10097 }); 10098 10099 /* Set dynamic height for Sectional block */ 10100 var maxLowerContentHeight = 150; 10101 $('#media-resoures-section .column').each(function () { 10102 var blockHieght = $(this).height(); 10103 if (blockHieght > maxLowerContentHeight) { 10104 maxLowerContentHeight = blockHieght; 10105 } 10106 }); 10107 $('#media-resoures-section .column').each(function () { 10108 $(this).find('.thumbnail').css('height', maxLowerContentHeight); 10109 }); 10110 10111 /* Set dynamic height for Newsroom block */ 10112 var maxLowerNewsContentHeight = 150; 10113 $('.view-display-id-block_11 .views-col').each(function () { 10114 var blockHieght = $(this).height(); 10115 if (blockHieght > maxLowerNewsContentHeight) { 10116 maxLowerNewsContentHeight = blockHieght; 10117 } 10118 }); 10119 $('.view-display-id-block_11 .views-col').each(function () { 10120 $(this).find('.newsroom-container').css('height', maxLowerNewsContentHeight); 10121 }); 10122 10123 } 10124 10125 /* Set dynamic height for Sectional block */ 10126 var maxFrontPageHeight = 100; 10127 if (win.width() > 414) { 10128 $('#media-resoures-section.white-media-resource-section .column').each(function () { 10129 var blockHieght = $(this).height(); 10130 if (blockHieght > maxFrontPageHeight) { 10131 maxFrontPageHeight = blockHieght - 4; 10132 } 10133 }); 10134 $('#media-resoures-section.white-media-resource-section .column .thumbnail').each(function () { 10135 $(this).css('height', maxFrontPageHeight + "px"); 10136 }); 10137 } 10138 // set height for lower space on P&S 10139 var maxLowerContentPSHeight = 307; 10140 $('.node--type-page .image-gallery .lower-content-space .row .column').each(function () { 10141 var blockHieght = $(this).height(); 10142 if (blockHieght > maxLowerContentPSHeight) { 10143 maxLowerContentPSHeight = blockHieght; 10144 } 10145 }); 10146 10147 $('.node--type-page .image-gallery .lower-content-space .row .column').each(function () { 10148 $(this).find('.thumbnail').css('min-height', maxLowerContentPSHeight + 'px'); 10149 }); 10150 10151 } 10152 10153 function setActiveAnchorHandbook() { 10154 var classNames = $('body').attr('class'); 10155 var splitClasses = classNames.split(" "); 10156 for (var index = 0; index < splitClasses.length; index++) { 10157 if (splitClasses[index].indexOf('context-handbook-') !== -1) { 10158 var classForAnchor = splitClasses[index].substring('context-handbook-'.length); 10159 $('#sidebar-first ul li a').each(function () {
10160 if ($(this).attr('href').indexOf(classForAnchor) !== -1) { 10161 $(this).addClass('selected'); 10162 } 10163 }); 10164 10165 } 10166 } 10167 } 10168 10169 function setDynamicHeightPnSTab() { 10170 // set height for tab boxes on P&S 10171 var maxTabContentPSHeight = 300; 10172 10173 $('#power-tabs-content .product-services-panels.row .column .thumbnail').each(function () { 10174 var blockHieght = $(this).height(); 10175 if (blockHieght > maxTabContentPSHeight) { 10176 maxTabContentPSHeight = blockHieght; 10177 } 10178 }); 10179 10180 $('#power-tabs-content .product-services-panels.row .column .thumbnail').each(function () { 10181 $(this).css('min-height', maxTabContentPSHeight + 'px'); 10182 }); 10183 10184 } 10185 // //on load 10186 // setDynamicHeight($(this)); 10187 10188 // tabbed to accordin content 10189 var parentId = $($('.tabs-container').get(0)).attr('id'); 10190 $('.tabs-container .tabs-panel').each(function (index, value) { 10191 if ($(this).hasClass('is-active')) { 10192 if (sessionStorage.getItem('activeTab-' + parentId) == null) { 10193 activeTabId = $(this).attr('id'); 10194 sessionStorage.setItem('activeTab-' + parentId, activeTabId); 10195 //$(this).show(); 10196 } 10197 } 10198 }); 10199 10200 // Product & Services page tab item display by menu item 10201 var pageurl = $(location).attr("href"); 10202 var currentPath = $(location).attr("pathname"); 10203 pageurl = pageurl.split("#"); 10204 if (typeof pageurl !== 'undefined' && typeof pageurl[1] !== 'undefined') { 10205 sessionStorage.setItem('activeTab-' + parentId, pageurl[1]); 10206 } 10207 10208 // if (!activeTabId && parentId) { 10209 // $(".tabs-panel:first").show(); 10210 // } 10211 10212 /* if in tab mode */ 10213 10214 /* Product & Services Type js start*/ 10215 $(".more").bind("click", function (event) { 10216 $(this).parent('.products').find('li').show(); 10217 $(this).parent('.products').find('.less').css('visibility', 'visible'); 10218 $(this).parent('.products').find('.more').css('visibility', 'hidden'); 10219 var extraElems = $(this).parent('.products').find('li').length - 3; 10220 var heightOfElem = $('.product-services-panels.row .column').height(); 10221 }); 10222 10223 $(".less").bind("click", function (event) { 10224 $(this).parent('.products').find('li').not(':lt(3)').hide(); 10225 $(this).parent('.products').find('.less').css('visibility', 'hidden'); 10226 $(this).parent('.products').find('.more').css('visibility', 'visible'); 10227 }); 10228 /* Product & Services Type js end*/ 10229 10230 // Product & Services page tab item display by menu item 10231 $(".menu li .tabItem").click(function () { 10232 var menuRel = $(this).attr("rel"); 10233 menuRel = menuRel.split(" "); 10234 var menuTab = menuRel[1]; 10235 10236 if (typeof menuRel[0] !== 'undefined' && menuRel[0] == parentId) { 10237 sessionStorage.setItem('activeTab-' + menuRel[0], menuTab); 10238 $("#power-tabs .tabs-title").removeClass("is-active"); 10239 $("#power-tabs .tabs-title[rel=" + menuTab + "]").addClass("is-active"); 10240 $("ul.tabs li").removeClass("active"); 10241 $("#power-tabs-content .tabs-panel").removeClass('is-active'); 10242 $("#power-tabs-content .tabs-panel[id=" + menuTab + "]").addClass('is-active'); 10243 $("#power-tabs-content .tabs-panel").hide(); 10244 $("#power-tabs-content .tabs-panel[id=" + menuTab + "]").show(); 10245 $(".tab_drawer_heading").removeClass("d_active"); 10246 $(".tab_drawer_heading[rel^='" + menuTab + "']").addClass("d_active"); 10247 $(".tab_drawer_heading[rel^='" + menuTab + "']").children("#arrow").removeClass("fa-angle-right"); 10248 $(".tab_drawer_heading[rel^='" + menuTab + "']").children("#arrow").addClass("fa-angle-up"); 10249 } 10250 }); 10251 10252 $("ul.tabs li").click(function () { 10253 //set tab in active mode 10254 var parentId = $($('.tabs-container').get(0)).attr('id'); 10255 if (parentId) { 10256 $(".tabs-panel").hide(); 10257 } 10258 10259 var activeTab = $(this).attr("rel"); 10260 sessionStorage.setItem('activeTab-' + parentId, activeTab); 10261 $("#" + activeTab).fadeIn(); 10262 $("ul.tabs li").removeClass("active"); 10263 $(this).addClass("active"); 10264 $(".tab_drawer_heading").removeClass("d_active"); 10265 $(".tab_drawer_heading[rel^='" + activeTab + "']").addClass("d_active"); 10266 $(".tab_drawer_heading[rel^='" + activeTab + "']").children("#arrow").removeClass("fa-angle-right"); 10267 $(".tab_drawer_heading[rel^='" + activeTab + "']").children("#arrow").addClass("fa-angle-up"); 10268 10269 // set height for tab boxes on P&S 10270 setDynamicHeightPnSTab(); 10271 }); 10272 // /* if in drawer mode */ 10273 10274 //set tab in active mode on load 10275 10276 if (sessionStorage.getItem('activeTab-' + parentId) !== null) { 10277 var lis = $("ul.tabs li"); 10278 for (var i = 0; i < lis.length; i++) { 10279 $($(".tab_drawer_heading #arrow").get(i)).removeClass("fa-angle-up"); 10280 $($(".tab_drawer_heading #arrow").get(i)).addClass("fa-angle-right"); 10281 if (lis.get(i).attributes["rel"].value === sessionStorage.getItem('activeTab-' + parentId)) { 10282 $("ul.tabs li").removeClass("is-active"); 10283 //for panels 10284 $(".tabs-panel").hide(); 10285 $(".tab_drawer_heading").removeClass("d_active"); 10286 $(lis.get(i)).addClass("is-active"); 10287 $($(".tabs-panel").get(i)).addClass("is-active"); 10288 $($(".tabs-panel").get(i)).show(); 10289 $($(".tab_drawer_heading").get(i)).addClass("d_active"); 10290 $($(".tab_drawer_heading #arrow").get(i)).removeClass("fa-angle-right"); 10291 $($(".tab_drawer_heading #arrow").get(i)).addClass("fa-angle-up"); 10292 break; 10293 } 10294 } 10295 } 10296 10297 $(".tab_drawer_heading").click(function (e) { 10298 // e.preventDefault(); 10299 var parentId = $($('.tabs-container').get(0)).attr('id'); 10300 sessionStorage.setItem('activeTab-' + parentId, $(this).attr('rel')); 10301 var d_activeTab = $(this).attr("rel"); 10302 var visible = $("#" + d_activeTab).is(':visible'); 10303 $("span#arrow").removeClass("fa-angle-up"); 10304 $("span#arrow").addClass("fa-angle-right"); 10305 if (visible) { 10306 10307 $("#" + d_activeTab).hide(); 10308 $(".tab_drawer_heading").removeClass("d_active"); 10309 $("span#arrow").removeClass("fa-angle-up"); 10310 $("span#arrow").addClass("fa-angle-right"); 10311 } 10312 else { 10313 10314 $(".tabs-panel").hide(); 10315 $("#" + d_activeTab).fadeIn(); 10316 $(this).addClass("d_active"); 10317 $(this).children("#arrow").removeClass("fa-angle-right"); 10318 $(this).children("#arrow").addClass("fa-angle-up"); 10319 } 10320 10321 $("ul.tabs li").removeClass("active"); 10322 $("ul.tabs li[rel^='" + d_activeTab + "']").addClass("active"); 10323 // set height for tab boxes on P&S 10324 setDynamicHeightPnSTab(); 10325 10326 }); 10327 10328 // Remove option element from select element. 10329 function removeAllOptions(selcetObj) { 10330 len = selcetObj.options.length; 10331 for (var i=len; i; i--) { 10332 par = selcetObj.options[i-1].parentNode; 10333 par.removeChild( selcetObj.options[i-1] ); 10334 } 10335 } 10336 10337 // Add option element to select element. 10338 function addOptions(selcetObj, currentOp, appId) { 10339 var options = document.createDocumentFragment(); 10340 var option; 10341 10342 if (typeof currentOp['All'] !== 'undefined') { 10343 option = document.createElement('option'); 10344 option.appendChild( document.createTextNode( currentOp['All'] ) ); 10345 option.value = 'All'; 10346 options.appendChild(option); 10347 delete currentOp['All']; 10348 } 10349 10350 $.each(currentOp, function( index, value ) { 10351 option = document.createElement('option'); 10352 option.appendChild( document.createTextNode( value ) ); 10353 option.value = index; 10354 10355 if (index == appId) { 10356 var selectAtt = document.createAttribute("selected"); 10357 selectAtt.value = "selected"; 10358 option.setAttributeNode(selectAtt); 10359 } 10360 options.appendChild(option); 10361 }); 10362 10363 selcetObj.appendChild(options); 10364 } 10365 10366 // Reset select options. 10367 function resetSelectOptions(selectOptions, id, appId) { 10368 var configOptions = JSON.parse(drupalSettings.toc_filter); 10369 10370 if (typeof configOptions[id] !== 'undefined' && 10371 typeof configOptions[id]['terms'] !== 'undefined') { 10372 // Remove all options from application field. 10373 removeAllOptions(selectOptions); 10374 10375 // Now add new option elements. 10376 addOptions(selectOptions, configOptions[id]['terms'], appId); 10377 } 10378 } 10379 10380 // Add suez behaviors to work on ajax releted functionality. 10381 Drupal.behaviors.suezwater = { 10382 attach: function (context, settings) { 10383 var currentId = $("#toc-industry-wrapper [name='field_industries_filter_search_target_id'] option[selected='selected']").val(); 10384 10385 if (typeof currentId != 'undefined' && currentId != 'All') { 10386 // Default select options. 10387 var form = document.forms['views-exposed-form-toc-by-application-block-1']; 10388 var cuurentApp = form.elements['field_applications_to_use_only_f_target_id']; 10389 var currentAppId = $("#toc-applications-wrapper [name='field_applications_to_use_only_f_target_id'] option[selected='selected']").val(); 10390 resetSelectOptions(cuurentApp, currentId, currentAppId); 10391 } 10392 10393 // Reset select options based on change event. 10394 $("#toc-industry-wrapper [name='field_industries_filter_search_target_id']", context).change(function () { 10395 var AppOp = this.form.elements['field_applications_to_use_only_f_target_id']; 10396 var industryId = $(this).val(); 10397 resetSelectOptions(AppOp, industryId, 'All'); 10398 10399 // Reset to all mode. 10400 $("#toc-modes-wrapper [name='field_modes_filter_search_target_id'] option").prop("selected", false); 10401 $("#toc-modes-wrapper [name='field_modes_filter_search_target_id'] option[value='All']").prop("selected", true); 10402 }); 10403 10404 // Reset to all mode. 10405 $("#toc-applications-wrapper [name='field_applications_to_use_only_f_target_id']", context).change(function () { 10406 var appId = $(this).val(); 10407 $(this).find("option[value='" + appId + "']").prop("selected", true); 10408 $("#toc-modes-wrapper [name='field_modes_filter_search_target_id'] option").prop("selected", false); 10409 $("#toc-modes-wrapper [name='field_modes_filter_search_target_id'] option[value='All']").prop("selected", true); 10410 }); 10411 10412 // Attach action to Drupal Ajax Views event in newsroom page
10413 $(document).once('Views').ajaxSuccess(function (event, data) { 10414 if (drupalSettings && drupalSettings.views && drupalSettings.views.ajaxViews) { 10415 var ajaxViews = drupalSettings.views.ajaxViews; 10416 Object.keys(ajaxViews || {}).forEach(function (i) { 10417 if (ajaxViews[i]['view_name'] == 'newsroom' && ajaxViews[i]['view_display_id'] == 'block_4') { 10418 if ($('.views-infinite-scroll-content-wrapper .direct-access').length == 0){ 10419 var $container = $('.views-infinite-scroll-content-wrapper'); 10420 var contactDiv = $('.direct-access-box').html(); 10421 $(contactDiv).insertAfter($container.find('.masonry-item').eq(1)); 10422 } 10423 } 10424 }); 10425 } 10426 }); 10427 } 10428 10429 }; // End of drupal behaviors. 10430 10431 //Add block inside masonry newsroom page 10432 var $container = $('.views-infinite-scroll-content-wrapper'); 10433 var contactDiv = $('.direct-access-box').html(); 10434 if ($('.views-infinite-scroll-content-wrapper .direct-access').length == 0){ 10435 $(contactDiv).insertAfter($container.find('.masonry-item').eq(1)); 10436 } 10437 10438})(jQuery, Drupal); 10439; 10440/** 10441 * @file 10442 * CKEditor Accordion functionality. 10443 */ 10444 10445(function ($, Drupal, drupalSettings) { 10446 'use strict'; 10447 Drupal.behaviors.ckeditorAccordion = { 10448 attach: function (context, settings) { 10449 10450 // Create accordion functionality if the required elements exist is available. 10451 var $ckeditorAccordion = $('.ckeditor-accordion'); 10452 if ($ckeditorAccordion.length > 0) { 10453 // Create simple accordion mechanism for each tab. 10454 $ckeditorAccordion.each(function () { 10455 var $accordion = $(this); 10456 if ($accordion.hasClass('styled')) { 10457 return; 10458 } 10459 10460 // The first one is the correct one. 10461 if (!drupalSettings.ckeditorAccordion.accordionStyle.collapseAll) { 10462 $accordion.children('dt:first').addClass('active'); 10463 $accordion.children('dd:first').addClass('active'); 10464 $accordion.children('dd:first').css('display', 'block'); 10465 } 10466 10467 // Turn the accordion tabs to links so that the content is accessible & can be traversed using keyboard. 10468 $accordion.children('dt').each(function () { 10469 var $tab = $(this); 10470 var tabText = $tab.text().trim(); 10471 var toggleClass = $tab.hasClass('active') ? ' active' : ''; 10472 $tab.html('<a class="ckeditor-accordion-toggler" href="#"><span class="ckeditor-accordion-toggle' + toggleClass + '"></span>' + tabText + '</a>'); 10473 }); 10474 10475 // Wrap the accordion in a div element so that quick edit function shows the source correctly. 10476 $accordion.addClass('styled').removeClass('ckeditor-accordion').wrap('<div class="ckeditor-accordion-container"></div>'); 10477 10478 // Trigger an ckeditorAccordionAttached event to let other frameworks know that the accordion has been attached. 10479 $accordion.trigger('ckeditorAccordionAttached'); 10480 }); 10481 10482 // Add click event to body once because quick edits & ajax calls might reset the HTML. 10483 $('body').once('ckeditorAccordionToggleEvent').on('click', '.ckeditor-accordion-toggler', function (e) { 10484 var $t = $(this).parent(); 10485 var $parent = $t.parent(); 10486 10487 // Clicking on open element, close it. 10488 if ($t.hasClass('active')) { 10489 $t.removeClass('active'); 10490 $t.next().slideUp(); 10491 } 10492 else { 10493 if(!drupalSettings.ckeditorAccordion.accordionStyle.keepRowsOpen) { 10494 // Remove active classes. 10495 $parent.children('dt.active').removeClass('active').children('a').removeClass('active'); 10496 $parent.children('dd.active').slideUp(function () { 10497 $(this).removeClass('active'); 10498 }); 10499 } 10500 10501 // Show the selected tab. 10502 $t.addClass('active'); 10503 $t.next().slideDown(300).addClass('active'); 10504 } 10505 10506 // Don't add hash to url. 10507 e.preventDefault(); 10508 }); 10509 } 10510 } 10511 }; 10512})(jQuery, Drupal, drupalSettings); 10513; 10514/*! 10515 * jQuery Form Plugin 10516 * version: 4.3.0 10517 * Requires jQuery v1.7.2 or later 10518 * Project repository: https://github.com/jquery-form/form 10519 10520 * Copyright 2017 Kevin Morris 10521 * Copyright 2006 M. Alsup 10522 10523 * Dual licensed under the LGPL-2.1+ or MIT licenses 10524 * https://github.com/jquery-form/form#license 10525 10526 * This library is free software; you can redistribute it and/or 10527 * modify it under the terms of the GNU Lesser General Public
vendor: 16,397 bytes, lines 10528-10535
10528 * License as published by the Free Software Foundation; either 10529 * version 2.1 of the License, or (at your option) any later version. 10530 * This library is distributed in the hope that it will be useful, 10531 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10532 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10533 * Lesser General Public License for more details. 10534 */ 10535!function(r){"function"==typeof define&&define.amd?define(["jquery"],r):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),r(t),t}:r(jQuery)}(function(q){"use strict";var m=/\r?\n/g,S={};S.fileapi=void 0!==q('<input type="file">').get(0).files,S.formdata=void 0!==window.FormData;var _=!!q.fn.prop;function o(e){var t=e.data;e.isDefaultPrevented()||(e.preventDefault(),q(e.target).closest("form").ajaxSubmit(t))}function i(e){var t=e.target,r=q(t);if(!r.is("[type=submit],[type=image]")){var a=r.closest("[type=submit]");if(0===a.length)return;t=a[0]}var n,o=t.form;"image"===(o.clk=t).type&&(void 0!==e.offsetX?(o.clk_x=e.offsetX,o.clk_y=e.offsetY):"function"==typeof q.fn.offset?(n=r.offset(),o.clk_x=e.pageX-n.left,o.clk_y=e.pageY-n.top):(o.clk_x=e.pageX-t.offsetLeft,o.clk_y=e.pageY-t.offsetTop)),setTimeout(function(){o.clk=o.clk_x=o.clk_y=null},100)}function N(){var e;q.fn.ajaxSubmit.debug&&(e="[jquery.form] "+Array.prototype.join.call(arguments,""),window.console&&window.console.log?window.console.log(e):window.opera&&window.opera.postError&&window.opera.postError(e))}q.fn.attr2=function(){if(!_)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},q.fn.ajaxSubmit=function(M,e,t,r){if(!this.length)return N("ajaxSubmit: skipping submit process - no element selected"),this;var O,a,n,o,X=this;"function"==typeof M?M={success:M}:"string"==typeof M||!1===M&&0<arguments.length?(M={url:M,data:e,dataType:t},"function"==typeof r&&(M.success=r)):void 0===M&&(M={}),O=M.method||M.type||this.attr2("method"),n=(n=(n="string"==typeof(a=M.url||this.attr2("action"))?q.trim(a):"")||window.location.href||"")&&(n.match(/^([^#]+)/)||[])[1],o=/(MSIE|Trident)/.test(navigator.userAgent||"")&&/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",M=q.extend(!0,{url:n,success:q.ajaxSettings.success,type:O||q.ajaxSettings.type,iframeSrc:o},M);var i={};if(this.trigger("form-pre-serialize",[this,M,i]),i.veto)return N("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(M.beforeSerialize&&!1===M.beforeSerialize(this,M))return N("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var s=M.traditional;void 0===s&&(s=q.ajaxSettings.traditional);var u,c,C=[],l=this.formToArray(M.semantic,C,M.filtering);if(M.data&&(c=q.isFunction(M.data)?M.data(l):M.data,M.extraData=c,u=q.param(c,s)),M.beforeSubmit&&!1===M.beforeSubmit(l,this,M))return N("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[l,this,M,i]),i.veto)return N("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var f=q.param(l,s);u&&(f=f?f+"&"+u:u),"GET"===M.type.toUpperCase()?(M.url+=(0<=M.url.indexOf("?")?"&":"?")+f,M.data=null):M.data=f;var d,m,p,h=[];M.resetForm&&h.push(function(){X.resetForm()}),M.clearForm&&h.push(function(){X.clearForm(M.includeHidden)}),!M.dataType&&M.target?(d=M.success||function(){},h.push(function(e,t,r){var a=arguments,n=M.replaceTarget?"replaceWith":"html";q(M.target)[n](e).each(function(){d.apply(this,a)})})):M.success&&(q.isArray(M.success)?q.merge(h,M.success):h.push(M.success)),M.success=function(e,t,r){for(var a=M.context||this,n=0,o=h.length;n<o;n++)h[n].apply(a,[e,t,r||X,X])},M.error&&(m=M.error,M.error=function(e,t,r){var a=M.context||this;m.apply(a,[e,t,r,X])}),M.complete&&(p=M.complete,M.complete=function(e,t){var r=M.context||this;p.apply(r,[e,t,X])});var v=0<q("input[type=file]:enabled",this).filter(function(){return""!==q(this).val()}).length,g="multipart/form-data",x=X.attr("enctype")===g||X.attr("encoding")===g,y=S.fileapi&&S.formdata;N("fileAPI :"+y);var b,T=(v||x)&&!y;!1!==M.iframe&&(M.iframe||T)?M.closeKeepAlive?q.get(M.closeKeepAlive,function(){b=w(l)}):b=w(l):b=(v||x)&&y?function(e){for(var r=new FormData,t=0;t<e.length;t++)r.append(e[t].name,e[t].value);if(M.extraData){var a=function(e){var t,r,a=q.param(e,M.traditional).split("&"),n=a.length,o=[];for(t=0;t<n;t++)a[t]=a[t].replace(/\+/g," "),r=a[t].split("="),o.push([decodeURIComponent(r[0]),decodeURIComponent(r[1])]);return o}(M.extraData);for(t=0;t<a.length;t++)a[t]&&r.append(a[t][0],a[t][1])}M.data=null;var n=q.extend(!0,{},q.ajaxSettings,M,{contentType:!1,processData:!1,cache:!1,type:O||"POST"});M.uploadProgress&&(n.xhr=function(){var e=q.ajaxSettings.xhr();return e.upload&&e.upload.addEventListener("progress",function(e){var t=0,r=e.loaded||e.position,a=e.total;e.lengthComputable&&(t=Math.ceil(r/a*100)),M.uploadProgress(e,r,a,t)},!1),e});n.data=null;var o=n.beforeSend;return n.beforeSend=function(e,t){M.formData?t.data=M.formData:t.data=r,o&&o.call(this,e,t)},q.ajax(n)}(l):q.ajax(M),X.removeData("jqxhr").data("jqxhr",b);for(var j=0;j<C.length;j++)C[j]=null;return this.trigger("form-submit-notify",[this,M]),this;function w(e){var t,r,l,f,o,d,m,p,a,n,h,v,i=X[0],g=q.Deferred();if(g.abort=function(e){p.abort(e)},e)for(r=0;r<C.length;r++)t=q(C[r]),_?t.prop("disabled",!1):t.removeAttr("disabled");(l=q.extend(!0,{},q.ajaxSettings,M)).context=l.context||l,o="jqFormIO"+(new Date).getTime();var s=i.ownerDocument,u=X.closest("body");if(l.iframeTarget?(n=(d=q(l.iframeTarget,s)).attr2("name"))?o=n:d.attr2("name",o):(d=q('<iframe name="'+o+'" src="'+l.iframeSrc+'" />',s)).css({position:"absolute",top:"-1000px",left:"-1000px"}),m=d[0],p={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){var t="timeout"===e?"timeout":"aborted";N("aborting upload... "+t),this.aborted=1;try{m.contentWindow.document.execCommand&&m.contentWindow.document.execCommand("Stop")}catch(e){}d.attr("src",l.iframeSrc),p.error=t,l.error&&l.error.call(l.context,p,t,e),f&&q.event.trigger("ajaxError",[p,l,t]),l.complete&&l.complete.call(l.context,p,t)}},(f=l.global)&&0==q.active++&&q.event.trigger("ajaxStart"),f&&q.event.trigger("ajaxSend",[p,l]),l.beforeSend&&!1===l.beforeSend.call(l.context,p,l))return l.global&&q.active--,g.reject(),g;if(p.aborted)return g.reject(),g;(a=i.clk)&&(n=a.name)&&!a.disabled&&(l.extraData=l.extraData||{},l.extraData[n]=a.value,"image"===a.type&&(l.extraData[n+".x"]=i.clk_x,l.extraData[n+".y"]=i.clk_y));var x=1,y=2;function b(t){var r=null;try{t.contentWindow&&(r=t.contentWindow.document)}catch(e){N("cannot get iframe.contentWindow document: "+e)}if(r)return r;try{r=t.contentDocument?t.contentDocument:t.document}catch(e){N("cannot get iframe.contentDocument: "+e),r=t.document}return r}var c=q("meta[name=csrf-token]").attr("content"),T=q("meta[name=csrf-param]").attr("content");function j(){var e=X.attr2("target"),t=X.attr2("action"),r=X.attr("enctype")||X.attr("encoding")||"multipart/form-data";i.setAttribute("target",o),O&&!/post/i.test(O)||i.setAttribute("method","POST"),t!==l.url&&i.setAttribute("action",l.url),l.skipEncodingOverride||O&&!/post/i.test(O)||X.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),l.timeout&&(v=setTimeout(function(){h=!0,A(x)},l.timeout));var a=[];try{if(l.extraData)for(var n in l.extraData)l.extraData.hasOwnProperty(n)&&(q.isPlainObject(l.extraData[n])&&l.extraData[n].hasOwnProperty("name")&&l.extraData[n].hasOwnProperty("value")?a.push(q('<input type="hidden" name="'+l.extraData[n].name+'">',s).val(l.extraData[n].value).appendTo(i)[0]):a.push(q('<input type="hidden" name="'+n+'">',s).val(l.extraData[n]).appendTo(i)[0]));l.iframeTarget||d.appendTo(u),m.attachEvent?m.attachEvent("onload",A):m.addEventListener("load",A,!1),setTimeout(function e(){try{var t=b(m).readyState;N("state = "+t),t&&"uninitialized"===t.toLowerCase()&&setTimeout(e,50)}catch(e){N("Server abort: ",e," (",e.name,")"),A(y),v&&clearTimeout(v),v=void 0}},15);try{i.submit()}catch(e){document.createElement("form").submit.apply(i)}}finally{i.setAttribute("action",t),i.setAttribute("enctype",r),e?i.setAttribute("target",e):X.removeAttr("target"),q(a).remove()}}T&&c&&(l.extraData=l.extraData||{},l.extraData[T]=c),l.forceSync?j():setTimeout(j,10);var w,S,k,D=50;function A(e){if(!p.aborted&&!k){if((S=b(m))||(N("cannot access response document"),e=y),e===x&&p)return p.abort("timeout"),void g.reject(p,"timeout");if(e===y&&p)return p.abort("server abort"),void g.reject(p,"error","server abort");if(S&&S.location.href!==l.iframeSrc||h){m.detachEvent?m.detachEvent("onload",A):m.removeEventListener("load",A,!1);var t,r="success";try{if(h)throw"timeout";var a="xml"===l.dataType||S.XMLDocument||q.isXMLDoc(S);if(N("isXml="+a),!a&&window.opera&&(null===S.body||!S.body.innerHTML)&&--D)return N("requeing onLoad callback, DOM not available"),void setTimeout(A,250);var n=S.body?S.body:S.documentElement;p.responseText=n?n.innerHTML:null,p.responseXML=S.XMLDocument?S.XMLDocument:S,a&&(l.dataType="xml"),p.getResponseHeader=function(e){return{"content-type":l.dataType}[e.toLowerCase()]},n&&(p.status=Number(n.getAttribute("status"))||p.status,p.statusText=n.getAttribute("statusText")||p.statusText);var o,i,s,u=(l.dataType||"").toLowerCase(),c=/(json|script|text)/.test(u);c||l.textarea?(o=S.getElementsByTagName("textarea")[0])?(p.responseText=o.value,p.status=Number(o.getAttribute("status"))||p.status,p.statusText=o.getAttribute("statusText")||p.statusText):c&&(i=S.getElementsByTagName("pre")[0],s=S.getElementsByTagName("body")[0],i?p.responseText=i.textContent?i.textContent:i.innerText:s&&(p.responseText=s.textContent?s.textContent:s.innerText)):"xml"===u&&!p.responseXML&&p.responseText&&(p.responseXML=F(p.responseText));try{w=E(p,u,l)}catch(e){r="parsererror",p.error=t=e||r}}catch(e){N("error caught: ",e),r="error",p.error=t=e||r}p.aborted&&(N("upload aborted"),r=null),p.status&&(r=200<=p.status&&p.status<300||304===p.status?"success":"error"),"success"===r?(l.success&&l.success.call(l.context,w,"success",p),g.resolve(p.responseText,"success",p),f&&q.event.trigger("ajaxSuccess",[p,l])):r&&(void 0===t&&(t=p.statusText),l.error&&l.error.call(l.context,p,r,t),g.reject(p,"error",t),f&&q.event.trigger("ajaxError",[p,l,t])),f&&q.event.trigger("ajaxComplete",[p,l]),f&&!--q.active&&q.event.trigger("ajaxStop"),l.complete&&l.complete.call(l.context,p,r),k=!0,l.timeout&&clearTimeout(v),setTimeout(function(){l.iframeTarget?d.attr("src",l.iframeSrc):d.remove(),p.responseXML=null},100)}}}var F=q.parseXML||function(e,t){return window.ActiveXObject?((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!==t.documentElement.nodeName?t:null},L=q.parseJSON||function(e){return window.eval("("+e+")")},E=function(e,t,r){var a=e.getResponseHeader("content-type")||"",n=("xml"===t||!t)&&0<=a.indexOf("xml"),o=n?e.responseXML:e.responseText;return n&&"parsererror"===o.documentElement.nodeName&&q.error&&q.error("parsererror"),r&&r.dataFilter&&(o=r.dataFilter(o,t)),"string"==typeof o&&(("json"===t||!t)&&0<=a.indexOf("json")?o=L(o):("script"===t||!t)&&0<=a.indexOf("javascript")&&q.globalEval(o)),o};return g}},q.fn.ajaxForm=function(e,t,r,a){if(("string"==typeof e||!1===e&&0<arguments.length)&&(e={url:e,data:t,dataType:r},"function"==typeof a&&(e.success=a)),(e=e||{}).delegation=e.delegation&&q.isFunction(q.fn.on),e.delegation||0!==this.length)return e.delegation?(q(document).off("submit.form-plugin",this.selector,o).off("click.form-plugin",this.selector,i).on("submit.form-plugin",this.selector,e,o).on("click.form-plugin",this.selector,e,i),this):(e.beforeFormUnbind&&e.beforeFormUnbind(this,e),this.ajaxFormUnbind().on("submit.form-plugin",e,o).on("click.form-plugin",e,i));var n={s:this.selector,c:this.context};return!q.isReady&&n.s?(N("DOM not ready, queuing ajaxForm"),q(function(){q(n.s,n.c).ajaxForm(e)})):N("terminating; zero elements found by selector"+(q.isReady?"":" (DOM not ready)")),this},q.fn.ajaxFormUnbind=function(){return this.off("submit.form-plugin click.form-plugin")},q.fn.formToArray=function(e,t,r){var a=[];if(0===this.length)return a;var n,o,i,s,u,c,l,f,d,m,p=this[0],h=this.attr("id"),v=(v=e||void 0===p.elements?p.getElementsByTagName("*"):p.elements)&&q.makeArray(v);if(h&&(e||/(Edge|Trident)\//.test(navigator.userAgent))&&(n=q(':input[form="'+h+'"]').get()).length&&(v=(v||[]).concat(n)),!v||!v.length)return a;for(q.isFunction(r)&&(v=q.map(v,r)),o=0,c=v.length;o<c;o++)if((m=(u=v[o]).name)&&!u.disabled)if(e&&p.clk&&"image"===u.type)p.clk===u&&(a.push({name:m,value:q(u).val(),type:u.type}),a.push({name:m+".x",value:p.clk_x},{name:m+".y",value:p.clk_y}));else if((s=q.fieldValue(u,!0))&&s.constructor===Array)for(t&&t.push(u),i=0,l=s.length;i<l;i++)a.push({name:m,value:s[i]});else if(S.fileapi&&"file"===u.type){t&&t.push(u);var g=u.files;if(g.length)for(i=0;i<g.length;i++)a.push({name:m,value:g[i],type:u.type});else a.push({name:m,value:"",type:u.type})}else null!=s&&(t&&t.push(u),a.push({name:m,value:s,type:u.type,required:u.required}));return e||!p.clk||(m=(d=(f=q(p.clk))[0]).name)&&!d.disabled&&"image"===d.type&&(a.push({name:m,value:f.val()}),a.push({name:m+".x",value:p.clk_x},{name:m+".y",value:p.clk_y})),a},q.fn.formSerialize=function(e){return q.param(this.formToArray(e))},q.fn.fieldSerialize=function(n){var o=[];return this.each(function(){var e=this.name;if(e){var t=q.fieldValue(this,n);if(t&&t.constructor===Array)for(var r=0,a=t.length;r<a;r++)o.push({name:e,value:t[r]});else null!=t&&o.push({name:this.name,value:t})}}),q.param(o)},q.fn.fieldValue=function(e){for(var t=[],r=0,a=this.length;r<a;r++){var n=this[r],o=q.fieldValue(n,e);null==o||o.constructor===Array&&!o.length||(o.constructor===Array?q.merge(t,o):t.push(o))}return t},q.fieldValue=function(e,t){var r=e.name,a=e.type,n=e.tagName.toLowerCase();if(void 0===t&&(t=!0),t&&(!r||e.disabled||"reset"===a||"button"===a||("checkbox"===a||"radio"===a)&&!e.checked||("submit"===a||"image"===a)&&e.form&&e.form.clk!==e||"select"===n&&-1===e.selectedIndex))return null;if("select"!==n)return q(e).val().replace(m,"\r\n");var o=e.selectedIndex;if(o<0)return null;for(var i=[],s=e.options,u="select-one"===a,c=u?o+1:s.length,l=u?o:0;l<c;l++){var f=s[l];if(f.selected&&!f.disabled){var d=(d=f.value)||(f.attributes&&f.attributes.value&&!f.attributes.value.specified?f.text:f.value);if(u)return d;i.push(d)}}return i},q.fn.clearForm=function(e){return this.each(function(){q("input,select,textarea",this).clearFields(e)})},q.fn.clearFields=q.fn.clearInputs=function(r){var a=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var e=this.type,t=this.tagName.toLowerCase();a.test(e)||"textarea"===t?this.value="":"checkbox"===e||"radio"===e?this.checked=!1:"select"===t?this.selectedIndex=-1:"file"===e?/MSIE/.test(navigator.userAgent)?q(this).replaceWith(q(this).clone(!0)):q(this).val(""):r&&(!0===r&&/hidden/.test(e)||"string"==typeof r&&q(this).is(r))&&(this.value="")})},q.fn.resetForm=function(){return this.each(function(){var t=q(this),e=this.tagName.toLowerCase();switch(e){case"input":this.checked=this.defaultChecked;case"textarea":return this.value=this.defaultValue,!0;case"option":case"optgroup":var r=t.parents("select");return r.length&&r[0].multiple?"option"===e?this.selected=this.defaultSelected:t.find("option").resetForm():r.resetForm(),!0;case"select":return t.find("option").each(function(e){if(this.selected=this.defaultSelected,this.defaultSelected&&!t[0].multiple)return t[0].selectedIndex=e,!1}),!0;case"label":var a=q(t.attr("for")),n=t.find("input,select,textarea");return a[0]&&n.unshift(a[0]),n.resetForm(),!0;case"form":return"function"!=typeof this.reset&&("object"!=typeof this.reset||this.reset.nodeType)||this.reset(),!0;default:return t.find("form,input,label,select,textarea").resetForm(),!0}})},q.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},q.fn.selected=function(r){return void 0===r&&(r=!0),this.each(function(){var e,t=this.t
10535ype;"checkbox"===t||"radio"===t?this.checked=r:"option"===this.tagName.toLowerCase()&&(e=q(this).parent("select"),r&&e[0]&&"select-one"===e[0].type&&e.find("option").selected(!1),this.selected=r)})},q.fn.ajaxSubmit.debug=!1}); 10536 10537; 10538/** 10539* DO NOT EDIT THIS FILE. 10540* See the following change record for more information, 10541* https://www.drupal.org/node/2815083 10542* @preserve 10543**/ 10544 10545(function ($, Drupal) { 10546 Drupal.theme.progressBar = function (id) { 10547 return "<div id=\"".concat(id, "\" class=\"progress\" aria-live=\"polite\">") + '<div class="progress__label"> </div>' + '<div class="progress__track"><div class="progress__bar"></div></div>' + '<div class="progress__percentage"></div>' + '<div class="progress__description"> </div>' + '</div>'; 10548 }; 10549 10550 Drupal.ProgressBar = function (id, updateCallback, method, errorCallback) { 10551 this.id = id; 10552 this.method = method || 'GET'; 10553 this.updateCallback = updateCallback; 10554 this.errorCallback = errorCallback; 10555 this.element = $(Drupal.theme('progressBar', id)); 10556 }; 10557 10558 $.extend(Drupal.ProgressBar.prototype, { 10559 setProgress: function setProgress(percentage, message, label) { 10560 if (percentage >= 0 && percentage <= 100) { 10561 $(this.element).find('div.progress__bar').css('width', "".concat(percentage, "%")); 10562 $(this.element).find('div.progress__percentage').html("".concat(percentage, "%")); 10563 } 10564 10565 $('div.progress__description', this.element).html(message); 10566 $('div.progress__label', this.element).html(label); 10567 10568 if (this.updateCallback) { 10569 this.updateCallback(percentage, message, this); 10570 } 10571 }, 10572 startMonitoring: function startMonitoring(uri, delay) { 10573 this.delay = delay; 10574 this.uri = uri; 10575 this.sendPing(); 10576 }, 10577 stopMonitoring: function stopMonitoring() { 10578 clearTimeout(this.timer); 10579 this.uri = null; 10580 }, 10581 sendPing: function sendPing() { 10582 if (this.timer) { 10583 clearTimeout(this.timer); 10584 } 10585 10586 if (this.uri) { 10587 var pb = this; 10588 var uri = this.uri; 10589 10590 if (uri.indexOf('?') === -1) { 10591 uri += '?'; 10592 } else { 10593 uri += '&'; 10594 } 10595 10596 uri += '_format=json'; 10597 $.ajax({ 10598 type: this.method, 10599 url: uri, 10600 data: '', 10601 dataType: 'json', 10602 success: function success(progress) { 10603 if (progress.status === 0) { 10604 pb.displayError(progress.data); 10605 return; 10606 } 10607 10608 pb.setProgress(progress.percentage, progress.message, progress.label); 10609 pb.timer = setTimeout(function () { 10610 pb.sendPing(); 10611 }, pb.delay); 10612 }, 10613 error: function error(xmlhttp) { 10614 var e = new Drupal.AjaxError(xmlhttp, pb.uri); 10615 pb.displayError("<pre>".concat(e.message, "</pre>")); 10616 } 10617 }); 10618 } 10619 }, 10620 displayError: function displayError(string) { 10621 var error = $('<div class="messages messages--error"></div>').html(string); 10622 $(this.element).before(error).hide(); 10623 10624 if (this.errorCallback) { 10625 this.errorCallback(this); 10626 } 10627 } 10628 }); 10629})(jQuery, Drupal);; 10630/** 10631* DO NOT EDIT THIS FILE. 10632* See the following change record for more information, 10633* https://www.drupal.org/node/2815083 10634* @preserve 10635**/ 10636 10637function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 10638 10639function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 10640 10641function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 10642 10643function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 10644 10645function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 10646 10647function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 10648 10649(function ($, window, Drupal, drupalSettings, _ref) { 10650 var isFocusable = _ref.isFocusable, 10651 tabbable = _ref.tabbable; 10652 Drupal.behaviors.AJAX = { 10653 attach: function attach(context, settings) { 10654 function loadAjaxBehavior(base) { 10655 var elementSettings = settings.ajax[base]; 10656 10657 if (typeof elementSettings.selector === 'undefined') { 10658 elementSettings.selector = "#".concat(base); 10659 } 10660 10661 $(elementSettings.selector).once('drupal-ajax').each(function () { 10662 elementSettings.element = this; 10663 elementSettings.base = base; 10664 Drupal.ajax(elementSettings); 10665 }); 10666 } 10667 10668 Object.keys(settings.ajax || {}
10668).forEach(function (base) { 10669 return loadAjaxBehavior(base); 10670 }); 10671 Drupal.ajax.bindAjaxLinks(document.body); 10672 $('.use-ajax-submit').once('ajax').each(function () { 10673 var elementSettings = {}; 10674 elementSettings.url = $(this.form).attr('action'); 10675 elementSettings.setClick = true; 10676 elementSettings.event = 'click'; 10677 elementSettings.progress = { 10678 type: 'throbber' 10679 }; 10680 elementSettings.base = $(this).attr('id'); 10681 elementSettings.element = this; 10682 Drupal.ajax(elementSettings); 10683 }); 10684 }, 10685 detach: function detach(context, settings, trigger) { 10686 if (trigger === 'unload') { 10687 Drupal.ajax.expired().forEach(function (instance) { 10688 Drupal.ajax.instances[instance.instanceIndex] = null; 10689 }); 10690 } 10691 } 10692 }; 10693 10694 Drupal.AjaxError = function (xmlhttp, uri, customMessage) { 10695 var statusCode; 10696 var statusText; 10697 var responseText; 10698 10699 if (xmlhttp.status) { 10700 statusCode = "\n".concat(Drupal.t('Ocurrió un error de AJAX HTTP.'), "\n").concat(Drupal.t('Código de resultado HTTP: !status', { 10701 '!status': xmlhttp.status 10702 })); 10703 } else { 10704 statusCode = "\n".concat(Drupal.t('Una solicitud AJAX HTTP terminó de modo anormal.')); 10705 } 10706 10707 statusCode += "\n".concat(Drupal.t('Debugging information follows.')); 10708 var pathText = "\n".concat(Drupal.t('Path: !uri', { 10709 '!uri': uri 10710 })); 10711 statusText = ''; 10712 10713 try { 10714 statusText = "\n".concat(Drupal.t('StatusText: !statusText', { 10715 '!statusText': $.trim(xmlhttp.statusText) 10716 })); 10717 } catch (e) {} 10718 10719 responseText = ''; 10720 10721 try { 10722 responseText = "\n".concat(Drupal.t('ResponseText: !responseText', { 10723 '!responseText': $.trim(xmlhttp.responseText) 10724 })); 10725 } catch (e) {} 10726 10727 responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, ''); 10728 responseText = responseText.replace(/[\n]+\s+/g, '\n'); 10729 var readyStateText = xmlhttp.status === 0 ? "\n".concat(Drupal.t('ReadyState: !readyState', { 10730 '!readyState': xmlhttp.readyState 10731 })) : ''; 10732 customMessage = customMessage ? "\n".concat(Drupal.t('CustomMessage: !customMessage', { 10733 '!customMessage': customMessage 10734 })) : ''; 10735 this.message = statusCode + pathText + statusText + customMessage + responseText + readyStateText; 10736 this.name = 'AjaxError'; 10737 }; 10738 10739 Drupal.AjaxError.prototype = new Error(); 10740 Drupal.AjaxError.prototype.constructor = Drupal.AjaxError; 10741 10742 Drupal.ajax = function (settings) { 10743 if (arguments.length !== 1) { 10744 throw new Error('Drupal.ajax() function must be called with one configuration object only'); 10745 } 10746 10747 var base = settings.base || false; 10748 var element = settings.element || false; 10749 delete settings.base; 10750 delete settings.element; 10751 10752 if (!settings.progress && !element) { 10753 settings.progress = false; 10754 } 10755 10756 var ajax = new Drupal.Ajax(base, element, settings); 10757 ajax.instanceIndex = Drupal.ajax.instances.length; 10758 Drupal.ajax.instances.push(ajax); 10759 return ajax; 10760 }; 10761 10762 Drupal.ajax.instances = []; 10763 10764 Drupal.ajax.expired = function () { 10765 return Drupal.ajax.instances.filter(function (instance) { 10766 return instance && instance.element !== false && !document.body.contains(instance.element); 10767 }); 10768 }; 10769 10770 Drupal.ajax.bindAjaxLinks = function (element) { 10771 $(element).find('.use-ajax').once('ajax').each(function (i, ajaxLink) { 10772 var $linkElement = $(ajaxLink); 10773 var elementSettings = { 10774 progress: { 10775 type: 'throbber' 10776 }, 10777 dialogType: $linkElement.data('dialog-type'), 10778 dialog: $linkElement.data('dialog-options'), 10779 dialogRenderer: $linkElement.data('dialog-renderer'), 10780 base: $linkElement.attr('id'), 10781 element: ajaxLink 10782 }; 10783 var href = $linkElement.attr('href'); 10784 10785 if (href) { 10786 elementSettings.url = href; 10787 elementSettings.event = 'click'; 10788 } 10789 10790 Drupal.ajax(elementSettings); 10791 }); 10792 }; 10793 10794 Drupal.Ajax = function (base, element, elementSettings) { 10795 var defaults = { 10796 event: element ? 'mousedown' : null, 10797 keypress: true,
10798 selector: base ? "#".concat(base) : null, 10799 effect: 'none', 10800 speed: 'none', 10801 method: 'replaceWith', 10802 progress: { 10803 type: 'throbber', 10804 message: Drupal.t('Espere...') 10805 }, 10806 submit: { 10807 js: true 10808 } 10809 }; 10810 $.extend(this, defaults, elementSettings); 10811 this.commands = new Drupal.AjaxCommands(); 10812 this.instanceIndex = false; 10813 10814 if (this.wrapper) { 10815 this.wrapper = "#".concat(this.wrapper); 10816 } 10817 10818 this.element = element; 10819 this.element_settings = elementSettings; 10820 this.elementSettings = elementSettings; 10821 10822 if (this.element && this.element.form) { 10823 this.$form = $(this.element.form); 10824 } 10825 10826 if (!this.url) { 10827 var $element = $(this.element); 10828 10829 if ($element.is('a')) { 10830 this.url = $element.attr('href'); 10831 } else if (this.element && element.form) { 10832 this.url = this.$form.attr('action'); 10833 } 10834 } 10835 10836 var originalUrl = this.url; 10837 this.url = this.url.replace(/\/nojs(\/|$|\?|#)/, '/ajax$1'); 10838 10839 if (drupalSettings.ajaxTrustedUrl[originalUrl]) { 10840 drupalSettings.ajaxTrustedUrl[this.url] = true; 10841 } 10842 10843 var ajax = this; 10844 ajax.options = { 10845 url: ajax.url, 10846 data: ajax.submit, 10847 beforeSerialize: function beforeSerialize(elementSettings, options) { 10848 return ajax.beforeSerialize(elementSettings, options); 10849 }, 10850 beforeSubmit: function beforeSubmit(formValues, elementSettings, options) { 10851 ajax.ajaxing = true; 10852 return ajax.beforeSubmit(formValues, elementSettings, options); 10853 }, 10854 beforeSend: function beforeSend(xmlhttprequest, options) { 10855 ajax.ajaxing = true; 10856 return ajax.beforeSend(xmlhttprequest, options); 10857 }, 10858 success: function success(response, status, xmlhttprequest) { 10859 if (typeof response === 'string') { 10860 response = $.parseJSON(response); 10861 } 10862 10863 if (response !== null && !drupalSettings.ajaxTrustedUrl[ajax.url]) { 10864 if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') { 10865 var customMessage = Drupal.t('La respuesta falló la verificación, asà que no será procesada.'); 10866 return ajax.error(xmlhttprequest, ajax.url, customMessage); 10867 } 10868 } 10869 10870 return ajax.success(response, status); 10871 }, 10872 complete: function complete(xmlhttprequest, status) { 10873 ajax.ajaxing = false; 10874 10875 if (status === 'error' || status === 'parsererror') { 10876 return ajax.error(xmlhttprequest, ajax.url); 10877 } 10878 }, 10879 dataType: 'json', 10880 jsonp: false, 10881 type: 'POST' 10882 }; 10883 10884 if (elementSettings.dialog) { 10885 ajax.options.data.dialogOptions = elementSettings.dialog; 10886 } 10887 10888 if (ajax.options.url.indexOf('?') === -1) { 10889 ajax.options.url += '?'; 10890 } else { 10891 ajax.options.url += '&'; 10892 } 10893 10894 var wrapper = "drupal_".concat(elementSettings.dialogType || 'ajax'); 10895 10896 if (elementSettings.dialogRenderer) { 10897 wrapper += ".".concat(elementSettings.dialogRenderer); 10898 } 10899 10900 ajax.options.url += "".concat(Drupal.ajax.WRAPPER_FORMAT, "=").concat(wrapper); 10901 $(ajax.element).on(elementSettings.event, function (event) { 10902 if (!drupalSettings.ajaxTrustedUrl[ajax.url] && !Drupal.url.isLocal(ajax.url)) { 10903 throw new Error(Drupal.t('El URL de callback no es local y no es confiable: !url', { 10904 '!url': ajax.url 10905 })); 10906 } 10907 10908 return ajax.eventResponse(this, event); 10909 }); 10910 10911 if (elementSettings.keypress) { 10912 $(ajax.element).on('keypress', function (event) { 10913 return ajax.keypressResponse(this, event); 10914 }); 10915 } 10916 10917 if (elementSettings.prevent) { 10918 $(ajax.element).on(elementSettings.prevent, false); 10919 } 10920 }; 10921 10922 Drupal.ajax.WRAPPER_FORMAT = '_wrapper_format'; 10923 Drupal.Ajax.AJAX_REQUEST_PARAMETER = '_drupal_ajax'; 10924 10925 Drupal.Ajax.prototype.execute = function () { 10926 if (this.ajaxing) { 10927 return; 10928 } 10929 10930 try { 10931 this.beforeSerialize(this.element, this.options); 10932 return $.ajax(this.options); 10933 } catch (e) { 10934 this.ajaxing = false; 10935 window.alert("An error occurred while attempting to process ".concat(this.options.url, ": ").concat(e.message)); 10936 return $.Deferred().reject(); 10937 } 10938 }; 10939 10940 Drupal.Ajax.prototype.keypressResponse = function (element, event) { 10941 var ajax = this; 10942 10943 if (event.which === 13 || event.which === 32 && element.type !== 'text' && element.type !== 'textarea' && element.type !== 'tel' && element.type !== 'number') { 10944 event.preventDefault(); 10945 event.stopPropagation(); 10946 $(element).trigger(ajax.elementSettings.event); 10947 } 10948 }; 10949 10950 Drupal.Ajax.prototype.eventResponse = function (element, event) { 10951 event.preventDefault(); 10952 event.stopPropagation(); 10953 var ajax = this; 10954 10955 if (ajax.ajaxing) { 10956 return; 10957 } 10958 10959 try { 10960 if (ajax.$form) { 10961 if (ajax.setClick) { 10962 element.form.clk = element; 10963 } 10964 10965 ajax.$form.ajaxSubmit(ajax.options); 10966 } else { 10967 ajax.beforeSerialize(ajax.element, ajax.options); 10968 $.ajax(ajax.options); 10969 } 10970 } catch (e) { 10971 ajax.ajaxing = false;
10972 window.alert("An error occurred while attempting to process ".concat(ajax.options.url, ": ").concat(e.message)); 10973 } 10974 }; 10975 10976 Drupal.Ajax.prototype.beforeSerialize = function (element, options) { 10977 if (this.$form && document.body.contains(this.$form.get(0))) { 10978 var settings = this.settings || drupalSettings; 10979 Drupal.detachBehaviors(this.$form.get(0), settings, 'serialize'); 10980 } 10981 10982 options.data[Drupal.Ajax.AJAX_REQUEST_PARAMETER] = 1; 10983 var pageState = drupalSettings.ajaxPageState; 10984 options.data['ajax_page_state[theme]'] = pageState.theme; 10985 options.data['ajax_page_state[theme_token]'] = pageState.theme_token; 10986 options.data['ajax_page_state[libraries]'] = pageState.libraries; 10987 }; 10988 10989 Drupal.Ajax.prototype.beforeSubmit = function (formValues, element, options) {}; 10990 10991 Drupal.Ajax.prototype.beforeSend = function (xmlhttprequest, options) { 10992 if (this.$form) { 10993 options.extraData = options.extraData || {}; 10994 options.extraData.ajax_iframe_upload = '1'; 10995 var v = $.fieldValue(this.element); 10996 10997 if (v !== null) { 10998 options.extraData[this.element.name] = v; 10999 } 11000 } 11001 11002 $(this.element).prop('disabled', true); 11003 11004 if (!this.progress || !this.progress.type) { 11005 return; 11006 } 11007 11008 var progressIndicatorMethod = "setProgressIndicator".concat(this.progress.type.slice(0, 1).toUpperCase()).concat(this.progress.type.slice(1).toLowerCase()); 11009 11010 if (progressIndicatorMethod in this && typeof this[progressIndicatorMethod] === 'function') { 11011 this[progressIndicatorMethod].call(this); 11012 } 11013 }; 11014 11015 Drupal.theme.ajaxProgressThrobber = function (message) { 11016 var messageMarkup = typeof message === 'string' ? Drupal.theme('ajaxProgressMessage', message) : ''; 11017 var throbber = '<div class="throbber"> </div>'; 11018 return "<div class=\"ajax-progress ajax-progress-throbber\">".concat(throbber).concat(messageMarkup, "</div>"); 11019 }; 11020 11021 Drupal.theme.ajaxProgressIndicatorFullscreen = function () { 11022 return '<div class="ajax-progress ajax-progress-fullscreen"> </div>'; 11023 }; 11024 11025 Drupal.theme.ajaxProgressMessage = function (message) { 11026 return "<div class=\"message\">".concat(message, "</div>"); 11027 }; 11028 11029 Drupal.theme.ajaxProgressBar = function ($element) { 11030 return $('<div class="ajax-progress ajax-progress-bar"></div>').append($element); 11031 }; 11032 11033 Drupal.Ajax.prototype.setProgressIndicatorBar = function () { 11034 var progressBar = new Drupal.ProgressBar("ajax-progress-".concat(this.element.id), $.noop, this.progress.method, $.noop); 11035 11036 if (this.progress.message) { 11037 progressBar.setProgress(-1, this.progress.message); 11038 } 11039 11040 if (this.progress.url) { 11041 progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500); 11042 } 11043 11044 this.progress.element = $(Drupal.theme('ajaxProgressBar', progressBar.element)); 11045 this.progress.object = progressBar; 11046 $(this.element).after(this.progress.element); 11047 }; 11048 11049 Drupal.Ajax.prototype.setProgressIndicatorThrobber = function () { 11050 this.progress.element = $(Drupal.theme('ajaxProgressThrobber', this.progress.message)); 11051 $(this.element).after(this.progress.element); 11052 }; 11053 11054 Drupal.Ajax.prototype.setProgressIndicatorFullscreen = function () { 11055 this.progress.element = $(Drupal.theme('ajaxProgressIndicatorFullscreen')); 11056 $('body').append(this.progress.element); 11057 }; 11058 11059 Drupal.Ajax.prototype.success = function (response, status) { 11060 var _this = this; 11061 11062 if (this.progress.element) { 11063 $(this.progress.element).remove(); 11064 } 11065 11066 if (this.progress.object) { 11067 this.progress.object.stopMonitoring(); 11068 } 11069 11070 $(this.element).prop('disabled', false); 11071 var elementParents = $(this.element).parents('[data-drupal-selector]').addBack().toArray(); 11072 var focusChanged = false; 11073 Object.keys(response || {}).forEach(function (i) { 11074 if (response[i].command && _this.commands[response[i].command]) { 11075 _this.commands[response[i].command](_this, response[i], status); 11076 11077 if (response[i].command === 'invoke' && response[i].method === 'focus' || response[i].command === 'focusFirst') { 11078 focusChanged = true; 11079 } 11080 } 11081 }); 11082 11083 if (!focusChanged && this.element && !$(this.element).data('disable-refocus')) { 11084 var target = false;
11085 11086 for (var n = elementParents.length - 1; !target && n >= 0; n--) { 11087 target = document.querySelector("[data-drupal-selector=\"".concat(elementParents[n].getAttribute('data-drupal-selector'), "\"]")); 11088 } 11089 11090 if (target) { 11091 $(target).trigger('focus'); 11092 } 11093 } 11094 11095 if (this.$form && document.body.contains(this.$form.get(0))) { 11096 var settings = this.settings || drupalSettings; 11097 Drupal.attachBehaviors(this.$form.get(0), settings); 11098 } 11099 11100 this.settings = null; 11101 }; 11102 11103 Drupal.Ajax.prototype.getEffect = function (response) { 11104 var type = response.effect || this.effect; 11105 var speed = response.speed || this.speed; 11106 var effect = {}; 11107 11108 if (type === 'none') { 11109 effect.showEffect = 'show'; 11110 effect.hideEffect = 'hide'; 11111 effect.showSpeed = ''; 11112 } else if (type === 'fade') { 11113 effect.showEffect = 'fadeIn'; 11114 effect.hideEffect = 'fadeOut'; 11115 effect.showSpeed = speed; 11116 } else { 11117 effect.showEffect = "".concat(type, "Toggle"); 11118 effect.hideEffect = "".concat(type, "Toggle"); 11119 effect.showSpeed = speed; 11120 } 11121 11122 return effect; 11123 }; 11124 11125 Drupal.Ajax.prototype.error = function (xmlhttprequest, uri, customMessage) { 11126 if (this.progress.element) { 11127 $(this.progress.element).remove(); 11128 } 11129 11130 if (this.progress.object) { 11131 this.progress.object.stopMonitoring(); 11132 } 11133 11134 $(this.wrapper).show(); 11135 $(this.element).prop('disabled', false); 11136 11137 if (this.$form && document.body.contains(this.$form.get(0))) { 11138 var settings = this.settings || drupalSettings; 11139 Drupal.attachBehaviors(this.$form.get(0), settings); 11140 } 11141 11142 throw new Drupal.AjaxError(xmlhttprequest, uri, customMessage); 11143 }; 11144 11145 Drupal.theme.ajaxWrapperNewContent = function ($newContent, ajax, response) { 11146 return (response.effect || ajax.effect) !== 'none' && $newContent.filter(function (i) { 11147 return !($newContent[i].nodeName === '#comment' || $newContent[i].nodeName === '#text' && /^(\s|\n|\r)*$/.test($newContent[i].textContent)); 11148 }).length > 1 ? Drupal.theme('ajaxWrapperMultipleRootElements', $newContent) : $newContent; 11149 }; 11150 11151 Drupal.theme.ajaxWrapperMultipleRootElements = function ($elements) { 11152 return $('<div></div>').append($elements); 11153 }; 11154 11155 Drupal.AjaxCommands = function () {}; 11156 11157 Drupal.AjaxCommands.prototype = { 11158 insert: function insert(ajax, response) { 11159 var $wrapper = response.selector ? $(response.selector) : $(ajax.wrapper); 11160 var method = response.method || ajax.method; 11161 var effect = ajax.getEffect(response); 11162 var settings = response.settings || ajax.settings || drupalSettings; 11163 var $newContent = $($.parseHTML(response.data, document, true)); 11164 $newContent = Drupal.theme('ajaxWrapperNewContent', $newContent, ajax, response); 11165 11166 switch (method) { 11167 case 'html': 11168 case 'replaceWith': 11169 case 'replaceAll': 11170 case 'empty': 11171 case 'remove': 11172 Drupal.detachBehaviors($wrapper.get(0), settings); 11173 break; 11174 11175 default: 11176 break; 11177 } 11178 11179 $wrapper[method]($newContent); 11180 11181 if (effect.showEffect !== 'show') { 11182 $newContent.hide(); 11183 } 11184 11185 var $ajaxNewContent = $newContent.find('.ajax-new-content'); 11186 11187 if ($ajaxNewContent.length) { 11188 $ajaxNewContent.hide(); 11189 $newContent.show(); 11190 $ajaxNewContent[effect.showEffect](effect.showSpeed); 11191 } else if (effect.showEffect !== 'show') { 11192 $newContent[effect.showEffect](effect.showSpeed); 11193 } 11194 11195 if ($newContent.parents('html').length) { 11196 $newContent.each(function (index, element) { 11197 if (element.nodeType === Node.ELEMENT_NODE) { 11198 Drupal.attachBehaviors(element, settings); 11199 } 11200 }); 11201 } 11202 }, 11203 remove: function remove(ajax, response, status) { 11204 var settings = response.settings || ajax.settings || drupalSettings; 11205 $(response.selector).each(function () { 11206 Drupal.detachBehaviors(this, settings); 11207 }).remove(); 11208 }, 11209 changed: function changed(ajax, response, status) { 11210 var $element = $(response.selector); 11211 11212 if (!$element.hasClass('ajax-changed')) { 11213 $element.addClass('ajax-changed'); 11214 11215 if (response.asterisk) { 11216 $element.find(response.asterisk).append(" <abbr class=\"ajax-changed\" title=\"".concat(Drupal.t('Changed'), "\">*<\/abbr> ")); 11217 } 11218 } 11219 }, 11220 alert: function alert(ajax, response, status) { 11221 window.alert(response.text); 11222 }, 11223 announce: function announce(ajax, response) { 11224 if (response.priority) { 11225 Drupal.announce(response.text, response.priority); 11226 } else { 11227 Drupal.announce(response.text); 11228 } 11229 }, 11230 redirect: function redirect(ajax, response, status) { 11231 window.location = response.url; 11232 }, 11233 css: function css(ajax, response, status) { 11234 $(response.selector).css(response.argument); 11235 }, 11236 settings: function settings(ajax, response, status) { 11237 var ajaxSettings = drupalSettings.ajax; 11238 11239 if (ajaxSettings) {
11240 Drupal.ajax.expired().forEach(function (instance) { 11241 if (instance.selector) { 11242 var selector = instance.selector.replace('#', ''); 11243 11244 if (selector in ajaxSettings) { 11245 delete ajaxSettings[selector]; 11246 } 11247 } 11248 }); 11249 } 11250 11251 if (response.merge) { 11252 $.extend(true, drupalSettings, response.settings); 11253 } else { 11254 ajax.settings = response.settings; 11255 } 11256 }, 11257 data: function data(ajax, response, status) { 11258 $(response.selector).data(response.name, response.value); 11259 }, 11260 focusFirst: function focusFirst(ajax, response, status) { 11261 var focusChanged = false; 11262 var container = document.querySelector(response.selector); 11263 11264 if (container) { 11265 var tabbableElements = tabbable(container); 11266 11267 if (tabbableElements.length) { 11268 tabbableElements[0].focus(); 11269 focusChanged = true; 11270 } else if (isFocusable(container)) { 11271 container.focus(); 11272 focusChanged = true; 11273 } 11274 } 11275 11276 if (ajax.hasOwnProperty('element') && !focusChanged) { 11277 ajax.element.focus(); 11278 } 11279 }, 11280 invoke: function invoke(ajax, response, status) { 11281 var $element = $(response.selector); 11282 $element[response.method].apply($element, _toConsumableArray(response.args)); 11283 }, 11284 restripe: function restripe(ajax, response, status) { 11285 $(response.selector).find('> tbody > tr:visible, > tr:visible').removeClass('odd even').filter(':even').addClass('odd').end().filter(':odd').addClass('even'); 11286 }, 11287 update_build_id: function update_build_id(ajax, response, status) { 11288 $("input[name=\"form_build_id\"][value=\"".concat(response.old, "\"]")).val(response.new); 11289 }, 11290 add_css: function add_css(ajax, response, status) { 11291 $('head').prepend(response.data); 11292 }, 11293 message: function message(ajax, response) { 11294 var messages = new Drupal.Message(document.querySelector(response.messageWrapperQuerySelector)); 11295 11296 if (response.clearPrevious) { 11297 messages.clear(); 11298 } 11299 11300 messages.add(response.message, response.messageOptions); 11301 } 11302 }; 11303})(jQuery, window, Drupal, drupalSettings, window.tabbable);; 11304/** 11305* DO NOT EDIT THIS FILE. 11306* See the following change record for more information, 11307* https://www.drupal.org/node/2815083 11308* @preserve 11309**/ 11310 11311(function (Drupal) { 11312 Drupal.theme.ajaxProgressBar = function ($element) { 11313 return $element.addClass('ajax-progress ajax-progress-bar'); 11314 }; 11315})(Drupal);; 11316/** 11317* DO NOT EDIT THIS FILE. 11318* See the following change record for more information, 11319* https://www.drupal.org/node/2815083 11320* @preserve 11321**/ 11322 11323(function ($, Drupal, drupalSettings) { 11324 Drupal.Views = {}; 11325 11326 Drupal.Views.parseQueryString = function (query) { 11327 var args = {}; 11328 var pos = query.indexOf('?'); 11329 11330 if (pos !== -1) { 11331 query = query.substring(pos + 1); 11332 } 11333 11334 var pair; 11335 var pairs = query.split('&'); 11336 11337 for (var i = 0; i < pairs.length; i++) { 11338 pair = pairs[i].split('='); 11339 11340 if (pair[0] !== 'q' && pair[1]) { 11341 args[decodeURIComponent(pair[0].replace(/\+/g, ' '))] = decodeURIComponent(pair[1].replace(/\+/g, ' ')); 11342 } 11343 } 11344 11345 return args; 11346 }; 11347 11348 Drupal.Views.parseViewArgs = function (href, viewPath) { 11349 var returnObj = {}; 11350 var path = Drupal.Views.getPath(href); 11351 var viewHref = Drupal.url(viewPath).substring(drupalSettings.path.baseUrl.length); 11352 11353 if (viewHref && path.substring(0, viewHref.length + 1) === "".concat(viewHref, "/")) { 11354 returnObj.view_args = decodeURIComponent(path.substring(viewHref.length + 1, path.length)); 11355 returnObj.view_path = path; 11356 } 11357 11358 return returnObj; 11359 }; 11360 11361 Drupal.Views.pathPortion = function (href) { 11362 var protocol = window.location.protocol; 11363 11364 if (href.substring(0, protocol.length) === protocol) { 11365 href = href.substring(href.indexOf('/', protocol.length + 2)); 11366 } 11367 11368 return href; 11369 }; 11370 11371 Drupal.Views.getPath = function (href) { 11372 href = Drupal.Views.pathPortion(href); 11373 href = href.substring(drupalSettings.path.baseUrl.length, href.length); 11374 11375 if (href.substring(0, 3) === '?q=') { 11376 href = href.substring(3, href.length); 11377 } 11378 11379 var chars = ['#', '?', '&']; 11380 11381 for (var i = 0; i < chars.length; i++) { 11382 if (href.indexOf(chars[i]) > -1) { 11383 href = href.substr(0, href.indexOf(chars[i])); 11384 } 11385 } 11386 11387 return href; 11388 }; 11389})(jQuery, Drupal, drupalSettings);;
11390/** 11391* DO NOT EDIT THIS FILE. 11392* See the following change record for more information, 11393* https://www.drupal.org/node/2815083 11394* @preserve 11395**/ 11396 11397(function ($, Drupal, drupalSettings) { 11398 Drupal.behaviors.ViewsAjaxView = {}; 11399 11400 Drupal.behaviors.ViewsAjaxView.attach = function (context, settings) { 11401 if (settings && settings.views && settings.views.ajaxViews) { 11402 var ajaxViews = settings.views.ajaxViews; 11403 Object.keys(ajaxViews || {}).forEach(function (i) { 11404 Drupal.views.instances[i] = new Drupal.views.ajaxView(ajaxViews[i]); 11405 }); 11406 } 11407 }; 11408 11409 Drupal.behaviors.ViewsAjaxView.detach = function (context, settings, trigger) { 11410 if (trigger === 'unload') { 11411 if (settings && settings.views && settings.views.ajaxViews) { 11412 var ajaxViews = settings.views.ajaxViews; 11413 Object.keys(ajaxViews || {}).forEach(function (i) { 11414 var selector = ".js-view-dom-id-".concat(ajaxViews[i].view_dom_id); 11415 11416 if ($(selector, context).length) { 11417 delete Drupal.views.instances[i]; 11418 delete settings.views.ajaxViews[i]; 11419 } 11420 }); 11421 } 11422 } 11423 }; 11424 11425 Drupal.views = {}; 11426 Drupal.views.instances = {}; 11427 11428 Drupal.views.ajaxView = function (settings) { 11429 var selector = ".js-view-dom-id-".concat(settings.view_dom_id); 11430 this.$view = $(selector); 11431 var ajaxPath = drupalSettings.views.ajax_path; 11432 11433 if (ajaxPath.constructor.toString().indexOf('Array') !== -1) { 11434 ajaxPath = ajaxPath[0]; 11435 } 11436 11437 var queryString = window.location.search || ''; 11438 11439 if (queryString !== '') { 11440 queryString = queryString.slice(1).replace(/q=[^&]+&?|&?render=[^&]+/, ''); 11441 11442 if (queryString !== '') { 11443 queryString = (/\?/.test(ajaxPath) ? '&' : '?') + queryString; 11444 } 11445 } 11446 11447 this.element_settings = { 11448 url: ajaxPath + queryString, 11449 submit: settings, 11450 setClick: true, 11451 event: 'click', 11452 selector: selector, 11453 progress: { 11454 type: 'fullscreen' 11455 } 11456 }; 11457 this.settings = settings; 11458 this.$exposed_form = $("form#views-exposed-form-".concat(settings.view_name.replace(/_/g, '-'), "-").concat(settings.view_display_id.replace(/_/g, '-'))); 11459 this.$exposed_form.once('exposed-form').each($.proxy(this.attachExposedFormAjax, this)); 11460 this.$view.filter($.proxy(this.filterNestedViews, this)).once('ajax-pager').each($.proxy(this.attachPagerAjax, this)); 11461 var selfSettings = $.extend({}, this.element_settings, { 11462 event: 'RefreshView', 11463 base: this.selector, 11464 element: this.$view.get(0) 11465 }); 11466 this.refreshViewAjax = Drupal.ajax(selfSettings); 11467 }; 11468 11469 Drupal.views.ajaxView.prototype.attachExposedFormAjax = function () { 11470 var that = this; 11471 this.exposedFormAjax = []; 11472 $('input[type=submit], input[type=image]', this.$exposed_form).not('[data-drupal-selector=edit-reset]').each(function (index) { 11473 var selfSettings = $.extend({}, that.element_settings, { 11474 base: $(this).attr('id'), 11475 element: this 11476 }); 11477 that.exposedFormAjax[index] = Drupal.ajax(selfSettings); 11478 }); 11479 }; 11480 11481 Drupal.views.ajaxView.prototype.filterNestedViews = function () { 11482 return !this.$view.parents('.view').length; 11483 }; 11484 11485 Drupal.views.ajaxView.prototype.attachPagerAjax = function () { 11486 this.$view.find('ul.js-pager__items > li > a, th.views-field a, .attachment .views-summary a').each($.proxy(this.attachPagerLinkAjax, this)); 11487 }; 11488 11489 Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function (id, link) { 11490 var $link = $(link); 11491 var viewData = {}; 11492 var href = $link.attr('href'); 11493 $.extend(viewData, this.settings, Drupal.Views.parseQueryString(href), Drupal.Views.parseViewArgs(href, this.settings.view_base_path)); 11494 var selfSettings = $.extend({}, this.element_settings, {
11495 submit: viewData, 11496 base: false, 11497 element: link 11498 }); 11499 this.pagerAjax = Drupal.ajax(selfSettings); 11500 }; 11501 11502 Drupal.AjaxCommands.prototype.viewsScrollTop = function (ajax, response) { 11503 var offset = $(response.selector).offset(); 11504 var scrollTarget = response.selector; 11505 11506 while ($(scrollTarget).scrollTop() === 0 && $(scrollTarget).parent()) { 11507 scrollTarget = $(scrollTarget).parent(); 11508 } 11509 11510 if (offset.top - 10 < $(scrollTarget).scrollTop()) { 11511 $(scrollTarget).animate({ 11512 scrollTop: offset.top - 10 11513 }, 500); 11514 } 11515 }; 11516})(jQuery, Drupal, drupalSettings);; 11517/** 11518* DO NOT EDIT THIS FILE. 11519* See the following change record for more information, 11520* https://www.drupal.org/node/2815083 11521* @preserve 11522**/ 11523 11524Drupal.debounce = function (func, wait, immediate) { 11525 var timeout; 11526 var result; 11527 return function () { 11528 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 11529 args[_key] = arguments[_key]; 11530 } 11531 11532 var context = this; 11533 11534 var later = function later() { 11535 timeout = null; 11536 11537 if (!immediate) { 11538 result = func.apply(context, args); 11539 } 11540 }; 11541 11542 var callNow = immediate && !timeout; 11543 clearTimeout(timeout); 11544 timeout = setTimeout(later, wait); 11545 11546 if (callNow) { 11547 result = func.apply(context, args); 11548 } 11549 11550 return result; 11551 }; 11552};; 11553(function ($, Drupal, debounce) { 11554 "use strict"; 11555 11556 // Cached reference to $(window). 11557 var $window = $(window); 11558 11559 // The threshold for how far to the bottom you should reach before reloading. 11560 var scrollThreshold = 200; 11561 11562 // The selector for the automatic pager. 11563 var automaticPagerSelector = '[data-drupal-views-infinite-scroll-pager="automatic"]'; 11564 11565 // The selector for both manual load and automatic pager. 11566 var pagerSelector = '[data-drupal-views-infinite-scroll-pager]'; 11567 11568 // The selector for the automatic pager. 11569 var contentWrapperSelector = '[data-drupal-views-infinite-scroll-content-wrapper]'; 11570 11571 // The event and namespace that is bound to window for automatic scrolling. 11572 var scrollEvent = 'scroll.views_infinite_scroll'; 11573 11574 /** 11575 * Insert a views infinite scroll view into the document. 11576 * 11577 * @param {jQuery} $newView 11578 * New content detached from the DOM. 11579 */ 11580 $.fn.infiniteScrollInsertView = function ($newView) { 11581 // Extract the view DOM ID from the view classes. 11582 var matches = /(js-view-dom-id-\w+)/.exec(this.attr('class')); 11583 var currentViewId = matches[1].replace('js-view-dom-id-', 'views_dom_id:'); 11584 11585 // Get the existing ajaxViews object. 11586 var view = Drupal.views.instances[currentViewId]; 11587 // Remove once so that the exposed form and pager are processed on 11588 // behavior attach. 11589 view.$view.removeOnce('ajax-pager'); 11590 view.$exposed_form.removeOnce('exposed-form'); 11591 // Make sure infinite scroll can be reinitialized. 11592 var $existingPager = view.$view.find(pagerSelector); 11593 $existingPager.removeOnce('infinite-scroll'); 11594 11595 var $newRows = $newView.find(contentWrapperSelector).children(); 11596 var $newPager = $newView.find(pagerSelector); 11597 11598 // Add the new rows to existing view. 11599 view.$view.find(contentWrapperSelector).append($newRows); 11600 // Replace the pager link with the new link and ajaxPageState values. 11601 $existingPager.replaceWith($newPager); 11602 11603 // Run views and VIS behaviors. 11604 Drupal.attachBehaviors(view.$view[0]); 11605 }; 11606 11607 /** 11608 * Handle the automatic paging based on the scroll amount. 11609 * 11610 * @type {Drupal~behavior} 11611 * 11612 * @prop {Drupal~behaviorAttach} attach 11613 * Initialize infinite scroll pagers and bind the scroll event. 11614 * @prop {Drupal~behaviorDetach} detach 11615 * During `unload` remove the scroll event binding. 11616 */ 11617 Drupal.behaviors.views_infinite_scroll_automatic = { 11618 attach : function(context, settings) { 11619 $(context).find(automaticPagerSelector).once('infinite-scroll').each(function() { 11620 var $pager = $(this); 11621 $pager.addClass('visually-hidden'); 11622 $window.on(scrollEvent, debounce(function() { 11623 if (window.innerHeight + window.pageYOffset > $pager.offset().top - scrollThreshold) { 11624 $pager.find('[rel=next]').click(); 11625 $window.off(scrollEvent); 11626 } 11627 }, 200)); 11628 }); 11629 }, 11630 detach: function (context, settings, trigger) { 11631 // In the case where the view is removed from the document, remove it's 11632 // events. This is important in the case a view being refreshed for a reason 11633 // other than a scroll. AJAX filters are a good example of the event needing 11634 // to be destroyed earlier than above. 11635 if (trigger === 'unload') { 11636 if ($(context).find(automaticPagerSelector).removeOnce('infinite-scroll').length) { 11637 $window.off(scrollEvent); 11638 } 11639 } 11640 } 11641 }; 11642 11643})(jQuery, Drupal, Drupal.debounce); 11644; 11645/** 11646* DO NOT EDIT THIS FILE. 11647* See the following change record for more information, 11648* https://www.drupal.org/node/2815083 11649* @preserve 11650**/ 11651 11652(function ($, Drupal, drupalSettings) { 11653 $(document).ready(function () { 11654 $.ajax({ 11655 type: 'POST', 11656 cache: false, 11657 url: drupalSettings.statistics.url, 11658 data: drupalSettings.statistics.data 11659 }); 11660 }); 11661})(jQuery, Drupal, drupalSettings);;
11662/** 11663 * @file 11664 * Adds the active class to active links, for proper top bar rendering. 11665 * 11666 */ 11667(function ($, Drupal) { 11668 11669 /** 11670 * Adds the "active" class to top bar <li> elements with active child links. 11671 */ 11672 Drupal.behaviors.foundationTopBarActive = { 11673 attach: function (context, settings) { 11674 var $active_links = $(context).find('.top-bar .menu-item > a.is-active'); 11675 if ($active_links.length) { 11676 $active_links.once('foundationTopBarActive').each(function() { 11677 $(this).parent().addClass('active'); 11678 }); 11679 } 11680 } 11681 }; 11682 11683})(jQuery, Drupal); 11684;
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.