1(function($){ 2function initGlobal(){ //use this for global listeners, and stuff that doesn't need to wait for document ready 3 // scroll menu 4 $(document).on('scroll', '#menu', function(){ 5 var t = $(this).scrollTop(); 6 $('#menu-secondary').css('top', (t * -1) + 'px'); 7 }); 8 function closeDropdownIfEventOutside(e){ 9 var $expanded = $('[data-dropdown-menu].dropdown-menu-expanded') 10 if(!$expanded.length) return; 11 if($(e.target).is('[data-dropdown-menu],.dropdown-menu,.dropdown-menu-target').length) return; 12 if($(e.target).closest('[data-dropdown-menu],.dropdown-menu,.dropdown-menu-target').length) return; 13 $expanded.trigger('click'); 14 } 15 $(document).on('click focusin', closeDropdownIfEventOutside); 16 17 function closeMobileMenuIfEventOutside(e){ 18 var $toggled = $('.ast-mobile-menu-trigger-minimal.toggled') 19 if(!$toggled.length) return; 20 if($(e.target).is('.ast-mobile-menu-trigger-minimal,.ast-builder-menu-mobile').length) return; 21 if($(e.target).closest('.ast-mobile-menu-trigger-minimal,.ast-builder-menu-mobile').length) return; 22 $toggled.trigger('click'); 23 } 24 $(document).on('click focusin', closeMobileMenuIfEventOutside); 25} 26function langSwitcher(){ 27 $('.switcher a').first().trigger('click'); //this gets the images to load -- we are doing some fancy CSS to make the lang switcher more accessible, and can't wait around for a "click" event 28} 29function initMainNav(){ 30 /* 31 //Apparently this is old menu code... 32 // nav 33 $('#menu').not('.js-drop-menu-processed').addClass('js-drop-menu-processed').menu({ 34 offcanvas:{ 35 style: 'left', 36 canvas: '#container', 37 blur: true, 38 blurfilter: '.ui-pop-out-menu, .ui-pop-out-menu *' 39 }, 40 expand: { 41 enabled: true, 42 button: false, 43 single: true 44 }, 45 oninit: function(menu){ 46 menu.find('ul li ul li > [aria-expanded]').each(function(){ 47 var button = $(this).addClass('ui-pop-out-menu-button'); 48 var ul = button.siblings('ul').eq(0).clone(); 49 var color = 'default'; 50 var classes = button.parent().parent().parent().attr('class').split(' '); 51 for(var i = 0; i < classes.length; i++){ 52 if(classes[i].indexOf('menu-page-color-') >= 0){ 53 color = classes[i]; 54 break; 55 } 56 } 57 ul.addClass('ui-pop-out-menu').addClass('pop-' + color).appendTo('body'); 58 button.on('menu-position', function(e){ 59 ul.css('height', 'auto'); 60 var o = $(this).offset(); 61 var w = $(this).width(); 62 var h = $(this).height(); 63 var t = o.top; 64 var l = o.left + w + 30; 65 var win = $(window); 66 var wh = win.height(); 67 var ulh = ul.outerHeight(); 68 var auto = true; 69 if(t + ulh - win.scrollTop() > wh){ 70 t = wh - ulh + win.scrollTop(); 71 } 72 if(ulh > wh){ 73 t = win.scrollTop(); 74 auto = false; 75 } 76 if(t < 0){ 77 t = 0; 78 } 79 ul.css({ 80 top: t + 'px', 81 left: l + 'px', 82 height: auto ? 'auto' : wh + 'px' 83 }); 84 }); 85 button.on('click', function(e){ 86 ul.toggleClass('ui-pop-out-menu-active'); 87 $(this).trigger('menu-position'); 88 }); 89 }); 90 }, 91 ontoggle: function(menu, active){ 92 $('.ui-menu-active:not(#menu)').trigger('menu-toggle'); 93 $('#menu .ui-menu-section-btn-active').trigger('click'); 94 } 95 }); 96 */ 97} 98 99 100// fixed context nav 101function fixContextNav(){ 102 //what is this? do we miss it now that I commented it out? 103 104 /* 105 var w = $(window); 106 var context = $('#context'); 107 var container = $('#container'); 108 var fixed = false; 109 function setcontext(y){ 110 if(w.width() >= 992){ 111 if(!fixed){ 112 context.addClass('fixed'); 113 fixed = true; 114 } 115 container.css({ 116 paddingTop: y + 'px' 117 }); 118 } 119 else if(fixed){
120 context.removeClass('fixed'); 121 container.css({ 122 paddingTop: '0px' 123 }); 124 fixed = false; 125 } 126 }; 127 setcontext(context.outerHeight()); 128 if(context.size() > 0){ 129 w.on('resize', function(){ 130 setcontext(context.outerHeight()); 131 }); 132 } 133 */ 134} 135 136// on menu toggle 137function onmenutoggle(menu, active){ 138 //console.log('onmenutoggle(' + menu + ', ' + active + ')'); 139 if(active){ 140 141 // close other menus 142 if(menu.closest('#menu-secondary').size() > 0){ 143 menu.closest('#menu-secondary').find('.ui-menu-active').not(menu).trigger('menu-toggle'); 144 } 145 else{ 146 $('.ui-menu-active').not(menu).trigger('menu-toggle'); 147 } 148 149 // max height 150 var h = $(window).height(); 151 var o = menu.offset().top; 152 var y = $(document).scrollTop(); 153 menu.css('max-height', (h - o + y) + 'px'); 154 155 // focus on search 156 if(menu.is('.search')){ 157 menu.find('.searchinput').focus(); 158 } 159 160 } 161} 162 163// context drop-down 164function initContextMenu(){ 165 var contextmenu = $('#context-menu'); 166 if(contextmenu.is('.js-context-menu')) return; 167 contextmenu.addClass('context-menu'); 168 contextmenu.menu({ 169 expand: { 170 enabled: true, 171 button: false, 172 single: true, 173 label: '<span class="label">Toggle menu</span><span class="expand-icon fas fa-angle-right"></span>' 174 }, 175 oninit: function(menu){ 176 menu.find('ul li > [aria-expanded]').each(function(){ 177 var button = $(this).addClass('ui-pop-out-menu-button'); 178 var ul = button.siblings('ul').eq(0).clone(); 179 ul.addClass('ui-pop-out-menu ui-pop-out-menu-context').appendTo('body'); 180 button.on('menu-position', function(e){ 181 ul.css('height', 'auto'); 182 var o = $(this).offset(); 183 var w = $(this).width(); 184 var h = $(this).height(); 185 var t = o.top; 186 var l = o.left + w + 19; 187 var win = $(window); 188 var wh = win.height(); 189 var ulh = ul.outerHeight(); 190 var auto = true; 191 if(t + ulh - win.scrollTop() > wh){ 192 t = wh - ulh + win.scrollTop(); 193 } 194 if(ulh > wh){ 195 t = win.scrollTop(); 196 auto = false; 197 } 198 if(t < 0){ 199 t = 0; 200 } 201 ul.css({ 202 top: t + 'px', 203 left: l + 'px', 204 height: auto ? 'auto' : wh + 'px' 205 }); 206 }); 207 button.on('click', function(e){ 208 ul.toggleClass('ui-pop-out-menu-active'); 209 $(this).trigger('menu-position'); 210 }); 211 }); 212 }, 213 ontoggle: function(menu, active){ 214 //console.log('context menu ontoggle...'); 215 onmenutoggle(menu, active); 216 $('#context-menu .ui-menu-section-btn-active').trigger('click'); 217 } 218 }); 219} 220 221function initDropDowns(){ 222 //console.log('initDropDowns()'); 223 // drop-down menus 224 var $newMenus = $('.drop-menu:not(#context-menu)').not('.js-drop-menu-processed').addClass('js-drop-menu-processed').menu({ 225 ontoggle: function(menu, active){ 226 //console.log('initDropDowns = ontoggle: ' + menu + ', ' + active); 227 onmenutoggle(menu, active); 228 } 229 }); 230 var $newMenus2 = $('[data-dropdown-menu]').not('.js-dropdown-menu-processed').addClass('js-dropdown-menu-processed').on('click', function(){ 231 var expanded = $(this).is('.dropdown-menu-expanded'); 232 expanded = !expanded; 233 $(this).attr('aria-expanded', expanded); 234 $(this)[expanded ? 'addClass' : 'removeClass']('dropdown-menu-expanded'); 235 //console.log('new expanded: ' + expanded + ', id = ' + $(this).attr('data-dropdown-menu')); 236 $('#' + $(this).attr('data-dropdown-menu')).addClass('dropdown-menu-target')[expanded ? 'show' : 'hide'](); 237 }); 238 239 240 //console.log('initDropDowns() new menus=' + $newMenus.length); 241} 242 243// video wrappers 244function wrapVideos(){ 245 $('iframe[src^="https://www.youtube.com/embed/"]').not('.js-has-video-wrapper').addClass('js-has-video-wrapper').wrap('<div class="video-wrapper"></div>'); 246} 247 248function scrollingStuff(){ 249 // measure content 250 var measure = { 251 'container': $('#container'), 252 'main': $('#main'), 253 'content': $('#content'), 254 'pageimage': $('.page-image:eq(0)'), 255 'hero': $('.hero:eq(0)') 256 }; 257 var measurecontent = function(){ 258 return { 259 container: { 260 top: measure.container.size() > 0 ? measure.container.offset().top : 0, 261 padding: { 262 top: measure.container.size() > 0 ? parseInt(measure.container.css('padding-top')) : 0 263 } 264 }, 265 main: { 266 top: measure.main.size() > 0 ? measure.main.offset().top : 0, 267 padding: { 268 top: measure.main.size() > 0 ? parseInt(measure.content.css('padding-top')) : 0 269 } 270 }, 271 sidebar: { 272 height: leftsidebar.size() > 0 ? leftsidebar.outerHeight() : 0 273 }, 274 image: { 275 height: measure.pageimage.size() > 0 ? measure.pageimage.height() : 0 276 }, 277 hero: { 278 height: measure.hero.size() > 0 ? measure.hero.height() : 0 279 } 280 }; 281 }; 282 283 // scroll to anchor 284 var scrollToAnchor = function(selector, animate){ 285 var target = $(selector).eq(0); 286 if(target.size() == 0){ 287 target = $('a[name="' + selector.replace('#', '') + '"]').eq(0); 288 } 289 if(target.size() > 0){ 290 var o = target.offset(); 291 var scrollTo = o.top - contentsize.container.top - contentsize.container.padding.top - 20; 292 if(scrollTo < 0){ 293 scrollTo = 0; 294 } 295 $('html,body').stop().animate({ 296 scrollTop: scrollTo 297 }, animate ? 400 : 0); 298 } 299 }; 300 $('#content a[href^="#"]').not('.ui-menu-btn').on('click', function(e){
301 e.preventDefault(); 302 scrollToAnchor($(this).attr('href'), true); 303 }); 304 305 // scrolling left nav 306 var leftsidebar = $('#sidebar-left'); 307 var leftfixed = false; 308 var contentsize = measurecontent(); 309 /*var fixleft = function(){ 310 if(!leftfixed && $(window).width() >= 768 && contentsize.sidebar.height < $(window).height()){ 311 leftfixed = true; 312 $('#sidebar-left').addClass('sidebar-fixed'); 313 scrollleft(); 314 } 315 else if(leftfixed && ($(window).width() < 768 || contentsize.sidebar.height > $(window).height())){ 316 leftfixed = false; 317 $('#sidebar-left').removeClass('sidebar-fixed').css('top', '0px'); 318 } 319 }; 320 var scrollleft = function(){ 321 if(leftfixed){ 322 var t = $(window).scrollTop() - contentsize.image.height - contentsize.hero.height; 323 if(t < 0){ 324 t = 0; 325 } 326 leftsidebar.css('top', t + 'px'); 327 } 328 }; 329 if(leftsidebar.size() > 0){ 330 //fixleft(); 331 $(window).on('scroll', function(){ 332 scrollleft(); 333 }); 334 $(window).on('resize', function(){ 335 contentsize = measurecontent(); 336 //fixleft(); 337 scrollleft(); 338 }); 339 }*/ 340 measure.pageimage.children('img').on('load', function(){ 341 contentsize = measurecontent(); 342 fixleft(); 343 scrollleft(); 344 }); 345 346 // scroll to hash on page load 347 $(window).on('hashchange', function(){ 348 if(window.location.hash){ 349 scrollToAnchor(window.location.hash, false); 350 } 351 }); 352 if(window.location.hash){ 353 var isIE = window.navigator.appName == 'Microsoft Internet Explorer' || (window.navigator.appName == 'Netscape' && window.navigator.userAgent.indexOf('Trident') > -1); 354 var waitTime = 1 * (isIE ? 100 : 1); 355 window.setTimeout(function(){ 356 scrollToAnchor(window.location.hash, false); 357 }, waitTime); 358 } 359} 360 361function mediaQueries(){ 362 // media queries 363 if(!window.matchMedia) return; 364 365 // breakpoints 366 var xs = window.matchMedia('(min-width: 480px)'); 367 var sm = window.matchMedia('(min-width: 768px)'); 368 var md = window.matchMedia('(min-width: 992px)'); 369 var lg = window.matchMedia('(min-width: 1200px)'); 370 var xl = window.matchMedia('(min-width: 1400px)'); 371 372 // small+ screens 373 var smallScreens = function(mq){ 374 375 // ââ°Â¥ 768px 376 if(mq.matches){ 377 378 // position pop-outs 379 $('.ui-pop-out-menu-button').trigger('menu-position'); 380 381 // content height 382 if(!$('body').is('.home,.no-context-nav')){ 383 $('#content').css('min-height', ($(window).height() - 352 - ($('body').hasClass('admin-bar') ? 32 : 0)) + 'px'); 384 } 385 386 } 387 388 // < 768px 389 else{ 390 391 // content height 392 if(!$('body').is('.home,.no-context-nav')){ 393 $('#content').css('min-height', ($(window).height() - 311 - ($('body').hasClass('admin-bar') ? 46 : 0)) + 'px'); 394 } 395 396 } 397 398 }; 399 400 // large+ screens 401 var largeScreens = function(mq){ 402 403 // ââ°Â¥ 1200px 404 if(mq.matches){ 405 406 // return secondaries 407 $('#our-branches-container,#research-foundations-link').prependTo('#header-secondary'); 408 $('#one-ilsi').appendTo('#header-secondary'); 409 410 } 411 412 // < 1200px 413 else{ 414 415 // move secondaries 416 $('#our-branches-container,#research-foundations-link,#one-ilsi').appendTo('#menu-secondary'); 417 418 } 419 420 }; 421 422 // extra large+ screens 423 var extraLargeScreens = function(mq){ 424 425 // ââ°Â¥ 1400px 426 if(mq.matches){ 427 428 // return languages 429 $('#language-select-container').prependTo('#header-secondary'); 430 431 } 432 433 // < 1400px 434 else{ 435 436 // move languages 437 $('#language-select-container').appendTo('#menu'); 438 439 } 440 441 }; 442 443 // listeners 444 sm.addListener(smallScreens); 445 lg.addListener(largeScreens); 446 xl.addListener(extraLargeScreens); 447 448 // init 449 smallScreens(sm); 450 largeScreens(lg); 451 extraLargeScreens(xl); 452 453} 454 455// hero carousel 456function heroCarousel(){ 457 var animate = parseInt($('#animate-heroes').val()); 458 $('.heroes').not('.js-hero-carousel').addClass('js-hero-carousel').carousel({ 459 navigation: true, 460 autoplay: animate, 461 loop: true 462 }); 463} 464function adjustHeroHeightIfAdminBar(){ 465 var adminBarHeight = $('#wpadminbar').height(); 466 var headerHeight = $('header').height(); 467 var heroHeight = $('.hero').height(); 468 var windowHeight = $(window).height(); 469 470 if(windowHeight < adminBarHeight+headerHeight+heroHeight){ 471 $('.hero').height(windowHeight-adminBarHeight-headerHeight); 472 } 473} 474 475 476// pin select 477function pinSelect(){ 478 var activehighlight = ''; 479 $('.pin-flag').not('.js-pin-select').addClass('js-pin-select').on('click', function(e){
480 481 // get pin data 482 var highlight = $(this).siblings('.pin-map').html(); 483 var overlay = $(this).siblings('.pin-overlay').html(); 484 activehighlight = highlight; 485 486 // display content 487 $('#one-map-highlight').empty().append(highlight).addClass('ui-active'); 488 $('#one-map-overlay').empty().append(overlay).addClass('ui-active'); 489 490 // close 491 var close = $('<a id="close-overlay" href="#close"><span class="sr-only">Close panel</span><i class="fas fa-times"></i></a>'); 492 close.on('click', function(e){ 493 e.preventDefault(); 494 $('#one-map-highlight,#one-map-overlay').removeClass('ui-active'); 495 }); 496 $('#one-map-overlay').append(close); 497 498 }); 499} 500 501// hover 502function pinHighlight(){ 503 $('.pin-flag').not('.js-pin-highlight').addClass('js-pin-highlight').on('mouseenter', function(){ 504 505 // get pin data 506 var highlight = $(this).siblings('.pin-map').html(); 507 508 // display content 509 $('#one-map-highlight').empty().append(highlight).addClass('ui-active'); 510 511 }).on('mouseleave', function(){ 512 513 // panel active 514 if($('#one-map-overlay').hasClass('ui-active')){ 515 $('#one-map-highlight').empty().append(activehighlight); 516 } 517 518 // inactive 519 else{ 520 $('#one-map-highlight').empty().removeClass('ui-active'); 521 } 522 523 }); 524} 525// add pins to mobile select menu 526function addPinsToMobileSelectMenu(){ 527 var select = $('#one-map-select'); 528 $('#pins > .pin').each(function(i){ 529 var label = $(this).find('.pin-flag-label').html(); 530 select.append('<li><a href="#' + i + '" data-map="' + i + '">' + label + '</a></li>'); 531 }); 532 $('[data-map]').not('.js-map-has-click').addClass('js-map-has-click').on('click', function(e){ 533 e.preventDefault(); 534 var i = $(this).attr('data-map'); 535 $('#pins > .pin').eq(i).children('.pin-flag').trigger('click'); 536 }); 537} 538function ilsi_bb_sticky_column(){ 539 $(".fl-module.sticky").each(function(){ 540 $(this).closest(".fl-col").addClass("sticky-bb-column"); 541 }); 542} 543initGlobal(); 544$(initMainNav); 545$(fixContextNav); 546$(initContextMenu); 547$(initDropDowns); 548$(wrapVideos); 549$(scrollingStuff); 550$(mediaQueries); 551$(heroCarousel); 552$(pinSelect); 553$(pinHighlight); 554$(addPinsToMobileSelectMenu); 555$(window).on('load', ilsi_bb_sticky_column); 556$(window).on('load', langSwitcher); 557$(window).on('load', adjustHeroHeightIfAdminBar); 558 559}(jQuery));
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.