1/******************* 2HELPER FUNCTIONS 3******************** 4/* 5check for valid email 6*/ 7function isValidEmail(emailAddress) { 8 atPos = emailAddress.indexOf("@"); 9 dotPos = emailAddress.indexOf(".", atPos); 10 spacePos = emailAddress.indexOf(" "); 11 if (emailAddress.length > 0 && atPos > 0 && dotPos > atPos && spacePos == -1) { 12 return true; 13 } 14 return false; 15} 16 17/* 18windowsize should match css for hiding at lg @992px 19*/ function isSiteSmall() { 20 if (window.matchMedia("(max-width: 992px)").matches) { 21 return true; 22 } 23 return false; 24} 25 26/* 27mobile detect 28*/ function mobileDetect() { 29 var check = false; 30 (function(a) { 31 if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; 32 })(navigator.userAgent || navigator.vendor || window.opera); 33 return check; 34} 35 36/* 37debounce for perfomance (function, wait, immediate) 38*/ function debounce(func, wait, immediate) { 39 var timeout; 40 return function() { 41 var context = this, args = arguments; 42 var later = function() { 43 timeout = null; 44 if (!immediate) func.apply(context, args); 45 }; 46 var callNow = immediate && !timeout; 47 clearTimeout(timeout); 48 timeout = setTimeout(later, wait); 49 if (callNow) func.apply(context, args); 50 }; 51} 52 53/* 54throttle for perfomance (function, wait, options) 55*/ 56function throttle(func, wait, options) { 57 var context, args, result; 58 var timeout = null; 59 var previous = 0; 60 if (!options) options = {}; 61 var later = function() { 62 previous = options.leading === false ? 0 : Date.now(); 63 timeout = null; 64 result = func.apply(context, args); 65 if (!timeout) context = args = null; 66 }; 67 return function() { 68 var now = Date.now(); 69 if (!previous && options.leading === false) previous = now; 70 var remaining = wait - (now - previous); 71 context = this; 72 args = arguments; 73 if (remaining <= 0 || remaining > wait) { 74 if (timeout) { 75 clearTimeout(timeout); 76 timeout = null; 77 } 78 previous = now; 79 result = func.apply(context, args); 80 if (!timeout) context = args = null; 81 } else if (!timeout && options.trailing !== false) { 82 timeout = setTimeout(later, remaining); 83 } 84 return result; 85 }; 86} 87 88/* 89touch detect 90*/ 91function touchDetect() { 92 var prefixes = " -webkit- -moz- -o- -ms- ".split(" "); 93 var mq = function(query) { 94 return window.matchMedia(query).matches; 95 }; 96 if ("ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch) { 97 return true; 98 } 99 var query = [ "(", prefixes.join("touch-enabled),("), "heartz", ")" ].join("");
100 return mq(query); 101} 102 103/******************* 104INIT FUNCTIONS 105********************/ 106/* 107responsive third party vids - uses fitvids from plugins.js 108*/ function responsiveVideo() { 109 $("#content, .content-section").fitVids({ 110 ignore: "#video-player, .div-embed, .vimeoWrapper, .embed-responsive, .plyr__player, #plyr__player_event", 111 customSelector: "iframe[src*='/Clients/player/videoembed.php']" 112 }); 113} 114 115/* 116lightbox defaults - uses lightgallery from plugins.js 117*/ function lightgallery() { 118 //default thickbox 119 $(".thickbox").lightGallery({ 120 iframe: true, 121 selector: "this", 122 width: "640px", 123 height: "500px", 124 counter: false, 125 download: false, 126 share: false, 127 rotate: false, 128 hash: false, 129 zoom: false, 130 pager: false, 131 fullScreen: false, 132 addClass: "lightGallery-thickbox" 133 }); 134 //photo gallery 135 $(".insert-gallery").each((function() { 136 var galleryID = $(this).attr("id"); 137 $("#" + galleryID).lightGallery({ 138 thumbnail: false, 139 counter: false, 140 download: false, 141 share: false, 142 rotate: false, 143 hash: false, 144 zoom: false, 145 pager: false, 146 fullScreen: false 147 }); 148 })); 149} 150 151/* 152pretty selectmenus - uses jqueryui from plugins.js 153*/ function sorters($sorter) { 154 var changeSelectMenu = function(event, item) { 155 $(this).trigger("change", item); 156 }; 157 //ui-front moves menu from appending to body to parent element 158 if ($sorter.parents(".monkForm").length) { 159 $sorter.parent().addClass("ui-front position-relative"); 160 } 161 $sorter.selectmenu({ 162 width: false, 163 style: "dropdown", 164 icons: { 165 button: "icon" 166 }, 167 change: changeSelectMenu 168 }); 169} 170 171/* 172add sticky 173*/ function addSticky() { 174 var stickyToggle = function(sticky, stickyWrapper, scrollElement) { 175 var stickyHeight = sticky.outerHeight(); 176 if (sticky.attr("id") === "header") { 177 var stickyTop = stickyWrapper.offset().top + 1; 178 } else { 179 var stickyTop = stickyWrapper.offset().top; 180 } 181 if (scrollElement.scrollTop() >= stickyTop) { 182 stickyWrapper.height(stickyHeight); 183 sticky.addClass("is-sticky"); 184 if (document.getElementById("billboard")) { 185 var billboardTop = document.getElementById("billboard").getBoundingClientRect().top + document.getElementById("billboard").clientHeight; 186 if (billboardTop <= 100) { 187 sticky.addClass("hide-steeple"); 188 } else { 189 sticky.removeClass("hide-steeple"); 190 } 191 } else { 192 sticky.addClass("hide-steeple"); 193 } 194 195 } else { 196 sticky.removeClass("hide-steeple"); 197 sticky.removeClass("is-sticky"); 198 stickyWrapper.height(""); 199 } 200 }; 201 $('[data-toggle="sticky-onscroll"]').each((function() { 202 var sticky = $(this); 203 var stickyWrapper = $("<div>").addClass("sticky-wrapper"); 204 // insert hidden element to maintain actual top offset on page 205 if (sticky.attr("id") === "header") { 206 stickyWrapper.addClass("is-stickyheader"); 207 } else if (sticky.attr("id") === "stickysub") { 208 stickyWrapper.addClass("is-stickysub"); 209 } 210 sticky.before(stickyWrapper); 211 sticky.addClass("sticky"); 212 // Scroll & resize events 213 $(window).on("scroll.sticky-onscroll resize.sticky-onscroll", (function() { 214 stickyToggle(sticky, stickyWrapper, $(this)); 215 })); 216 // On page load 217 stickyToggle(sticky, stickyWrapper, $(window)); 218 })); 219 $("body").on("click", ".scrollto", (function(event) { 220 var pageLoc = $(this).attr("href"); 221 $("html, body").stop().animate({ 222 scrollTop: $(pageLoc).offset().top 223 }, 550); 224 return false; 225 })); 226} 227 228/* 229jarallax plugin - uses jarallax from plugins.js 230*/ function jarallax() { 231 objectFitImages(); 232 //ofi extension 233 $(".jarallax").jarallax({ 234 coverImage: true, 235 clipContainer: true 236 }); 237} 238 239/* 240slick plugin - uses jqueryui from plugins.js 241*/ function slick() { 242 //load slick video via ajax 243 $("body").on("click", ".slick-video", (function(event) { 244 event.preventDefault(); 245 var $this = $(this), mediaTitle = $this.data("title"), mediaType = $this.data("type"), mediaSRC = $this.data("src"), mediaImg = encodeURIComponent($this.data("image")), mediaExt = ""; 246 if (mediaType == "file") { 247 var mediaExt = mediaSRC.substr(mediaSRC.lastIndexOf(".") + 1).toLowerCase(); 248 } 249 $this.parents(".slick-widget").slick("slickPause"); 250 $.ajax({
251 url: "/_components/ajax/ajax-rotator-media.php", 252 type: "GET", 253 data: { 254 title: mediaTitle, 255 type: mediaType, 256 src: mediaSRC, 257 image: mediaImg, 258 ext: mediaExt 259 }, 260 success: function(results) { 261 $this.parents(".slick-slide").addClass("playing").prepend(results); 262 $this.parents(".slick-slider").find(".slick-dots").hide(); 263 }, 264 error: function(results, textStatus, jqXHR) { 265 //add error messages as needed console.log(jqXHR.responseText); 266 } 267 }); 268 })); 269 //after slide change remove any playing video 270 $(".slick-widget").on("afterChange", (function(event, slick, currentSlide) { 271 var $thisSlick = $(this); 272 $thisSlick.find(".slide").removeClass("first last"); 273 $thisSlick.find(".slick-active").first().addClass("first"); 274 $thisSlick.find(".slick-active").last().addClass("last"); 275 if ($thisSlick.find(".slick-slide.playing").length) { 276 $thisSlick.find(".video").remove(); 277 $thisSlick.find(".slick-slide").removeClass("playing"); 278 $thisSlick.find(".slick-dots").show(); 279 $thisSlick.slick("slickPlay"); 280 } 281 })); 282 $(".slick-widget").each((function() { 283 $slick = $(this); 284 //slick settings via data tags 285 var slickData = $slick.data(); 286 var howmany = slickData.howmany ? parseInt(slickData.howmany) : 1; 287 var dots = slickData.dots ? true : false; 288 var arrows = slickData.arrows; 289 var autoplay = slickData.timeout ? true : false; 290 var autoplaySpeed = slickData.timeout ? parseInt(slickData.timeout) : false; 291 var vertical = slickData.vertical ? true : false; 292 var fade = slickData.fade ? true : false; 293 var eqheight = slickData.eqheight ? true : false; 294 var infinite = slickData.infinite ? true : false; 295 var howmanyMobile = 1; 296 if (vertical) { 297 howmanyMobile = howmany; 298 } else if (fade) { 299 howmany = 1; 300 } 301 //console.log($slick); 302 //buttons need to be outside slick container to run flush on the sides 303 $slick.on("init", (function(event, slick) {})); 304 //keep slides the same height = largest slide 305 $slick.on("setPosition", (function(slick) { 306 if (eqheight) { 307 $slick.find(".slick-slide, .slide").height("auto"); 308 var slickTrack = $slick.find(".slick-track"); 309 var slickTrackHeight = $(slickTrack).height(); 310 $slick.find(".slick-slide, .slide").css("height", slickTrackHeight + "px"); 311 } 312 })); 313 //slick init and settings 314 $slick.slick({ 315 vertical: false, 316 initialSlide: 0, 317 slidesToShow: howmany, 318 slidesToScroll: 1, 319 infinite: infinite, 320 speed: 500, 321 arrows: arrows, 322 dots: dots, 323 fade: fade, 324 autoplay: autoplay, 325 autoplaySpeed: autoplaySpeed, 326 pauseOnHover: false, 327 swipeToSlide: true, 328 touchThreshold: 20, 329 prevArrow: '<button type="button" class="slick-prev"><span></span></button>', 330 nextArrow: '<button type="button" class="slick-next"><span></span></button>', 331 responsive: [ { 332 //match css break for lg 333 breakpoint: 992, 334 settings: { 335 vertical: vertical, 336 initialSlide: 0, 337 slidesToShow: howmanyMobile, 338 slidesToScroll: 1, 339 infinite: infinite 340 } 341 } ] 342 }); 343 })); 344} 345 346/* 347header 348*/ function header() { 349 //countdown 350 if ($("#countdown-header").length) { 351 $countdown = $("#countdown-header"); 352 window.$countdown = $countdown; 353 $.getScript("/_assets/js/monk/helpers/countdown.js").done((function(script, textStatus) {})).fail((function(jqxhr, settings, exception) { 354 //console.log('error'); 355 })); 356 } 357 //alerts 358 $(".toggle-alerts").on("click", (function(event) { 359 event.preventDefault(); 360 $(".toggle-alerts-bar").slideToggle(); 361 $(".toggle-alerts .fa").toggleClass("fa-times fa-exclamation-circle"); 362 //hide search 363 $("body").removeClass("show-search"); 364 //hide nav 365 $("body").removeClass("show-navigation"); 366 })); 367 //search 368 $(".toggle-search").on("click", (function(event) { 369 event.preventDefault(); 370 //hide alerts 371 $(".toggle-alerts-bar").slideUp(); 372 $(".toggle-alerts .fa").removeClass("fa-times").addClass("fa-exclamation-circle"); 373 //hide nav 374 $("body").removeClass("show-navigation"); 375 //show search 376 $("body").toggleClass("show-search"); 377 })); 378 //navigation 379 $(".toggle-navigation").on("click", (function(event) { 380 event.preventDefault(); 381 //hide alerts 382 $(".toggle-alerts-bar").slideUp(); 383 $(".toggle-alerts .fa").removeClass("fa-times").addClass("fa-exclamation-circle"); 384 //hide search 385 $("body").removeClass("show-search"); 386 //toggle nav 387 $("body").toggleClass("show-navigation"); 388 })); 389 $("#nav li a").each((function() { 390 if ($(this).parent().children("ul").length) { 391 $(this).parent().addClass("dropdown"); 392 var mnhref = $(this).attr("href"); 393 $(this).append("<span><i></i></span>"); 394 if (mnhref == "" || mnhref == "#") { 395 $(this).addClass("open"); 396 } else { 397 $(this).find("span").addClass("open"); 398 } 399 } 400 })); 401 $("#nav li.dropdown .open").on("click", (function(event) { 402 var current = $(this).closest("li").first(); 403 current.siblings(".active").find("ul").first().slideUp(); 404 current.siblings(".active").removeClass("active"); 405 current.toggleClass("active"); 406 current.find("ul").first().slideToggle(); 407 event.preventDefault(); 408 })); 409 //header movement/nav height w/billboard 410 headerAdj(); 411 window.addEventListener("resize", debounce((function() { 412 headerAdj(); 413 }), 250)); 414} 415 416function headerAdj() { 417 var hHeight = $("#header").outerHeight(), vpHeight = window.innerHeight, adjHeight = vpHeight - hHeight; 418 if ($("#top-bar").length) { 419 var tbHeight = $("#top-bar").outerHeight(); 420 adjHeight -= tbHeight; 421 } 422 $("nav#navigation").css({ 423 height: adjHeight + "px" 424 }); 425} 426 427/* 428subnav for sidebar navigation 429*/ function subnav($subnav) { 430 $("#subnav > li > ul li a").each((function() { 431 if ($(this).parent().children("ul").length) { 432 $(this).parent().addClass("dropdown"); 433 var mnhref = $(this).attr("href"); 434 $(this).prepend("<span><i></i></span>"); 435 if (mnhref == "" || mnhref == "#") { 436 $(this).addClass("open"); 437 } else { 438 $(this).find("span").addClass("open"); 439 } 440 } 441 })); 442 $("#subnav li.dropdown .open").on("click", (function(event) { 443 var current = $(this).closest("li").first(); 444 current.siblings(".active").find("ul").first().slideUp(); 445 current.siblings(".active").removeClass("active"); 446 current.toggleClass("active"); 447 current.find("ul").first().slideToggle(); 448 event.preventDefault(); 449 })); 450 //for second level pages open up 451 $("#subnav > li > ul > li.current").find(".open").first().trigger("click"); 452} 453 454/* 455marco polo 456*/ function predictiveSearch() { 457 $(".search-predictive").each((function() { 458 $searchInput = $(".search-predictive"); 459 $searchInput.marcoPolo({
460 url: "/_components/ajax/ajax-search-predictive.php", 461 formatItem: function(data, $item) { 462 var title = data.title, type = data.type; 463 $item.attr("title", title); 464 return "<div class='title'>" + title + "</div><div class='type'>" + type + "</div>"; 465 }, 466 onRequestBefore: function(data) { 467 $(".mp_list").removeClass("hasMore").show().html('<li class="searching"><span style="font-style:italic;">Searching...</span></li>'); 468 }, 469 onResults: function(data) { 470 if (data.length >= 7) { 471 $(".mp_list").addClass("hasMore"); 472 $(".mp_list li:last-child").addClass("mp_show_more"); 473 } 474 }, 475 onSelect: function(data, $item) { 476 var title = data.title; 477 $searchInput.val(title); 478 window.location = data.url; 479 } 480 }); 481 })); 482} 483 484/* 485Billboard adjustments 486*/ function billboard() { 487 if(!$('#billboard').length){ 488 $('#header').addClass('no-billboard'); 489 }else{ 490 if($('#content').length){ 491 var bgColor = $('body').css('backgroundColor'); 492 493 } 494 else if($('.content-section').first().length){ 495 var bgColor = $('.content-section').first().find('.content-section-inner').css('backgroundColor'); 496 } 497 var colors = colorValues(bgColor), 498 rgb = colors[0]+','+colors[1]+','+colors[2]; 499 $('body').append('<style>#billboard:after { background: linear-gradient(rgba('+rgb+',0) 0%, rgba('+rgb+',0.5) 35%, rgba('+rgb+',1) 90%) !important; }</style>'); 500 501 } 502} 503 504function colorValues(color) 505{ 506 if (color === '') 507 return; 508 if (color.toLowerCase() === 'transparent') 509 return [0, 0, 0, 0]; 510 if (color[0] === '#') 511 { 512 if (color.length < 7) 513 { 514 // convert #RGB and #RGBA to #RRGGBB and #RRGGBBAA 515 color = '#' + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : ''); 516 } 517 return [parseInt(color.substr(1, 2), 16), 518 parseInt(color.substr(3, 2), 16), 519 parseInt(color.substr(5, 2), 16), 520 color.length > 7 ? parseInt(color.substr(7, 2), 16)/255 : 1]; 521 } 522 if (color.indexOf('rgb') === -1) 523 { 524 // convert named colors 525 var temp_elem = document.body.appendChild(document.createElement('fictum')); // intentionally use unknown tag to lower chances of css rule override with !important 526 var flag = 'rgb(1, 2, 3)'; // this flag tested on chrome 59, ff 53, ie9, ie10, ie11, edge 14 527 temp_elem.style.color = flag; 528 if (temp_elem.style.color !== flag) 529 return; // color set failed - some monstrous css rule is probably taking over the color of our object 530 temp_elem.style.color = color; 531 if (temp_elem.style.color === flag || temp_elem.style.color === '') 532 return; // color parse failed 533 color = getComputedStyle(temp_elem).color; 534 document.body.removeChild(temp_elem); 535 } 536 if (color.indexOf('rgb') === 0) 537 { 538 if (color.indexOf('rgba') === -1) 539 color += ',1'; // convert 'rgb(R,G,B)' to 'rgb(R,G,B)A' which looks awful but will pass the regxep below 540 return color.match(/[\.\d]+/g).map(function (a) 541 { 542 return +a 543 }); 544 } 545} 546 547/* 548html tabs - uses jqueryui from plugins.js 549*/ function tabs($tab) { 550 $tab.tabs({ 551 create: function(event, ui) { 552 $tab.find(".tab-content").each((function() { 553 var thisTab = $(this); 554 var thisTabID = thisTab.attr("id"); 555 var thisAnchor = $tab.find('.ui-tabs-tab[aria-controls="' + thisTabID + '"]'); 556 var thisAnchorPos = thisAnchor.index(); 557 var thisAnchorText = thisAnchor.find("a").html(); 558 thisTab.wrapAll('<div class="ui-tab-wrap" />'); 559 thisTab.parent(".ui-tab-wrap").prepend('<a href="#' + thisTabID + '" data-tab="' + thisAnchorPos + '" class="ui-tabs-anchor-mobile">' + thisAnchorText + "</a>"); 560 })); 561 $tab.find(".ui-tabs-anchor-mobile").first().addClass("active"); 562 $(".ui-tabs-anchor-mobile").click((function(event) { 563 event.preventDefault(); 564 var thisTabPos = parseInt($(this).data("tab")); 565 $tab.find(".ui-tabs-anchor-mobile").removeClass("active"); 566 $(this).addClass("active"); 567 $tab.tabs("option", "active", thisTabPos); 568 })); 569 }, 570 beforeActivate: function(event, ui) {}, 571 activate: function(event, ui) { 572 $tab.find(".ui-tabs-anchor-mobile").removeClass("active"); 573 $tab.find('.ui-tabs-anchor-mobile[data-tab="' + ui.newTab.index() + '"]').addClass("active"); 574 } 575 }); 576} 577 578/* 579ajax tabs from link list - uses jqueryui from plugins.js 580*/ function tabsAjax($tab) { 581 var tabsC = $tab.attr("id"); 582 var tabsID = tabsC.split("-")[1]; 583 $.ajax({
584 url: "/_components/ajax/ajax-tabs.php", 585 type: "GET", 586 data: { 587 id: tabsID 588 }, 589 success: function(results) { 590 $("#" + tabsC).html(results); 591 $("#" + tabsC).tabs({ 592 create: function(event, ui) { 593 $tab.find(".tab-content").each((function() { 594 var thisTab = $(this); 595 var thisTabID = thisTab.attr("id"); 596 var thisAnchor = $tab.find('.ui-tabs-tab[aria-controls="' + thisTabID + '"]'); 597 var thisAnchorPos = thisAnchor.index(); 598 var thisAnchorText = thisAnchor.find("a").html(); 599 thisTab.wrapAll('<div class="ui-tab-wrap" />'); 600 thisTab.parent(".ui-tab-wrap").prepend('<a href="#' + thisTabID + '" data-tab="' + thisAnchorPos + '" class="ui-tabs-anchor-mobile">' + thisAnchorText + "</a>"); 601 })); 602 $tab.find(".ui-tabs-anchor-mobile").first().addClass("active"); 603 $(".ui-tabs-anchor-mobile").click((function(event) { 604 event.preventDefault(); 605 var thisTabPos = parseInt($(this).data("tab")); 606 $tab.find(".ui-tabs-anchor-mobile").removeClass("active"); 607 $(this).addClass("active"); 608 $tab.tabs("option", "active", thisTabPos); 609 })); 610 }, 611 beforeActivate: function(event, ui) { 612 //console.log(ui); 613 if ($(ui.newTab).find("a").attr("href").indexOf("#") != 0) { 614 window.open($(ui.newTab).find("a").attr("href"), "_self"); 615 } else {} 616 }, 617 activate: function(event, ui) { 618 $tab.find(".ui-tabs-anchor-mobile").removeClass("active"); 619 $tab.find('.ui-tabs-anchor-mobile[data-tab="' + ui.newTab.index() + '"]').addClass("active"); 620 } 621 }); 622 }, 623 error: function(results, textStatus, jqXHR) { 624 //add error messages as needed console.log(jqXHR.responseText); 625 } 626 }); 627} 628 629/* 630accordions from snippets and link list - uses jqueryui from plugins.js 631*/ function accordions($accordion) { 632 $accordion.accordion({ 633 header: "> h6", 634 heightStyle: "content", 635 active: false, 636 collapsible: true, 637 create: function(event, ui) {}, 638 activate: function(event, ui) {} 639 }); 640 //open forms for error or thanks 641 if (window.location.href.indexOf("ferr") >= 0 || window.location.href.indexOf("thanks") >= 0) { 642 if ($(".accordion .monkForm .errorSummary").length) { 643 var panelID = $(".accordion .monkForm .errorSummary").parents(".ui-accordion-content").attr("id"); 644 $(".accordion").accordion("option", "active", $("#" + panelID).index(".accordion div")); 645 } 646 if ($(".accordion .mcms_form_thank_you").length) { 647 var panelID = $(".accordion .mcms_form_thank_you").parents(".ui-accordion-content").attr("id"); 648 $(".accordion").accordion("option", "active", $("#" + panelID).index(".accordion div")); 649 } 650 } 651} 652 653/* 654tooltip uses jqueryui from plugins.js 655*/ function tooltips() { 656 //tooltip 657 $(".tooltip").tooltip({ 658 position: { 659 my: "center bottom-9", 660 at: "center top", 661 collision: "flipfit" 662 } 663 }); 664 $(document).ajaxComplete((function() { 665 if ($(".tooltip").length) { 666 $(".tooltip").tooltip({ 667 position: { 668 my: "center bottom-9", 669 at: "center top", 670 collision: "flipfit" 671 } 672 }); 673 } 674 })); 675} 676 677/* 678zurb tables for responsive tables approach - re pinned tables in css 679*/ function zurbTables() { 680 function n(n) { 681 n.wrap("<div class='table-wrapper' />"); 682 var i = n.clone(); 683 i.find("td:not(:first-child), th:not(:first-child)").css("display", "none"), i.removeClass("responsive-table"), 684 n.closest(".table-wrapper").append(i), i.wrap("<div class='pinned' />"), n.wrap("<div class='scrollable' />"), 685 e(n, i); 686 } 687 function i(n) { 688 n.closest(".table-wrapper").find(".pinned").remove(), n.unwrap(), n.unwrap(); 689 } 690 function e(n, i) { 691 var e = n.find("tr"), t = i.find("tr"), a = []; 692 e.each((function(n) { 693 var i = $(this), e = i.find("th, td"); 694 e.each((function() { 695 var i = $(this).outerHeight(!0); 696 a[n] = a[n] || 0, i > a[n] && (a[n] = i); 697 })); 698 })), t.each((function(n) { 699 $(this).height(a[n]); 700 })); 701 } 702 var t = !1, a = function() { 703 return $(window).width() < 767 && !t ? (t = !0, $("table.responsive-table").each((function(i, e) { 704 n($(e)); 705 })), !0) : void (t && $(window).width() > 767 && (t = !1, $("table.responsive-table").each((function(n, e) { 706 i($(e)); 707 })))); 708 }; 709 a(), $(window).on("redraw", (function() { 710 t = !1, a(); 711 })), $(window).on("resize", a); 712} 713 714/* 715Plyr video 716*/ function plyrVideo() { 717 var plyr_options = { 718 hideControls: true, 719 ratio: "16:9", 720 controls: [ "play-large", "play", "progress", "settings", "fullscreen", "volume" ] 721 }; 722 var players = Plyr.setup(".plyr__player", plyr_options); 723 window.players = players; 724 $(document).ajaxComplete((function() { 725 var plyr_options = { 726 hideControls: true, 727 ratio: "16:9", 728 controls: [ "play-large", "play", "progress", "settings", "fullscreen", "volume" ] 729 }; 730 var players = Plyr.setup(".plyr__player", plyr_options); 731 window.players = players; 732 })); 733} 734 735/* 736replace url with outside url custom field 737*/ function outsideURL() { 738 //articles with outside url 739 $(".outsideurl").each((function() { 740 var outsideURL = $(this).data("url"); 741 $(this).find("a").attr("href", outsideURL); 742 })); 743 $(document).ajaxComplete((function() { 744 $(".outsideurl").each((function() { 745 var outsideURL = $(this).data("url"); 746 $(this).find("a").attr("href", outsideURL); 747 })); 748 })); 749} 750 751/* 752add new window to anchors 753*/ function blankTarget() { 754 $("[data-blanktarget=true]").each((function() { 755 $(this).find("a").attr("target", "_blank"); 756 })); 757 $(document).ajaxComplete((function() { 758 $("[data-blanktarget=true]").each((function() { 759 $(this).find("a").attr("target", "_blank"); 760 })); 761 })); 762} 763 764/* 765Remove the Monk-generated onsubmit function and handle the form submit here 766*/ function newsletter($newsletter) {
767 //$newsletter.find('#newsletter_text').val = ''; 768 //$newsletter.find('#newsletter_text').attr('placeholder', 'Email'); 769 $newsletter.find("#mcms_newsletter_first_name").attr("placeholder", "First Name"); 770 $newsletter.find("#mcms_newsletter_last_name").attr("placeholder", "Last Name"); 771 $newsletter.removeAttr("onsubmit").submit((function(event) { 772 event.preventDefault(); 773 var eml_addr = $newsletter.find("#newsletter_text").val(); 774 if (isValidEmail(eml_addr)) { 775 var formData = $newsletter.serialize(); 776 $.ajax({ 777 type: "POST", 778 url: $newsletter.attr("action"), 779 data: formData 780 }); 781 // var successMsg = $(this).find('#success').val().split("||").pop(); 782 var successMsg = "Thanks! Check your email and click the confirmation link to complete the sign‑up."; 783 $newsletter.replaceWith("<p class='success-msg'>" + successMsg + "</p>"); 784 } else { 785 //$newsletter.find('#newsletter_text').val = ''; 786 //$newsletter.find('#newsletter_text').attr('placeholder', 'Email'); 787 alert("Please enter a valid email address and try again."); 788 } 789 })); 790} 791 792/* 793media icons 794*/ function mediaIcons() { 795 $(".media-icons .video a").html("").append('<i class="fa fa-play"></i>'); 796 $(".media-icons .listen a").html("").append('<i class="fa fa-volume-down"></i'); 797 $(".media-icons .download a").html("").append('<i class="fa fa-download"></i>'); 798 $(".media-icons .notes a").html("").append('<i class="fa fa-file-alt"></i>'); 799} 800 801/* 802design has some options for keeping specific items light w/dark bg 803*/ function checkKeepLight() { 804 $(".linked-image").addClass("keep-light"); 805} 806 807function initialize(callback) { 808 responsiveVideo(); 809 lightgallery(); 810 $(".monkForm select, .filters select, .event-right .sorter, #select-nav-dropdown").exists((function() { 811 sorters(this); 812 })); 813 addSticky(); 814 $(".jarallax").exists((function() { 815 jarallax(); 816 })); 817 $(".slick-widget").exists((function() { 818 slick(); 819 })); 820 header(); 821 $("nav.subnav").exists((function() { 822 subnav(this); 823 })); 824 $(".search-predictive").exists((function() { 825 predictiveSearch(); 826 })); 827 billboard(); 828 // Modifications to 'Tabs' handling, in order to allow for multiple instances on single page (snippet code also should be updated with new html) 829 $(".tabs").exists((function() { 830 // Skip the special handling for tabs on the search page 831 if ($(this).hasClass("search")) { 832 tabs($(this)); 833 } else { 834 // On each set of tabs, assign new href to the nav items and matching ids to the content divs 835 $(".tabs").each((function(i) { 836 // Generate a random, 3-digit number to differentiate this set of tabs 837 var random_id = Math.floor(Math.random() * (999 - 100 + 1) + 100); 838 // Assign a unique href to each nav item 839 $(this).find("> ul > li a").each((function(index) { 840 // #tab-xxx-1 841 $(this).attr("href", "#tab-" + random_id + "-" + index); 842 })); 843 // Assign a matching id to each tab-content div 844 $(this).find(".tab-content").each((function(index) { 845 // #tab-xxx-1 846 $(this).attr("id", "tab-" + random_id + "-" + index); 847 })); 848 // After updating the hrefs and ids, run the normal tabs function on each set of tabs 849 tabs($(this)); 850 })); 851 } 852 })); 853 $(".tabs-linklist").exists((function() { 854 tabsAjax(this); 855 })); 856 $(".accordion").exists((function() { 857 accordions(this); 858 })); 859 $(".tooltip").exists((function() { 860 tooltips(); 861 })); 862 zurbTables(); 863 plyrVideo(); 864 outsideURL(); 865 blankTarget(); 866 $("#newsletter").exists((function() { 867 newsletter(this); 868 })); 869 $(".media-icons").exists((function() { 870 mediaIcons(); 871 })); 872 checkKeepLight(); 873 callback(); 874} 875 876function initialLoaded() { 877 $("html").addClass("loaded"); 878} 879 880$.fn.exists = function(callback) { 881 if (this.length) { 882 var args = [].slice.call(arguments, 1); 883 callback.call(this, args); 884 } 885 return this; 886}; 887 888jQuery((function($) { 889 //setup in bulk (DOCUMENT READY) 890 initialize(initialLoaded); 891}));
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.