1/** 2 * Binds together all functionality across the page. 3 * 4 * @file Core.js 5 * @package HHS.IFL.Core 6 * @dependencies jQuery 7 */ 8 9;(function(App, window, document, undefined) { 10 'use strict'; 11 12 var ToggleListHandler = namespace('Bazooka.ToggleList.ToggleListHandler'); 13 var TabHandler = namespace('Bazooka.Tabs.TabHandler'); 14 15 var CharReplacements = App.Strings.CharReplacements; 16 17 var SearchHandler = App.Header.SearchHandler; 18 var ConsultingToggleList = App.Header.ConsultingToggleList; 19 var HeaderCarouselHandler = App.Header.CarouselHandler; 20 var ResponsiveMenuHandler = App.Header.ResponsiveMenuHandler; 21 22 var ProgramToolsForm = App.Form.ProgramToolsForm; 23 var ProgramRegistrationForm = App.Form.ProgramRegistrationForm; 24 var FormHelper = App.Form.FormHelper; 25 26 var ProgramToolPanels = App.Program.ProgramToolPanels; 27 var ProgramContentTabs = App.Program.ContentTabs; 28 var GlobalNotice = App.GlobalNotice.GlobalNotice; 29 30 var EducationFilter = App.Education.Filter; 31 var EducationDropdownMenu = App.Education.DropdownMenu; 32 33 34 var PieChart = App.Svg.PieChart; 35 var Score = App.Svg.Score; 36 37 /** 38 * Binds together all functionality. 39 */ 40 App.Core = function() { 41 this.toggleListHandler = null; 42 this.tabHandler = null; 43 44 this.searchHandler = null; 45 this.consultingToggleList = null; 46 this.headerCarouselHandler = null; 47 this.responsiveMenuHandler = null; 48 49 this.programToolsForm = null; 50 this.programRegistrationForm = null; 51 this.programToolPanels = null; 52 53 this.pieChartRenderer = null; 54 this.scoreRenderer = null; 55 56 this.educationFilter = null; 57 this.educationDropdownMenu = null; 58 59 /** 60 * Initializer, sets up the object. 61 * 62 * @return void. 63 */ 64 this.initialize = function() { 65 // Setup core objects. 66 this.setupObjects(); 67 }; 68 69 /** 70 * Sets up all needed objects. 71 * 72 * @return void. 73 */ 74 this.setupObjects = function() { 75 new App.Education.EducationTypeSort(); 76 this.charReplacements = new CharReplacements(); 77 $(document).ready(function() { 78 var defaultSelects = $('.education-type-input--select:not(.education-type-input--large) [data-select-2]'); 79 var purpleSelects = $('.education-type-input--select.education-type-input--large [data-select-2]'); 80 81 defaultSelects.select2(); 82 purpleSelects.select2({theme: "purple"}); 83 }); 84 85 this.pieChartRenderer = new PieChart(); 86 this.scoreRenderer = new Score(); 87 88 this.toggleListHandler = new ToggleListHandler(); 89 this.tabHandler = new TabHandler(); 90 91 this.searchHandler = new SearchHandler(this.toggleListHandler); 92 this.consultingToggleList = new ConsultingToggleList(this.toggleListHandler, $('body')[0], 'contact-consulting'); 93 94 this.programToolPanels = new ProgramToolPanels(); 95 this.programToolsForm = new ProgramToolsForm(); 96 this.programRegistrationForm = new ProgramRegistrationForm(); 97 new FormHelper(); 98 this.educationDropdownMenu = new EducationDropdownMenu(); 99 100 var pageEducationTabContainer = $('.page-education-main[data-tab-container]'); 101 if (pageEducationTabContainer.length) { 102 this.educationFilter = new EducationFilter( 103 this.tabHandler.getHandlerForElement(pageEducationTabContainer.get(0)) 104 ); 105 } 106 var programContentTabContainer = $('.program-section.program-section-content [data-tab-container]'); 107 if (programContentTabContainer.length) { 108 this.programContentTabs = new ProgramContentTabs( 109 this.tabHandler.getHandlerForElement(programContentTabContainer.get(0)) 110 ); 111 } 112 113 // this.cookieNotice = new GlobalNotice('accept-cookies', translations.cookie_description, translations.cookie_confirm); 114 // this.cookieNotice.show(); 115 116 this.responsiveMenuHandler = new ResponsiveMenuHandler(this.toggleListHandler); 117 118 this.setupHeaderVideo(); 119 120 this.setupWizardToggleCallback(); 121 this.setupInfoMeetingToggleCallback(); 122 this.setupTestimonials(); 123 124 this.pieChartRenderer.renderItems(); 125 this.scoreRenderer.renderItems(); 126 127 }; 128 129 /** 130 * Load youtube iframeapi if necessary 131 */ 132 this.setupHeaderVideo = function() { 133 if ($(".header-video-frame-container").length) { 134 this.loadYoutubeIframeApi(); 135 window.onYouTubePlayerAPIReady = this.onYouTubePlayerAPIReady.bind(this); 136 } 137 } 138 this.loadYoutubeIframeApi = function() { 139 var tag = document.createElement('script'); 140 tag.src = "https://www.youtube.com/iframe_api"; 141 var firstScriptTag = document.getElementsByTagName('script')[0]; 142 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 143 } 144 this.onYouTubePlayerAPIReady = function() { 145 this.headerVideo = new App.Header.HeaderVideo(); 146 } 147 148 /** 149 * Sets up a togglelist callback for the program wizard (isotope) 150 * @return void 151 */ 152 this.setupWizardToggleCallback = function() { 153 if ($('.pw-result-list.isotope').length === 0) { 154 return; 155 } 156 157 this.toggleListHandler.registerCallback( 158 $('.pw-result-list.isotope')[0], 159 'toggle', 160 function(e, id, type) { 161 $('.pw-result-list.isotope').isotope('reLayout'); 162 }.bind(this) 163 ); 164 }; 165 166 /** 167 * Sets up a togglelist callback for the info meeting list. 168 * @return void 169 */ 170 this.setupInfoMeetingToggleCallback = function() { 171 if ($('.pw-result-list.info-meeting-list').length === 0) { 172 return; 173 } 174 175 this.toggleListHandler.registerCallback( 176 $('.pw-result-list.info-meeting-list')[0], 177 'toggle', 178 function(e, id, type) { 179 var content = $('[data-toggle-list-content=' + id + ']'); 180 if(content.hasClass('toggle-list-content-active')) { 181 var height = content.outerHeight(); 182 content.css({ 183 'height': 0, 184 'overflow': 'hidden' 185 });
186 187 content.animate( 188 { 189 'height': height 190 }, 191 { 192 'duration': 100 193 } 194 ); 195 } 196 }.bind(this) 197 ); 198 }; 199 200 this.setupTestimonials = function() { 201 const testimonies = document.querySelectorAll( 202 '.testimony' 203 ); 204 if (testimonies) { 205 testimonies.forEach((testimony) => { 206 testimony.querySelectorAll(':scope > *').forEach((element)=>{ 207 console.log(element.innerText.trim()); 208 if (!element.innerText.trim()) { 209 element.remove(); 210 } 211 }); 212 }); 213 } 214 215 if ($("#testimonial-carousel").length >= 1) { 216 217 var hasMultipleItems = ($(".testimonial-item").length > 1) ? true : false; 218 219 $("#testimonial-carousel").owlCarousel({ 220 'items' : 1, 221 'margin' : 20, 222 'nav' : true, 223 'mouseDrag' : hasMultipleItems, 224 'touchDrag' : hasMultipleItems, 225 'dots' : false, 226 'navText' : ["<", ">"], 227 'loop' : hasMultipleItems, 228 }); 229 } 230 }; 231 232 // Return public interface. 233 return { 234 initialize: this.initialize.bind(this) 235 }; 236 }; 237 238}(namespace('HHS.IFL'), window, document));
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.