1$(document).ready(function () { 2 3 4 // =====================URLSearchParams Polyfill for IE11 Support===================== 5 (function (w) { 6 w.URLSearchParams = w.URLSearchParams || function (searchString) { 7 var self = this; 8 self.searchString = searchString; 9 self.get = function (name) { 10 var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(self.searchString); 11 if (results == null) { 12 return null; 13 } 14 else { 15 return decodeURI(results[1]) || 0; 16 } 17 }; 18 } 19 })(window) 20 21 // ======================Primary Navigation Animation=============================== 22 var siteHeader = $('.SiteHeader'); 23 var siteHeaderController = new ScrollMagic.Controller(); 24 var siteHeaderShrinkHeight = 62; 25 26 var siteHeaderTween = TweenMax.to('.SiteHeader__layout', 1, { 27 height: siteHeaderShrinkHeight, 28 ease: Linear.easeNone 29 }); 30 var siteHeaderShrinkScene = new ScrollMagic.Scene({ 31 triggerElement: siteHeader, 32 triggerHook: 'onLeave', 33 duration: 30 34 }) 35 .setTween(siteHeaderTween) 36 .addTo(siteHeaderController); 37 38 var siteHeaderPinScene = new ScrollMagic.Scene({ 39 triggerElement: siteHeader, 40 triggerHook: 'onLeave', 41 duration: 0 42 }) 43 .setPin(siteHeader, { pushFollowers: false }) 44 .setClassToggle(siteHeader, 'SiteHeader--dense') 45 .addTo(siteHeaderController); 46 47 function refreshSiteHeader(lgBreakpoint) { 48 if (lgBreakpoint.matches) { // If media query matches 49 var siteHeader = $('.SiteHeader'); 50 siteHeaderPinScene.setPin(siteHeader, { pushFollowers: false }); 51 } else { 52 var siteHeader = siteHeader; 53 siteHeaderPinScene.removePin(true); 54 } 55 } 56 var lgBreakpoint = window.matchMedia("(min-width: 992px)"); 57 refreshSiteHeader(lgBreakpoint); 58 lgBreakpoint.addListener(refreshSiteHeader); // Attach listener function on state changes 59 siteHeaderPinScene.refresh(); 60 61 // ======================Secondary Navigation Animation=============================== 62 var triggerPoint = $('.SiteSecondaryNav2links'); 63 var subNavController = new ScrollMagic.Controller(); 64 var subNavShrinkHeight = 64; 65 var subNavTimeline = new TimelineMax(); 66 67 var subNavTween = TweenMax.to('.SiteSecondaryNav2links__childLinks-menu', 1, { 68 height: subNavShrinkHeight, 69 ease: Linear.easeNone 70 }); 71 72 var subNavBugTween = TweenMax.to('.SiteSecondaryNav2links .navbug', 1, { 73 opacity: 1, 74 ease: Linear.easeNone 75 }); 76 77 var subNavIconTween = TweenMax.to('.SiteSecondaryNav2__figure', 1, { 78 opacity: 0, 79 ease: Linear.easeNone 80 }); 81 82 subNavTimeline 83 .add(subNavTween) 84 .add(subNavBugTween) 85 .add(subNavIconTween); 86 87 var subNavShrinkScene = new ScrollMagic.Scene({ 88 triggerElement: triggerPoint, 89 triggerHook: 'onLeave', 90 duration: 130 91 }) 92 .offset(siteHeaderShrinkHeight * -1) 93 .setTween(subNavTimeline); 94 95 var subNavPinScene = new ScrollMagic.Scene({ 96 triggerElement: triggerPoint, 97 triggerHook: 'onLeave', 98 duration: 0 99 }) 100 .offset(siteHeaderShrinkHeight * -1) 101 .setPin(triggerPoint, { pushFollowers: false }) 102 .setClassToggle(triggerPoint, 'SiteSecondaryNav2links--dense'); 103 104 subNavController.addScene([subNavShrinkScene, subNavPinScene]); 105 106 subNavShrinkScene.refresh(); 107 subNavPinScene.refresh(); 108 109 function refreshSubNav(mdBreakpoint) { 110 if (mdBreakpoint.matches) { // If media query matches 111 var triggerPoint = $('.SiteSecondaryNav2links'); 112 subNavPinScene.setPin(triggerPoint, { pushFollowers: false }) 113 114 } else { 115 var siteHeader = siteHeader; 116 subNavPinScene.removePin(true); 117 } 118 } 119 var mdBreakpoint = window.matchMedia("(min-width: 768px)"); 120 refreshSubNav(mdBreakpoint); 121 mdBreakpoint.addListener(refreshSubNav); // Attach listener function on state changes 122 siteHeaderPinScene.refresh(); 123 124 if (window.location.hash) { 125 var hash = window.location.hash; 126 hash = hash.replace(/\/$/, ''); 127 var target = $(hash); 128 129 setTimeout(function () { 130 subNavController.scrollTo(function (newScrollPos) { 131 $("html, body").animate({ scrollTop: newScrollPos }, 1500); 132 }); 133 subNavController.scrollTo(target); 134 }, 500); 135 } 136 137 // ======================Highlighted Anchor Navigation=============================== 138 // Init controller 139 var highlightAnchorController = new ScrollMagic.Controller(); 140 141 var scrollScenes = []; 142 $('.js-active-scroll').each(function (i, el) { 143 var pageSection = $(el).attr('href'); 144 145 // Define a scene for each page section that has an anchor pointing to it 146 scrollScenes[i] = new ScrollMagic.Scene({ 147 triggerElement: pageSection, 148 triggerHook: 'onLeave' 149 }) 150 .duration( 151 function () { 152 var thisSection = $(this.toString()); 153 var nextSection = $(thisSection.nextAll('.PageAnchor')[0]); 154 var sectionDuration = 155 nextSection.offset().top - thisSection.offset().top; 156 return sectionDuration; 157 }.bind(pageSection) 158 ) 159 .offset((siteHeaderShrinkHeight + subNavShrinkHeight) * -1) 160 .addTo(highlightAnchorController); 161 }); 162
163 scrollScenes.forEach(function (scene, i, scenes) { 164 scene.on('start', function (event) { 165 if (event.scrollDirection == 'REVERSE') return; 166 167 if(this.triggerElement() !== undefined){ 168 var pageSection = this.triggerElement().getAttribute('id'); 169 $('.js-active-scroll').removeClass('selected'); 170 $('a[href="#' + pageSection + '"]').addClass('selected'); 171 } 172 }); 173 scene.on('end', function (event) { 174 if (event.scrollDirection == 'FORWARD') return; 175 176 if(this.triggerElement() !== undefined) { 177 var pageSection = this.triggerElement().getAttribute('id'); 178 $('.js-active-scroll').removeClass('selected'); 179 $('a[href="#' + pageSection + '"]').addClass('selected'); 180 } 181 }); 182 }); 183 184 185 186 // ======================SITE ANIMATIONS============================== 187 $("[data-animate]").each(function () { 188 var animationClass = "animate-" + $(this).data("animate"); 189 $(this).addClass(animationClass) 190 }); 191 var siteAnimationController = new ScrollMagic.Controller(); 192 $('[data-animate]').each(function (i) { 193 var animationTrigger = $(this); 194 // var hook = animationTrigger.data("animiate")==="slideup" ? 0.7 : 0.9; 195 new ScrollMagic.Scene({ 196 triggerElement: animationTrigger, 197 triggerHook: 0.9, 198 duration: 0, 199 offset: 50 200 }) 201 .setClassToggle(animationTrigger, 'visible') // add class to reveal 202 .reverse(false) 203 .addTo(siteAnimationController); 204 }); 205 206 207 208 209 210 211 // ======================Smooth Scrolling============================== 212 $('.container a').click(function () { 213 var anchorname = $(this).attr('href'); 214 var selectedNav = $('.selected').attr('href'); 215 216 if (selectedNav !== anchorname) { 217 var anchorclass = $(this).attr('class'); 218 if (anchorname && anchorname.indexOf('#') == 0 && anchorname.length > 1) { 219 if (anchorclass != 'question') { 220 var targetheightoffset = $(anchorname).offset().top; 221 222 if (targetheightoffset > window.scrollY) { 223 var animateTo = targetheightoffset + 1; 224 } else if (targetheightoffset < window.scrollY) { 225 var animateTo = targetheightoffset - 1; 226 } 227 jQuery('html,body').animate({ scrollTop: animateTo }, "slow"); 228 } 229 } 230 } 231 232 }); 233 234 235 // ======================Inline Players============================== 236 // if ($('.videoPlayBtn').length > 0) { 237 // $('.videoPlayBtn').each(function () { 238 // var controls = $(this).closest('.video-controls'); 239 // var image = $(this) 240 // .closest('.js_VideoContainer') 241 // .find('.js_imgPlaceholder'); 242 // var iframe = $(this) 243 // .closest('.js_VideoContainer') 244 // .find('iframe'); 245 246 // console.log(iframe); 247 // var videId = $(iframe).attr("video-id"); 248 // console.log(videId); 249 // var player = new Vimeo.Player(videId); 250 251 252 // var handlePlayVideo = function (controls, iframe, image) { 253 // $(image).fadeOut('slow', function () { 254 // controls.hide(); 255 // $(iframe).fadeIn('slow', function () { 256 // player.play(); 257 // }); 258 // }); 259 // }; 260 261 // var handleVideoEnd = function (controls, iframe, image) { 262 // $(iframe).fadeOut('slow', function () { 263 // $(image).fadeIn('slow', function () { 264 // controls.show(); 265 // }); 266 // }); 267 // }; 268 269 270 271 // $(this).on('click', function () { 272 273 // handlePlayVideo(controls, iframe, image); 274 // }); 275 276 // player.on('ended', function () { 277 // handleVideoEnd(controls, iframe, image) 278 // }); 279 // }); 280 281 // } 282 283}); 284 285 286$(document).ready(function () { 287 if (!window.videoPlayers) return; 288 289 $.each(window.videoPlayers, function (id, video) { 290 video.player = new Vimeo.Player(video.player); 291 292 $('#video-modal-' + video.id).on('show.bs.modal', function (e) { 293 window.videoPlayers[video.id].player.play(); 294 }); 295 296 $('#video-modal-' + video.id).on('hide.bs.modal', function (e) { 297 window.videoPlayers[video.id].player.pause(); 298 }); 299 }); 300}); 301 302 303// ======Do Not Insert Inside Document ready Jquery Function===== 304var handleHeadingHover = function (item, idTarget) { 305 var sectionId = '#' + idTarget; 306 item.hover( 307 function (e) { 308 $(sectionId).addClass('hovered'); 309 }, 310 function (e) { 311 $(sectionId).removeClass('hovered'); 312 } 313 ); 314}; 315 316 317 318var handleSvgHover = function (svgtarget, dataName) { 319 $(svgtarget).hover( 320 function (e) { 321 var target = $(this).attr('id'), 322 dataTarget = $('ul [' + dataName + "='" + target + "']"); 323 324 dataTarget.addClass('hovered'); 325 }, 326 function (e) { 327 var target = $(this).attr('id'), 328 dataTarget = $('ul [' + dataName + "='" + target + "']"); 329 330 dataTarget.removeClass('hovered'); 331 } 332 ); 333 334 var descriptionTargets = $('ul [' + dataName + ']'); 335 descriptionTargets.each(function (index) { 336 var idName = $(this).attr(dataName); 337 338 handleHeadingHover($(this), idName); 339 }); 340}; 341 342$('.container a').click(function () { 343 var anchorname = $(this).attr('href'); 344 var selectedNav = $('.selected').attr('href'); 345 346 //console.log(selectedNav); 347 //console.log("ANCHOR_NAME = " + anchorname); 348 if (selectedNav !== anchorname) { 349 var anchorclass = $(this).attr('class'); 350 if (anchorname && anchorname.indexOf('#') == 0 && anchorname.length > 1) { 351 if (anchorclass != 'question') { 352 var targetheightoffset = $(anchorname).offset().top; 353 354 if (targetheightoffset > window.scrollY) { 355 var animateTo = targetheightoffset + 1; 356 } else if (targetheightoffset < window.scrollY) { 357 var animateTo = targetheightoffset - 1; 358 } 359 jQuery('html,body').animate({ scrollTop: animateTo }, "slow"); 360 } 361 } 362 } 363 364}); 365 366// ====================================================
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.