{"version":3,"file":"scripts.js","sources":["scripts.js"],"sourcesContent":["(function ($) {\n\t'use strict'\n\n\t$(document).ready(function () {\n\t\t// Utility function. Causes the callback to only fire after a delay.\n\t\t// If the callback is called before the delay it waits. Useful for\n\t\t// rapidly firing callbacks like window.resize\n\t\t// -----------------------------------------------------------------\n\t\tvar viewportCore = {}\n\n\t\tviewportCore.waitForIdle = function (fn, delay) {\n\t\t\tvar timer = null\n\t\t\treturn function () {\n\t\t\t\tvar context = this\n\t\t\t\tvar args = arguments\n\t\t\t\tclearTimeout(timer)\n\t\t\t\ttimer = setTimeout(function () {\n\t\t\t\t\tfn.apply(context, args)\n\t\t\t\t}, delay)\n\t\t\t}\n\t\t}\n\n\t\t// Get the viewport width & height right away and use throughout document.\n\t\t// -----------------------------------------------------------------------\n\t\tviewportCore.viewportWidth = $(window).width()\n\t\tviewportCore.viewportHeight = $(window).height()\n\t\t$(window).resize(viewportCore.waitForIdle(function () {\n\t\t\tviewportCore.viewportWidth = $(window).width()\n\t\t\tviewportCore.viewportHeight = $(window).height()\n\t\t}, 200))\n\n\t\t// ! hoverIntent\n\t\t// -------------\n\t\t// Show / hide drop-down menus\n\t\t// http://cherne.net/brian/resources/jquery.hoverIntent.html\n\t\tvar dropDownMenus = 'header#masthead .menu-primary-container li.menu-item-has-children'\n\n\t\tvar showDropDown = function () {\n\t\t\t$(this).addClass('focus fade')\n\t\t}\n\n\t\tvar hideDropDown = function () {\n\t\t\tvar $this = $(this)\n\t\t\t$this.removeClass('fade')\n\t\t\tsetTimeout(function () {\n\t\t\t\t$this.removeClass('focus')\n\t\t\t}, 400)\n\t\t}\n\n\t\tvar responsiveHoverIntent = function () {\n\t\t\tif (viewportCore.viewportWidth < 768) {\n\t\t\t\t$(dropDownMenus).unbind('mouseenter').unbind('mouseleave');\n\t\t\t\t$(dropDownMenus).removeProp('hoverIntent_t');\n\t\t\t\t$(dropDownMenus).removeProp('hoverIntent_s');\n\t\t\t}\n\t\t\telse if (viewportCore.viewportWidth > 767) {\n\t\t\t\t$(dropDownMenus).hoverIntent({\n\t\t\t\t\tover: showDropDown,\n\t\t\t\t\tout: hideDropDown,\n\t\t\t\t\ttimeout: 100\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tresponsiveHoverIntent()\n\t\t$(window).resize(viewportCore.waitForIdle(function () {\n\t\t\tresponsiveHoverIntent()\n\t\t}, 200))\n\n\t\t// ! mobile menu\n\t\t// var mobileMenuIconContainer = 'header.site-header #site-navigation'\n\t\tvar mobileMenu = $('header.site-header #site-navigation')\n\t\tvar mobileMenuIcon = 'header.site-header #site-navigation #mobile-menu-icon'\n\t\tvar animateTime = 500\n\t\tvar menuClosedHeight = 82\n\t\tfunction autoHeightAnimate (element, time) {\n\t\t\tvar curHeight = element.height() // Get Default Height\n\t\t\tvar autoHeight = element.css('height', 'auto').height() // Get Auto Height\n\t\t\telement.height(curHeight) // Reset to Default Height\n\t\t\telement.stop().animate({ height: autoHeight }, time) // Animate to Auto Height\n\t\t}\n\t\t// open/close menu\n\t\t$(mobileMenuIcon).click(function () {\n\t\t\tif (mobileMenu.height() === menuClosedHeight) {\n\t\t\t\tautoHeightAnimate(mobileMenu, animateTime)\n\t\t\t\t$(mobileMenu).addClass('mobile-menu-open')\n\t\t\t} else {\n\t\t\t\tmobileMenu.stop().animate({ height: menuClosedHeight + 'px' }, animateTime)\n\t\t\t\t$(mobileMenu).removeClass('mobile-menu-open')\n\t\t\t}\n\t\t})\n\n\t\t$(window).resize(viewportCore.waitForIdle(function () {\n\t\t\tif (viewportCore.viewportWidth > 767) {\n\t\t\t\tmobileMenu.css('height', '')\n\t\t\t\t$(mobileMenu).removeClass('mobile-menu-open')\n\t\t\t}\n\t\t}, 200))\n\n\t\t// ! stacktable\n\t\t$('article table').stacktable()\n\n\t\t// ! sticky-kit sidebar\n\t\tif ($('body.single-dan_health_resources').length) {\n\t\t\tvar stickySidebar = function () {\n\t\t\t\tif (viewportCore.viewportWidth > 768) {\n\t\t\t\t\t$('aside#secondary .widget_jc_split_menu_widget').stick_in_parent()\n\t\t\t\t} else if (viewportCore.viewportWidth < 768) {\n\t\t\t\t\t$('aside#secondary .widget_jc_split_menu_widget').trigger('sticky_kit:detach')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// wait for load\n\t\t\t$(window).bind('load', function () {\n\t\t\t\tstickySidebar()\n\t\t\t})\n\n\t\t\t// run function of viewport resize\n\t\t\t$(window).resize(viewportCore.waitForIdle(function () {\n\t\t\t\tstickySidebar()\n\t\t\t}, 200))\n\t\t}\n\n\t\t// ! handle Alert Diver filter functionality\n\t\tif ($('body.page-template-page-landing-alert-diver form.searchandfilter').length) {\n\t\t\tvar arrowIcon = $('#filter-section #filter-dropdown-placeholder #filter-arrow i')\n\t\t\tvar categories = $('#filter-section .sf-field-taxonomy-dan_alert_diver_categories')\n\n\t\t\t$('#filter-section #filter-dropdown-placeholder #filter-arrow').click(\n\t\t\t\tfunction (e) {\n\t\t\t\t\tarrowIcon.toggleClass('fa-flip-vertical')\n\t\t\t\t\tcategories.toggleClass('active')\n\t\t\t\t}\n\t\t\t)\n\t\t\t$('#filter-section .searchandfilter input[name=\"_sf_submit\"]').click(\n\t\t\t\tfunction (e) {\n\t\t\t\t\tif (arrowIcon.hasClass('fa-flip-vertical')) {\n\t\t\t\t\t\tarrowIcon.removeClass('fa-flip-vertical')\n\t\t\t\t\t}\n\t\t\t\t\tif (categories.hasClass('active')) {\n\t\t\t\t\t\tcategories.removeClass('active')\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t)\n\t\t}\n\n\t\t// ! handle jCarousel\n\t\tif ($('body.page-template-page-landing-alert-diver .jcarousel').length) {\n\t\t\t$('.jcarousel').on('jcarousel:reload jcarousel:create', function () {\n\t\t\t\tvar carousel = $(this)\n\t\t\t\tvar width = carousel.innerWidth()\n\t\t\t\tcarousel.jcarousel('items').css('width', Math.ceil(width) + 'px')\n\t\t\t}).jcarousel({\n\t\t\t\twrap: 'circular'\n\t\t\t}).jcarouselAutoscroll({\n interval: 5000,\n target: '+=1',\n autostart: true,\n }).jcarouselSwipe()\n\n\t\t\t$('.jcarousel-controls .jcarousel-prev').jcarouselControl({\n\t\t\t\ttarget: '-=1'\n\t\t\t})\n\n\t\t\t$('.jcarousel-controls .jcarousel-next').jcarouselControl({\n\t\t\t\ttarget: '+=1'\n\t\t\t})\n\n\t\t\t$('.jcarousel-pagination').on('jcarouselpagination:active', 'a', function() {\n\t\t\t\t$(this).addClass('active')\n\t\t\t}).on('jcarouselpagination:inactive', 'a', function() {\n\t\t\t\t$(this).removeClass('active')\n\t\t\t}).on('click', function(e) {\n\t\t\t\te.preventDefault()\n\t\t\t}).jcarouselPagination({\n\t\t\t\tperPage: 1,\n\t\t\t\titem: function(page) {\n\t\t\t\t\treturn '' + page + ''\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t})\n})(window.jQuery)\n"],"names":["$","document","ready","viewportCore","waitForIdle","fn","delay","timer","context","this","args","arguments","clearTimeout","setTimeout","apply","viewportWidth","window","width","viewportHeight","height","resize","showDropDown","addClass","hideDropDown","$this","removeClass","responsiveHoverIntent","dropDownMenus","unbind","removeProp","hoverIntent","over","out","timeout","stickySidebar","arrowIcon","categories","mobileMenu","click","element","time","curHeight","autoHeight","css","stop","animate","menuClosedHeight","stacktable","length","stick_in_parent","trigger","bind","e","toggleClass","hasClass","on","carousel","innerWidth","jcarousel","Math","ceil","wrap","jcarouselAutoscroll","interval","target","autostart","jcarouselSwipe","jcarouselControl","preventDefault","jcarouselPagination","perPage","item","page","jQuery"],"mappings":"CAAA,SAAWA,gBAGVA,EAAEC,UAAUC,MAAM,WAKjB,IAAIC,EAAe,CAEnBC,YAA2B,SAAUC,EAAIC,GACxC,IAAIC,EAAQ,KACZ,OAAO,WACN,IAAIC,EAAUC,KACVC,EAAOC,UACXC,aAAaL,GACbA,EAAQM,WAAW,WAClBR,EAAGS,MAAMN,EAASE,IAChBJ,MAMLH,EAAaY,cAAgBf,EAAEgB,QAAQC,QACvCd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