[]
Louisiana teen competes to be Crossfit World’s Fittest Teen -1) { logo = `${cdn}/gannett-web/properties/${site}/logos-and-branding/logo-${section}.svg`; path = `/${section}/`; } document.getElementById(“logoContainer”).setAttribute(“href”, path); document.getElementById(“homeLink”).setAttribute(“href”, path); if (logo) { document.getElementById(“sidebarLogo”).setAttribute(“src”, sidebarlogo); document.getElementById(“logo”).setAttribute(“src”, logo); } else { document.getElementById(“logo”).hidden = true; } ///variables // hides headline when we scroll past content in stories let contentColliding = false, // keeps track of direction scrolled lastScrollPosition = 0, // keeps track of open state of nav hub navToggle = false, //show share buttons on scroll showShareOnScroll = false, currentSearchQuery = ”, // keeps track of errors thrown from search searchError = false; isMobile = _getIsMobile(); let desktop = window.ga_data.intents.indexOf(‘device-type:desktop’) > -1; if (desktop) { navRibbon.setAttribute(‘class’, ‘nav-ribbon-wrap desktop-nav-ribbon’); } else { if (navLogin) { navLogin.setAttribute(‘class’, ‘mobile-nav’); } } _addListeners(); _isCobrand(); function _isCobrand() { if (window.ga_data.route.cobrand){ document.getElementById(“navContainer”).style.height = ’40px’; document.getElementById(“iconMenu”).style.display = ‘none’; document.getElementById(“itemWrapperLogin”).hidden= true; document.getElementById(“alertManager”).hidden = true; } } function _getIsMobile() { return (window.ga_data.utils && window.ga_data.utils.UA && (window.ga_data.utils.UA.IS_IOSMOBILE || window.ga_data.utils.UA.IS_IPAD)); } function _manageBannerLeaveBehind(e) { alertIndicatorActive = e.detail.activate; } function _addListeners() { window.addEventListener(‘resize’, () => this._onWindowResize()); // if config wants share buttons to show on scroll if (showShareOnScroll) { window.addEventListener(‘ga-scroll’, () => this._onWindowScroll()); } searchInput = document.getElementById(‘searchInput’); searchInput.addEventListener(‘focus’, e => _searchInputFocusListener(e)); searchInput.addEventListener(‘blur’, e => _searchInputFocusListener(e)); alertManager.addEventListener(‘bannerLeaveBehind’, e => _manageBannerLeaveBehind(e)); container.addEventListener(‘formSubmit’, e => _formHandler(e)); container.addEventListener(‘hubAlertTap’, e => _alertTapHandler(e)); } function _isAlertIndicatorActive() { let alertsLeaveBehind = document.getElementById(“alertsLeaveBehind”); if (alertIndicatorActive) { alertsLeaveBehind.classList.add(‘fade-in’); alertsLeaveBehind.classList.add(‘active’); } else { alertsLeaveBehind.classList.remove(‘fade-in’); alertsLeaveBehind.classList.remove(‘active’); } } function _alertTapHandler(e) { document.getElementById(“alertManager”).markAlertInactive(e.detail.alertId); } function _fireLogoEvent(e) { analytics.fireEvent(`${ga_data.route.basePageType}|${ga_data.route.ssts.split(‘/’).join(‘:’)}|navlogo`); } function _formHandler(e) { if (e.detail.searchValue) { let searchBucket = _getSearchBucket(), searchValue = e.detail.searchValue; currentSearchQuery = searchValue; searchBucket.count = ’20’; analytics.fireEvent(‘navsearch’); // “concierge” fetch(`https://concierge.gannettdigital.com/search/${window.ga_data.site.uaid}/uw/${searchValue}`, { headers: new Headers({ ‘Accept’: ‘text/plain’ }) }).then(response => { if (response.status === 200) { response.text().then(url => window.location = url); } // no match }, error => { if (window.newrelic) window.newrelic.noticeError(error); }); // “normal search” searchBucket.hidden = false; _toggleSearch(true); searchBucket.query = searchValue; searchBucket.siteId = (window.ga_data.site.siteId || 1); } return; } _closeSearch = function (e) { e.stopPropagation(); currentSearchQuery = ”; _toggleSearch(false); _updateNavHub(); let searchBucket = document.getElementById(‘searchBucket’); if (searchBucket) { searchBucket.query = ”; searchBucket.hidden = true; } } _toggleNav = function (e) { let hubEl = _getNavHub(); let opts = { ‘height’: ‘initial’, ‘width’: ‘initial’, ‘overflow’: ‘initial’ }; e.stopPropagation(); navToggle = !navToggle; if (navToggle) { container.classList.add(‘hub-open’); } else { container.classList.remove(‘hub-open’); } alertIndicatorActive = false; if (navToggle) { if (!hubEl.tagList.length) { let navManager = document.getElementById(“navManager”); managerTagList = navManager.getCurrentSiteTags(); hubEl.tagList = managerTagList; } _updateNavHub(); opts = { ‘height’: ‘100vh’, ‘width’: ‘100vw’, ‘overflow’: ‘hidden’ }; hubEl.alerts = document.getElementById(“alertManager”).getActiveAlerts(); analytics.fireEvent(‘navopen’); } else { _closeSearch(e); analytics.fireEvent(‘navclose’); } _disableScroll(opts); } function _disableScroll(opts) { let bodyStyle = document.body.style; Object.keys(opts).map(key => bodyStyle[key] = opts[key]); if (isMobile) { document.documentElement.style.overflow = opts.overflow; } } function _onWindowScroll() { let navRibbon = document.getElementById(‘navRibbon’); if (window.scrollY < this.lastScrollPosition || window.scrollY -1) && contentColliding)) { document.getElementById('toggleSticky').classList.add('scroll'); } else { document.getElementById('toggleSticky').classList.remove('scroll'); }//toggle logo collapse if (contentColliding) { navRibbon.classList.add('headline-reveal'); } else { navRibbon.classList.remove('headline-reveal'); }//toggle sharebuttons } lastScrollPosition = window.scrollY; } function _onWindowResize() { // browsers tend to stick an overlay based on how the body is scroll. This is to counter that. if (navToggle) { _updateNavHub(); } } function _updateNavHub() { if (_getIsMobile()) { let topHeight = document.querySelector('.expand-wrap-top').clientHeight; document.getElementById('hubContainer').style.height = `${window.innerHeight - topHeight}px`; document.body.style.height = `${window.innerHeight}px`; } } // Hides Logo when someone swipes contents of the `nav-global` left or right. function _hideLogo() { let toggleSticky = document.getElementById('toggleSticky'); if (!navToggle) { if (document.getElementById('toggleSticky').scrollLeft > 10) { toggleSticky.classList.add(‘scroll’); } else { toggleSticky.classList.remove(‘scroll’); } } } function _getNavHub() { return document.getElementById(‘hub’); } function _getSearchBucket() { return document.getElementById(‘searchBucket’); } function _toggleSearch(toggle) { container = document.getElementById(‘navWrapContainer’); if (toggle) { container.classList.add(‘search-expand’); } else { container.classList.remove(‘search-expand’); } } function _searchInputFocusListener(e) { let toggle = (e.type === ‘focus’ || !!currentSearchQuery); _toggleSearch(toggle); if (!toggle) { _closeSearch(e); } } }()); ]]>