_ido = { "page_type": "home" } var helper = { init: function() { }, pageReady: function() { }, listeners: function() { }, debounce: function(func, wait, immediate) { // Returns a function, that, as long as it continues to be invoked, will not // be triggered. The function will be called after it stops being called for // N milliseconds. If `immediate` is passed, trigger the function on the // leading edge, instead of the trailing. var timeout; return function() { var context = this, args = arguments; var later = function() { timeout = null; if (!immediate) func.apply(context, args); }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) func.apply(context, args); }; }, imgBleed: function() { let $img = $('[class*="img-bleed"]'); function setImgSize() { $img.each(function() { var sibling = helper.sibling($(this), '[class*="col-"]'); if(sibling.exists === true) { if($(window).width() > 767) { $(this).css('width', 'calc(100vw - ' + sibling.width + 'px)'); }else { $(this).css('width', ''); } } }); } var resizeAgain = helper.debounce(function() { setImgSize(); }, 250); setImgSize(); window.addEventListener('resize', resizeAgain); }, sibling: function(elm, attr) { let $parent = elm.closest(attr); var exists = false; if(!$parent) return; var width = $(window).width() - $parent.outerWidth(); let $siblings = $parent.siblings(attr); if($siblings) { exists = true; width = $($siblings).outerWidth(); } var props = { exists: exists, width: width, parentWidth: $parent.outerWidth() } return props; }, vars: { } } var hp, homepage = { init: function() { hp = this.vars; helper.imgBleed(); if($('.breadcrumb').length) { $('.breadcrumb').remove(); } this.pageReady(); }, pageReady: function() { homepage.addBackground(); homepage.scrollReveal(); // homepage.addEmbedContainer(); homepage.equalHeight(); //homepage.setDynamicMyILMNLinks($('.myIlmnDynamicLink')); homepage.listeners(); }, listeners: function() { homepage.underlinePRNews(); homepage.prRowClick(); homepage.touchClick(); homepage.touchDropdown(); }, addBackground: function() { var bgContainer = document.createElement('div'); bgContainer.classList.add('homepage-bg'); $('body').append(bgContainer); }, touchClick: function() { $('body > div:not(.mainnav) a:not([data-toggle="modal"])').on("touchend", function(e) { var el = $(this), href = $(this).attr('href'); if(href !== 'undefined') { var link = el.attr("href"), target = el.attr('target'); if(target === '_blank') { e.stopPropagation(); e.preventDefault(); window.open(link, '_blank'); }else { window.location = link; } } }); $('body > div:not(.mainnav) [data-toggle="modal"]').on('touchend', function() {}); }, touchDropdown: function() { $('body > div:not(.mainnav) [data-toggle=dropdown]').on('touchend', function(e) { e.preventDefault(); e.stopPropagation(); $(this).dropdown('toggle'); }); }, scrollReveal: function() { sr.reveal('.card, .flex-btn-group', { duration: 1000, reset: false, easing: 'ease', viewFactor: .25, viewOffset: { top: 100 }, afterReveal: function (domEl) { $(domEl).attr('style', 'visibility: visible'); } }); }, addEmbedContainer: function() { var $iframe = $('iframe'); if($iframe) { $.each($iframe, function() { if(!$(this).parent().hasClass('embed-container') && $(this).parents('.modal-body').length) { $(this).wrap('
'); } }); } }, equalHeight: function() { if ($('.hp-newsfeed').length) { let tabContent = $('.hp-newsfeed').find('.tab-content'); tabContent.addClass('equal-height-container'); tabContent.find('.tab-pane').addClass('equal-height-box'); homepage.equalBoxHeight(".equal-height-container", ".equal-height-box"); } }, equalBoxHeight: function(container, box) { // adapted from clientlibs_bootstrap $(container).each(function() { var highestBox = 0; $(this).find(box).each(function() { if ($(this).css('display') === 'none') { var initCSS = $(this).attr('style'); var newHeight = $(this).css({ height: 'auto', display: 'block' }).height(); if (newHeight > highestBox) { highestBox = $(this).height(); } $(this).attr('style','').attr('style', initCSS !== 'undefined' ? initCSS : ''); } else { $(this).height("auto"); if ($(this).height() > highestBox) { highestBox = $(this).height(); } } }); $(this).find(box).height(highestBox); }); }, setDynamicMyILMNLinks: function(target) { var customerCookie = $.cookie('IlmnPersona'); if (target.length) { target.each(function () { if (customerCookie.length) { var link = $(this).attr('data-customer-link'); var label = $(this).attr('data-customer-label'); var tracktitle = $(this).attr('data-customer-track-title'); $(this).attr('href', link); $(this).text(label); $(this).attr('data-track-title', tracktitle); } $(this).removeAttrs('data-customer-link data-customer-label data-customer-track-title'); }); } }, underlinePRNews: function() { var $underline = $('.hp-tab-underline'); if(!$underline.length) { $underline = document.createElement('div'); $($underline).addClass('hp-tab-underline'); $('.hp-newsfeed').prepend($underline); } var hpTab = $('.hp-newsfeed .nav-tabs li'); function underlinePos() { var lineWidth = $('.hp-newsfeed .nav-tabs li.active').outerWidth(), lineHeight = hpTab.outerHeight(); $($underline).css({ 'width': lineWidth + 'px', 'top': lineHeight + 'px' }); } underlinePos(); hpTab.click(function(){ var current = $(this), position = current.position(); $($underline).css('left', position.left); $($underline).css('width', $(this).outerWidth()); }); var resize = helper.debounce(function() { underlinePos(); homepage.equalBoxHeight(".equal-height-container", ".equal-height-box"); }, 100); window.addEventListener('resize', resize); window.addEventListener('orientationchange', resize); }, prRowClick: function() { var tr = $('.pressReleasesList, .presscenterList').find('tr'); $(tr).find('a').addClass('pr-link'); tr.on('click', function() { var href = $(this).find('.pr-link').attr('href'); window.location.href = href; }); } }; $(document).ready(function() { homepage.init(); $('.btn, a:not([data-toggle="popover"]), button').on('mouseup click hidden.bs.modal', function() { $(this).blur(); }); });