1(function ($) { 2 var BREAKPOINTS = [ 3 { name: "small", size: 768 }, 4 { name: "medium", size: 992 }, 5 { name: "large", size: 1200 }, 6 ]; 7 function isBreakpoint(size) { 8 var thisSize = BREAKPOINTS.filter(function (breakpoint) { 9 return breakpoint.name === size; 10 }); 11 return $(window).width() > thisSize[0].size ? false : true; 12 } 13 14 // helper function to check for a horizontal scrollbar 15 $.fn.hasScrollBarX = function () { 16 return this.get(0).scrollWidth - this.parent().width() > 5; 17 }; 18 19 function checkBreakpoint(pixels) { 20 return $(window).width() < pixels ? true : false; 21 } 22 23 // Check if you are using a mobile browser 24 var isMobile = false; //initiate as false 25 // device detection 26 if ( 27 /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test( 28 navigator.userAgent 29 ) || 30 /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
31 navigator.userAgent.substr(0, 4) 32 ) 33 ) 34 isMobile = true; 35 36 // ACCORDIONS 37 // adds attributes to make them collapsible 38 var accordion_call = function () { 39 var accordions = [ 40 ...document.querySelectorAll( 41 ".paragraph--type--accordion, .sub-accordion" 42 ), 43 ]; 44 accordions.map(function (accordion, index) { 45 accordion.setAttribute("id", "accordion_" + index); 46 var links = [...accordion.querySelectorAll("a.accordion-toggle")]; 47 links.map(function (link, linkIndex) { 48 link.setAttribute("data-parent", "accordion_" + index); 49 link.setAttribute("href", "#collapse_" + index + "_" + linkIndex); 50 }); 51 var contents = [ 52 ...accordion.querySelectorAll( 53 ".field--name-field-accordion-section-content, .sub-accordion-section-content" 54 ), 55 ]; 56 contents.map(function (content, contentIndex) { 57 content.setAttribute("id", "collapse_" + index + "_" + contentIndex); 58 content.classList.add("collapse"); 59 }); 60 }); 61 $('[data-toggle="collapse"]').click(function () { 62 $(".collapse.in").collapse("hide"); 63 }); 64 }; 65 // wrap the accordion call in a function so HR form sorter views filter can use it 66 accordion_call(); 67 68 // opens all accordion bodies on press - ctrl+f, cmd+f, or F3 69 window.addEventListener("keydown", function (e) { 70 if (e.keyCode === 114 || ((e.ctrlKey || e.metaKey) && e.keyCode === 70)) { 71 [...document.querySelectorAll("a.accordion-toggle")].map(function ( 72 title 73 ) { 74 title.classList.remove("collapsed"); 75 }); 76 [ 77 ...document.querySelectorAll( 78 ".field--name-field-accordion-section-content, .sub-accordion-section-content" 79 ), 80 ].map(function (content) { 81 content.classList.add("in"); 82 content.style.height = ""; // when collapsing content, height=15px is added. remove or else text will overlap. 83 }); 84 // open all tabs too... 85 $("div.tab-content > .tab-pane").addClass("active"); 86 } 87 }); 88 89 $(window).resize(function () { 90 if (window.location.href.indexOf("law") > -1) { 91 if ($(window).width() >= 992) { 92 $(".page-head .container > div").css("width", "auto"); 93 } 94 } 95 }); 96 97 $(document).ready(function () { 98 if (isMobile) { 99 $(".field--name-field-accordion-section-title > .h3").click((event) => { 100 setTimeout(function () { 101 $([document.documentElement, document.body]).animate( 102 { 103 scrollTop: $(event.target).offset().top, 104 }, 105 100 106 ); 107 }, 350); 108 }); 109 } 110 111 //Fix aria-atomic accessibility issue on div tags 112 $("div[role=alert]").each(function () { 113 if (!$(this).attr("aria-atomic")) { 114 $(this).attr("aria-atomic", "true"); 115 } 116 }); 117 $("div[aria-live=assertive]").each(function () { 118 if (!$(this).attr("aria-atomic")) { 119 $(this).attr("aria-atomic", "true"); 120 } 121 }); 122 123 // fix slick_slide aria-describedby issue 124 if ($(".slick").length > 0) { 125 $(".slick").each(function () { 126 $(this) 127 .find(".slick__slide[aria-describedby^='slick']") 128 .each(function () { 129 var idHolder = $(this).attr("aria-describedby"); 130 $(this).find("img").attr("id", idHolder); 131 }); 132 133 // move gallery arrows to center of img instead of img+caption 134 var galleryHeight = $(this).find(".slick__slider").first().height(); 135 var imgHeight = $(this).find(".slick__slide img").first().height() / 2; 136 var newHeight = Math.round((imgHeight * 100) / galleryHeight) + "%"; 137 $(this).find(".slick__arrow").css("top", newHeight); 138 139 if ($(".youtube-icon").length > 0 && $(".slick__arrow").length > 0) { 140 $(this).find(".object").css({ top: newHeight, "margin-top": "32px" }); 141 } 142 }); 143 } 144 145 // if sidebar is taller than content, show gray border on sidebar instead 146 var sidebarHolder = $(".sidebar-desktop"); 147 var contentHolder = $(".has-sidebar"); 148 if (sidebarHolder.height() > contentHolder.height()) { 149 contentHolder.css("border-left", "none"); 150 sidebarHolder.css({ 151 "margin-bottom": "0px", 152 "padding-bottom": "36px", 153 "border-right": "1px solid $lighter-gray", 154 }); 155 } 156 157 if ($(".content-col").length && $(".sidebar-col").length) { 158 window.setTimeout(rightSidebarBorder, 200); 159 var tryThreeTimes = 0; 160 function rightSidebarBorder() { 161 var contentCol = $(".content-col"); 162 var rightSidebarCol = $(".sidebar-col"); 163 if ( 164 rightSidebarCol.height() > contentCol.height() && 165 tryThreeTimes <= 3 166 ) { 167 contentCol.removeClass("border-right"); 168 rightSidebarCol.addClass("border-left"); 169 } else { 170 tryThreeTimes++; 171 window.setTimeout(rightSidebarBorder, 200); 172 } 173 } 174 } 175 176 // hide asides if they are empty (no content) 177 if ($(".paragraph--type--aside").length > 0) { 178 $(".paragraph--type--aside").each(function () { 179 if ($(this.clientHeight)[0] <= 2) { 180 $(this).css("display", "none"); 181 } 182 }); 183 } 184 185 // move asides down on basic page 186 var movedDown = false;
187 function moveAside() { 188 if ($(".basic-page .field--name-field-aside-ref").length > 0) { 189 aside = $(".basic-page .field--name-field-aside-ref"); 190 191 if (checkBreakpoint(991) && !movedDown) { 192 $(".basic-page > .content").append(aside); 193 movedDown = true; 194 } else if (!checkBreakpoint(991) && movedDown) { 195 $(".basic-page > .content").prepend(aside); 196 movedDown = false; 197 } 198 } 199 } 200 moveAside(); 201 202 $(window).resize(function () { 203 moveAside(); 204 }); 205 206 // re-group accordions when HR form exposed filter is in use, maybe this should go to HR's js dir... 207 if ($(".sub-accordion").length > 0) { 208 $(document).ajaxSuccess(function () { 209 accordion_call(); 210 }); 211 } 212 213 // external link goes to new tab 214 $(".content a") 215 .filter(function () { 216 return ( 217 this.hostname && 218 this.hostname !== location.hostname && 219 this.hostname.indexOf("case.edu") == -1 220 ); 221 }) 222 .attr("target", "_blank"); 223 224 // lock icon for private files TODO: this is not working now probably because linkit generates the media file link after this script is run, thus unable to match the actual href... 225 // $('.content a').append("<span class='fa fa-lock'> </span>"); 226 227 //tabs 228 if ($(".field--item .tab-group").length) { 229 $(".field--item .tab-group").each(function () { 230 $(this).find(".nav-tabs li a").first().tab("show"); 231 // TABDROP IS OFF: CURRENTLY ONLY WORK IF TABS ARE FIRST PARAGRAPH ON PAGE 232 // $(this).find($('.nav-tabs')).tabdrop({ 233 // text: '<i class="fa fa-ellipsis-v" aria-hidden="true"></i> <i class="fa fa-angle-down" aria-hidden="true"></i>' 234 // }); 235 }); 236 } 237 238 // responsive tables 239 if ($(".content table").length) { 240 $(".content table").each(function () { 241 if (!$(this).attr("class")) { 242 $(this) 243 .wrap("<div class='table-responsive'></div>") 244 .css("margin-bottom", "0"); 245 } 246 if ($(this).hasScrollBarX()) 247 $(this).parent().addClass("has-scrollbar-x"); 248 }); 249 } 250 $(".has-scrollbar-x").on("scroll", function () { 251 $(this).removeClass("has-scrollbar-x"); 252 }); 253 254 //make acquia content hub page links (bio/personal_profile) open in a new tabs 255 if ($(".toolbar-menu").length > 0) { 256 // hide extra menu links for media 257 linkholder = $( 258 'a[data-drupal-link-system-path="admin/content/media"]' 259 )[0].href.replace("admin/content/media", "media/add"); 260 // $('a[data-drupal-link-system-path="admin/content/media"]').parent().addClass("menu-item--expanded").append('<ul class="toolbar-menu"><li class="menu-item"><a href="' + linkholder + '" class="toolbar-icon" data-drupal-link-system-path="media/add">Add Media</a></li></ul>'); 261 $('a[data-drupal-link-system-path="media/add"]+ul li').hide(); 262 $( 263 'a[data-drupal-link-system-path="media/add"]+ul a[data-drupal-link-system-path="media/add/document"]' 264 ) 265 .parent() 266 .show(); 267 $( 268 'a[data-drupal-link-system-path="media/add"]+ul a[data-drupal-link-system-path="media/add/image"]' 269 ) 270 .parent() 271 .show(); 272 if ( 273 $( 274 'a[data-drupal-link-system-path="media/add"]+ul a[data-drupal-link-system-path*="media/add/private_file"]' 275 ).length > 0 276 ) { 277 $( 278 'a[data-drupal-link-system-path="media/add"]+ul a[data-drupal-link-system-path*="media/add/private_file"]' 279 ) 280 .parent() 281 .show(); 282 } 283 284 // add content hub links to all sites, and sort them alphabetically 285 //bio_link = '<li class="menu-item"><a href="http://cwru.prod.acquia-sites.com/biographies/caslogin" class="toolbar-icon">Biographies - Content Hub</a></li>'; 286 //$('a.toolbar-icon-admin-toolbar-tools-extra-linksnode-add+ul').append(bio_link); 287 // pp_link = '<li class="menu-item"><a href="http://cwru.prod.acquia-sites.com/personalprofiles/caslogin" class="toolbar-icon">Personal Profiles - Content Hub</a></li>'; 288 // $('a.toolbar-icon-admin-toolbar-tools-add-content+ul').append(pp_link); 289 290 // function asc_sort(a, b) { 291 // return ($(b).text()) < ($(a).text()) 292 // ? 1 293 // : -1; 294 // } 295 //$('a.toolbar-icon-admin-toolbar-tools-extra-linksnode-add+ul li').sort(asc_sort).appendTo('a.toolbar-icon-admin-toolbar-tools-extra-linksnode-add+ul'); 296 // make sure they open in new tabs 297 //$('.toolbar-menu a[href="http://cwru.prod.acquia-sites.com/biographies/caslogin"], ' + '.toolbar-menu a[href="http://cwru.prod.acquia-sites.com/personalprofiles/caslogin"]').attr("target", "_blank"); //dev ENV 298 } 299 300 // break up article date into spans so they can be styled 301 if ( 302 $(".recent-news-rebranded .views-field-field-article-date").length > 0 303 ) { 304 $( 305 ".recent-news-rebranded .views-field-field-article-date .field-content" 306 ).each(function () { 307 $(this).html($(this).text); 308 }); 309 } else if ($(".views-field-field-article-date").length > 0) { 310 $(".views-field-field-article-date .field-content").each(function () { 311 var split = $(this).text().trim().split(" "); 312 var monthwrap = "<span class='month'>" + split[0] + "</span>"; 313 var daywrap = "<span class='day'>" + split[1] + "</span>"; 314 $(this).html(monthwrap + daywrap); 315 }); 316 } 317 318 //article date for Rebranded news 319 320 if ($("#edit-current").length > 0) { 321 $("#edit-current > label")[0].innerText = "Current State"; 322 $("#edit-submit")[0].innerText = "Apply"; 323 } 324 325 var departmentsPage = $(".view-student-life-departments"); 326 function departmentDropdowns() { 327 if (departmentsPage.length > 0) { 328 $("fieldset>legend").click(function () { 329 if (checkBreakpoint(991)) { 330 $(this).next().slideToggle(); 331 } 332 }); 333 $(":checked").each(function () { 334 $(this).parentsUntil("fieldset").css("display", "block"); 335 }); 336 } 337 } 338 var successcounter = 0; 339 function scrollIntoView() { 340 if (departmentsPage.length > 0 && isMobile) { 341 $("html,body").animate({ 342 scrollTop: 343 $(".view-content>.sl-view-block").first().offset().top - 20, 344 }); 345 } 346 } 347 348 function scrollView(scrollBelow) { 349 $("html,body").animate({ scrollTop: scrollBelow.offset().top - 20 }); 350 } 351 352 var cancerView = $(".cancer-list-view"); 353 354 departmentDropdowns(); 355 $(document).ajaxSuccess(function () { 356 departmentDropdowns(); 357 scrollIntoView(); 358 if (successcounter > 1 && cancerView.length > 0 && isMobile) { 359 scrollView($(".view-content")); 360 } 361 successcounter++; 362 }); 363 }); 364 365 // Mobile Menu Fixes 366 $(".arrow").click(function (e) { 367 e.preventDefault(); 368 var menu = $(this).parent().next("ul"); 369 menu.is(":visible") ? menu.slideUp(300) : menu.slideDown(300); 370 }); 371 372 // if dropdown menu is off-page, move left 373 if ($("#block-crew-main-menu .expanded.dropdown").length > 0) { 374 var navWidth = $(".navbar-header").width(); 375 var lastDropdown = $("#block-crew-main-menu .expanded.dropdown").last(); 376 var lastDropdownLeft = lastDropdown[0].offsetLeft; 377 var lastDropdownMenu = lastDropdown.find("ul.dropdown-menu"); 378 var lastDropdownWidth = lastDropdownMenu.width(); 379 var dropdownExcess = navWidth - (lastDropdownLeft + lastDropdownWidth); 380 if (dropdownExcess < 0) { 381 lastDropdownMenu.addClass("pull-right"); 382 } 383 } 384 385 // Required for go to top button at the footer 386 var handleContentHeight = function () { 387 return; 388 var height; 389 390 if ($("body").height() < App.getViewPort().height) { 391 height = 392 App.getViewPort().height - 393 $(".page-header").outerHeight() - 394 ($(".page-container").outerHeight() - 395 $(".page-content").outerHeight()) - 396 $(".page-prefooter").outerHeight() - 397 $(".page-footer").outerHeight(); 398 399 $(".page-content").css("min-height", height); 400 } 401 }; 402 403 // Handles the go to top button at the footer 404 var handleGoTop = function () { 405 var offset = 100; 406 var duration = 500; 407 408 if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) { 409 // ios supported 410 $(window).bind("touchend touchcancel touchleave", function (e) { 411 if ($(this).scrollTop() > offset) { 412 $(".scroll-to-top").fadeIn(duration); 413 } else { 414 $(".scroll-to-top").fadeOut(duration); 415 } 416 }); 417 } else { 418 // general 419 $(window).scroll(function () { 420 if ($(this).scrollTop() > offset) { 421 $(".scroll-to-top").fadeIn(duration); 422 } else { 423 $(".scroll-to-top").fadeOut(duration); 424 } 425 }); 426 } 427 428 $(".scroll-to-top").click(function (e) { 429 e.preventDefault(); 430 $("html, body").animate( 431 { 432 scrollTop: 0, 433 }, 434 duration 435 ); 436 return false;
437 }); 438 }; 439 handleContentHeight(); // handles content height 440 handleGoTop(); //handles scroll to top functionality in the footer 441 442 //Rearranging page-header and hero image 443 if ($(".field--name-field-hero-landing-image-ref")[0]) { 444 if ($(".robust-content-small").length) { 445 $(".page-header").prependTo(".robust-content-small"); 446 } else if ($(".section-nav").length) { 447 // stop this from affecting sites with section-nav (law) 448 // return false; 449 } else { 450 $(".page-header").insertAfter(".paragraph--type--hero-landing-page"); 451 } 452 } 453 //Rearranging page-header and hero image 454 if ($(".field--name-field-hero-one-image-ref")[0]) { 455 if ($(".robust-content-small").length) { 456 $(".page-header").prependTo(".robust-content-small"); 457 } else { 458 $(".page-header").insertAfter(".paragraph--type--hero-one-column"); 459 } 460 } 461 462 //removes gray background from subfeature field item if there is no text in it 463 $(".field--name-field-subfeature-section-ref > .field--item").each( 464 function () { 465 if (!$(this).text().trim().length) { 466 $(".field--name-field-subfeature-section-ref > .field--item").css( 467 "background-color", 468 "white" 469 ); 470 } 471 } 472 ); 473 474 // mcintyre-lab homepage video width adjustment 475 if ($(".paragraph--view-mode--mcintyre-vid").length) { 476 $( 477 ".paragraph--view-mode--mcintyre-vid .field--name-field-video-embed .field--item" 478 ) 479 .removeClass("col-md-6") 480 .addClass("col-xs-12"); 481 } 482 483 // law school secondary nav styling 484 if (window.location.href.indexOf("law") > -1) { 485 if ($(window).width() >= 992) { 486 $(".page-head .container > div").css("width", "auto"); 487 } 488 } 489 490 // remove a 1px border on give website 491 if (window.location.href.indexOf("give") > -1) { 492 $(".page-head").css("border-bottom", "none"); 493 } 494 495 // hide alumni, students, and faculty-staff from dental main navigation & mobile 496 // console.log(drupalSettings.path.baseUrl); 497 if (window.location.href.indexOf("dental") > -1) { 498 $('ul[block="block-crew-main-menu"] a[href$="/student"]') 499 .parent() 500 .css("display", "none"); 501 $('ul[block="block-crew-main-menu"] a[href$="/alumni-friends"]') 502 .parent() 503 .css("display", "none"); 504 $('ul[block="block-crew-main-menu"] a[href$="/faculty-staff"]') 505 .parent() 506 .css("display", "none"); 507 } 508 509 // hide alumni, students, and faculty-staff from socialwork main navigation & mobile 510 // console.log(drupalSettings.path.baseUrl); 511 if (window.location.href.indexOf("socialwork") > -1) { 512 $( 513 'ul[block="block-crew-socialwork-main-menu"] a[href$="/resources-alumni"]' 514 ) 515 .parent() 516 .css("display", "none"); 517 $( 518 'ul[block="block-crew-socialwork-main-menu"] a[href$="/resources-students"]' 519 ) 520 .parent() 521 .css("display", "none"); 522 $( 523 'ul[block="block-crew-socialwork-main-menu"] a[href$="/resources-faculty-staff"]' 524 ) 525 .parent() 526 .css("display", "none"); 527 } 528 529 // hide secondary nav from weatherhead main navigation & mobile 530 // console.log(drupalSettings.path.baseUrl); 531 if (window.location.href.indexOf("weatherhead") > -1) { 532 $('ul[block="block-crew-weatherhead-main-menu"] a[href$="/students"]') 533 .parent() 534 .css("display", "none"); 535 $('ul[block="block-crew-weatherhead-main-menu"] a[href$="/alumni"]') 536 .parent() 537 .css("display", "none"); 538 $( 539 'ul[block="block-crew-weatherhead-main-menu"] a[href$="/faculty-and-staff"]' 540 ) 541 .parent() 542 .css("display", "none"); 543 $( 544 'ul[block="block-crew-weatherhead-main-menu"] a[href$="/corporate-partners"]' 545 ) 546 .parent() 547 .css("display", "none"); 548 $('ul[block="block-crew-weatherhead-main-menu"] a[href$="/employers"]') 549 .parent() 550 .css("display", "none"); 551 } 552 553 // hide alumni, students, and faculty-staff from medicine mstp main navigation & mobile 554 // console.log(drupalSettings.path.baseUrl); 555 if (window.location.href.indexOf("mstp") > -1) { 556 // $('ul[block="block-crew-main-menu"] a[href$="/alumni"]').parent().css("display", "none"); 557 $('ul[block="block-crew-main-menu"] a[href$="/current-students"]') 558 .parent() 559 .css("display", "none"); 560 // $('ul[block="block-crew-main-menu"] a[href$="/faculty-staff"]').parent().css("display", "none"); 561 } 562 563 // hide faculty-staff from pqhs main navigation & mobile 564 if (window.location.href.indexOf("pqhs") > -1) { 565 $( 566 'ul[block="block-crew-main-menu"] a[href$="/faculty-and-staff-resources"]' 567 ) 568 .parent() 569 .css("display", "none"); 570 } 571 572 // hide students and faculty-staff from neurosciences main navigation & mobile 573 // console.log(drupalSettings.path.baseUrl); 574 if (window.location.href.indexOf("medicine/neurosciences") > -1) { 575 // $('ul[block="block-crew-main-menu"] a[href$="/alumni"]').parent().css("display", "none"); 576 $('ul[block="block-crew-main-menu"] a[href$="/students"]') 577 .parent() 578 .css("display", "none"); 579 $('ul[block="block-crew-main-menu"] a[href$="/faculty-staff"]') 580 .parent() 581 .css("display", "none"); 582 } 583 584 // hide undergrad students and grad students from bme main navigation & mobile 585 // console.log(drupalSettings.path.baseUrl); 586 if (window.location.href.indexOf("bme") > -1) { 587 $('ul[block="block-crew-main-menu"] a[href$="/undergraduate-students"]') 588 .parent() 589 .css("display", "none"); 590 $('ul[block="block-crew-main-menu"] a[href$="/graduate-students"]') 591 .parent() 592 .css("display", "none"); 593 } 594 595 // add secondary nav to all DOSA sites 596 if (window.location.href.indexOf("studentlife") > -1) { 597 var secondaryNavHtml = `<div class="secondary-nav-container"> 598 <nav role="navigation" aria-labelledby="block-secondarynavigation-menu" id="block-secondarynavigation"> 599 <h2 class="visually-hidden" id="block-secondarynavigation-menu">Secondary navigation</h2> 600 <ul block="block-secondarynavigation" class="menu menu--secondary-navigation nav"> 601 <li class="first"> 602 <a href="https://my.case.edu/My/">My CWRU</a> 603 </li> 604 <li class="last"> 605 <a href="https://journey.case.edu/s/">My Journey</a> 606 </li> 607 </ul> 608 </nav> 609 </div>`; 610 611 $(".page-head .container .col-md-6") 612 .first() 613 .next() 614 .prepend(secondaryNavHtml); 615 } 616 //Add with-department class to all DOSA subsites 617 if ( 618 window.location.href.indexOf("studentlife/academicresources") > -1 || 619 window.location.href.indexOf("studentlife/accommodatedtesting") > -1 || 620 window.location.href.indexOf("studentlife/activities") > -1 || 621 window.location.href.indexOf("studentlife/careercenter") > -1 || 622 window.location.href.indexOf("studentlife/civicengagement") > -1 || 623 window.location.href.indexOf("studentlife/conduct") > -1 || 624 window.location.href.indexOf("studentlife/dean") > -1 || 625 window.location.href.indexOf("studentlife/disability") > -1 || 626 window.location.href.indexOf("studentlife/educationabroad") > -1 || 627 window.location.href.indexOf("studentlife/graduate") > -1 || 628 window.location.href.indexOf("studentlife/greek") > -1 || 629 window.location.href.indexOf("studentlife/healthcounseling") > -1 || 630 window.location.href.indexOf("studentlife/multicultural") > -1 || 631 window.location.href.indexOf("studentlife/residence") > -1 || 632 window.location.href.indexOf("studentlife/studentcenters") > -1 || 633 window.location.href.indexOf("studentlife/ugadvisingsupport") > -1 || 634 window.location.href.indexOf("studentlife/ugresearch") > -1 635 ) { 636 $(".secondary-nav-container").addClass("with-department"); 637 } 638 639 // hide members from cancer main navigation & mobile 640 // console.log(drupalSettings.path.baseUrl); 641 //if (drupalSettings.path.baseUrl == '/cancer/') { 642 // $('ul[block="block-crew-main-menu"] a[href$="/members"]').parent().css("display", "none"); 643 //} 644 645 // unhide additional job description from bstp site 646 if (window.location.href.indexOf("medicine/bstp") > -1) { 647 $(".paragraph--type--additional-job-descriptions div.hidden").removeClass( 648 "hidden" 649 ); 650 } 651 652 if (window.location.href.indexOf("bstp") > -1) { 653 $(".paragraph--type--additional-job-descriptions div.hidden").removeClass( 654 "hidden" 655 ); 656 } 657 658 // hide alumni and employers on postgrad site, modify title field to manually break before word 'and' 659 if (window.location.href.indexOf("studentlife/careercenter") > -1) { 660 $('ul[block="block-crew-main-menu"] a[href$="/alumni"]') 661 .parent() 662 .css("display", "none"); 663 $('ul[block="block-crew-main-menu"] a[href$="/employers"]') 664 .parent() 665 .css("display", "none"); 666 } 667 668 // hide alumni employers student and faculty&staff items on law site 669 if (window.location.href.indexOf("law") > -1) { 670 $('ul[block="block-crew-law-main-menu"] a[href$="/alumni"]') 671 .parent() 672 .css("display", "none"); 673 $('ul[block="block-crew-law-main-menu"] a[href$="/employers"]') 674 .parent() 675 .css("display", "none"); 676 $('ul[block="block-crew-law-main-menu"] a[href$="/faculty-staff"]') 677 .parent() 678 .css("display", "none"); 679 $('ul[block="block-crew-law-main-menu"] a[href$="/students"]') 680 .parent() 681 .css("display", "none"); 682 } 683 684 // hide members item on cancer site 685 if (window.location.href.indexOf("cancer") > -1) { 686 $('ul[block="block-crew-main-menu"] a[href$="/members"]') 687 .parent() 688 .css("display", "none"); 689 } 690 691 if ( 692 $(".paragraph--type--hero-one-column").length >= 2 && 693 $(".region-breadcrumbs .paragraph--type--hero-one-column").length >= 1 694 ) { 695 $(".homepage-w-sidebar .paragraph--type--hero-one-column").hide(); 696 } 697 698 // lifelonglearning want a second phone number... 699 if (window.location.href.indexOf("lifelonglearning") > -1) { 700 $(".footer__department-info p:nth-of-type(3) strong").html( 701 "Campus Office:" 702 ); 703 $(".footer__department-info p:nth-of-type(3)").append( 704 "<p><strong>Beachwood Office:</strong> <a href='tel:216.368.2091'>216.368.2091</a></p>" 705 ); 706 } 707 708 // fix comma issue for biographies 709 /* Ruiqi moved following logic into paragraph's twig 710 if ($(".field--name-field-biography-title-ref").length) { 711 $( 712 ".field--name-field-biography-title-ref .paragraph--type--job-title-affiliation" 713 ).each(function () { 714 var str = ""; 715 var fields = $(this).find(".field");
716 var total = fields.length; 717 718 fields.each(function (index) { 719 str += $(this).text().trim(); 720 if (index != total - 1) str += ", "; 721 }); 722 723 $(this).html("<strong>" + str + "</strong>"); 724 }); 725 } 726 */ 727 728 //Student Life Homepage Grid 729 $(".field--name-field-student-life-grid-descript").css("display", "none"); 730 $(".subfeature-grid-img-text").hover( 731 function () { 732 if (!checkBreakpoint(768)) { 733 $(this) 734 .find(".field--name-field-student-life-grid-descript") 735 .slideDown(); 736 } 737 }, 738 function () { 739 if (!checkBreakpoint(768)) { 740 $(this).find(".field--name-field-student-life-grid-descript").slideUp(); 741 } 742 } 743 ); 744 745 // studentlife department page set BEF default value via query parameter 746 if (window.location.pathname == "/studentlife/departments") { 747 var urlParams = new URLSearchParams(window.location.search); 748 // Return early in cases default value is not needed, such as a click on the main nav 749 if (!urlParams.has("key")) { 750 return; 751 } else { 752 var key = urlParams.get("key"); 753 var tid1 = ""; 754 // Map query parameters to term id which is used for filtering 755 switch (key) { 756 case "career": 757 tid1 = 736; 758 break; 759 case "academic": 760 tid1 = 731; 761 break; 762 case "campus": 763 tid1 = 941; 764 break; 765 case "community": 766 tid1 = 741; 767 break; 768 case "engagement": 769 tid1 = 726; 770 break; 771 case "health": 772 tid1 = 746; 773 break; 774 case "involvement": 775 tid1 = 751; 776 break; 777 case "pride": 778 tid1 = "756"; 779 break; 780 default: 781 tid1 = "empty"; 782 } 783 if (tid1 !== "empty") { 784 setTimeout(function () { 785 $("#edit-tid-1-" + tid1).trigger("click"); 786 }, 1000); 787 } 788 } 789 } 790 791 if (window.location.pathname == "/international/about/newsletters") { 792 $.fn.Feed = function () { 793 var id = $(this).attr("id"); 794 $("#" + id).empty(); 795 $.ajax({ 796 url: "https://community.case.edu/ISS/rss_emails?limit=5", 797 type: "GET", 798 dataType: "xml", 799 }).done(function (xml) { 800 getDataObject(xml); 801 }); 802 function getDataObject(data) { 803 const items = data.querySelectorAll("channel item"); 804 $.each(items, function (e, itm) { 805 const title = itm.querySelector("title").textContent; 806 const link = itm.querySelector("link").textContent; 807 const div = $("<ul></ul>"); 808 div.append(`<li><a href="${link}">${title}</a></li>`); 809 $("#" + id).append(div); 810 if (e == 4) { 811 return false; 812 } 813 }); 814 } 815 }; 816 $("#ISS-CG-Feed").Feed(); 817 } 818 819 if ( 820 $("form.webform-submission-transcript-and-mspe-request-form-add-form") 821 .length > 0 822 ) { 823 var t_flag = true; 824 var m_flag = true; 825 826 function check_t() { 827 $('div[data-drupal-selector="edit-transcript"]').click(function () { 828 var transcript_other = $( 829 'input[name="transcript_other"]:checked' 830 ).length; 831 var transcript_delivery_fax = $( 832 'input[name="transcript_delivery_fax"]:checked' 833 ).length; 834 var transcript_delivery_pickup = $( 835 'input[name="transcript_delivery_pickup"]:checked' 836 ).length; 837 var transcript_delivery_mail = $( 838 'input[name="transcript_delivery_mail"]:checked' 839 ).length; 840 if (transcript_other > 0) { 841 if ( 842 transcript_delivery_fax == 0 && 843 transcript_delivery_pickup == 0 && 844 transcript_delivery_mail == 0 845 ) { 846 t_flag = false; 847 if ( 848 $( 849 '[data-drupal-selector="edit-transcript-delivery"] .panel-title span' 850 ).length == 0 851 ) { 852 $( 853 '[data-drupal-selector="edit-transcript-delivery"] .panel-title' 854 ).append( 855 "<span style='color:red; font-size:.5em; padding-left: 1em;'>Please select an option below: </span>" 856 ); 857 } 858 } else { 859 t_flag = true; 860 $( 861 '[data-drupal-selector="edit-transcript-delivery"] .panel-title span' 862 ).remove(); 863 } 864 } else { 865 t_flag = true; 866 } 867 }); 868 } 869 870 function check_m() { 871 $('div[data-drupal-selector="edit-mspe"]').click(function () { 872 var mspe_other = $('input[name="mspe_other"]:checked').length; 873 var mspe_delivery_fax = $( 874 'input[name="mspe_delivery_fax"]:checked' 875 ).length; 876 var mspe_delivery_pickup = $( 877 'input[name="mspe_delivery_pickup"]:checked' 878 ).length; 879 var mspe_delivery_mail = $( 880 'input[name="mspe_delivery_mail"]:checked' 881 ).length; 882 if (mspe_other > 0) { 883 if ( 884 mspe_delivery_fax == 0 && 885 mspe_delivery_pickup == 0 && 886 mspe_delivery_mail == 0 887 ) { 888 m_flag = false;
889 if ( 890 $('[data-drupal-selector="edit-mspe-delivery"] .panel-title span') 891 .length == 0 892 ) { 893 $( 894 '[data-drupal-selector="edit-mspe-delivery"] .panel-title' 895 ).append( 896 "<span style='color:red; font-size:.5em; padding-left: 1em;'>Please select an option below: </span>" 897 ); 898 } 899 } else { 900 m_flag = true; 901 $( 902 '[data-drupal-selector="edit-mspe-delivery"] .panel-title span' 903 ).remove(); 904 } 905 } else { 906 m_flag = true; 907 } 908 }); 909 } 910 911 $('[data-drupal-selector="edit-order-information"] input').click( 912 function () { 913 check_t(); 914 check_m(); 915 setTimeout(function () { 916 flag(); 917 }, 200); 918 } 919 ); 920 921 function flag() { 922 // console.log("m is " + m_flag + " and t is " + t_flag); 923 if (m_flag == false || t_flag == false) { 924 $('button[name="op"]').prop("disabled", true); 925 } else { 926 $('button[name="op"]').prop("disabled", false); 927 } 928 } 929 } 930 931 $(".view-experiential-education-list fieldset>legend").click(function () { 932 if (isBreakpoint("medium")) { 933 $(this).next().slideToggle(); 934 } 935 }); 936 937 $(document).ready(function () { 938 if ($(".fa-twitter").length) { 939 $("i.fa-twitter").each(function () { 940 var color = $(this).parent().css("color"); 941 $(this).append( 942 '<svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8L200.7 275.5 26.8 48H172.4L272.9 180.9 389.2 48zM364.4 421.8h39.1L151.1 88h-42L364.4 421.8z"/></svg>' 943 ); 944 $(this).find($("svg")).css("fill", color); 945 $(this).parent().hover(colorChange); 946 }); 947 $("a.fa-twitter").each(function () { 948 var color = $(this).css("color"); 949 $(this).append( 950 '<svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8L200.7 275.5 26.8 48H172.4L272.9 180.9 389.2 48zM364.4 421.8h39.1L151.1 88h-42L364.4 421.8z"/></svg>' 951 ); 952 $(this).find($("svg")).css("fill", color); 953 $(this).hover(colorChange); 954 }); 955 } 956 957 //Adjusts <nav class="slick__arrow"> attributes for accessibility accommodation 958 $(".slick__arrow").each(function () { 959 if (!$(this).attr("aria-label")) { 960 $(this).attr("aria-label", "image slider navigation arrows"); 961 } 962 }); 963 //Checks that slick-track div attributes are properly aria-labelled 964 $(".slick-track").each(function () { 965 if (!$(this).attr("aria-label")) { 966 !$(this).attr("aria-label", "Photo Slider"); 967 } 968 }); 969 970 //Adds and adjusts proper attributes to use with role=option on slick__slide 971 $(".slick__slide[role=option]").each(function () { 972 $(this).parent().attr("role", "region"); 973 $(this).parent().attr("aria-roledescription", "carousel"); 974 $(this).parent().attr("aria-label", "Image carousel"); 975 $(this).attr("role", "group"); 976 $(this).attr("aria-roledescription", "slide"); 977 }); 978 979 //Checks that header attributes to <nav> bars are properly aria-labelled 980 $("header[id=navbar]").removeAttr("aria-labelledby"); 981 $("header[id=navbar]").attr("aria-label", "Main Navigation Header"); 982 983 $("aside[role=complementary").attr( 984 "aria-label", 985 "Supplemental Information" 986 ); 987 //Ensures select boxes have descriptions 988 $("select").each(function () { 989 if (!$(this).attr("aria-label") && !$(this).attr("aria-labelledby")) { 990 $(this).attr("aria-label", "Select Box"); 991 } 992 }); 993 }); 994 995 $(document).ready(function () { 996 if ($(".bio-list-view").length > 0) { 997 $(".scrolling-view .fieldset-wrapper label").each(function () { 998 $(this)[0].innerHTML = $(this)[0].innerHTML.replace("Cancer - ", ""); 999 }); 1000 } 1001 1002 if ($(".bio-list-view").length > 0) { 1003 $(".scrolling-view .fieldset-wrapper label").each(function () { 1004 $(this)[0].innerHTML = $(this)[0].innerHTML.replace("BSTP - ", ""); 1005 }); 1006 } 1007 1008 if ($(".bio-list-view").length > 0) { 1009 $(".scrolling-view .fieldset-wrapper label").each(function () { 1010 $(this)[0].innerHTML = $(this)[0].innerHTML.replace( 1011 "Schubert Center - ", 1012 "" 1013 ); 1014 }); 1015 } 1016 1017 if ($(".bio-list-view").length > 0) { 1018 $(".scrolling-view .fieldset-wrapper label").each(function () { 1019 $(this)[0].innerHTML = $(this)[0].innerHTML.replace( 1020 "Neurosciences - ", 1021 "" 1022 ); 1023 }); 1024 } 1025 1026 //// for removing non UMC - tags from the new media experts search page. 1027 if (window.location.href.indexOf("umc") > -1) { 1028 if ($("ul.ui-autocomplete").length > 0) { 1029 $.each($("ul.ui-autocomplete li a"), function (index, value) { 1030 if ( 1031 value.text.match(" - ") != null && 1032 value.text.match("UMC - ") === null 1033 ) { 1034 $(this).closest("li").remove(); 1035 } else { 1036 $(this)[0].innerHTML = $(this)[0].innerHTML.replace("UMC - ", ""); 1037 } 1038 }); 1039 } 1040 $("form input#edit-combine").val(function (i, v) { 1041 return v.replace("UMC - ", ""); 1042 }); 1043 } 1044 }); 1045 1046 $(document).ajaxSuccess(function () { 1047 if ($(".bio-list-view").length > 0) { 1048 $(".scrolling-view .fieldset-wrapper label").each(function () { 1049 $(this)[0].innerHTML = $(this)[0].innerHTML.replace("Cancer - ", ""); 1050 }); 1051 } 1052 1053 if ($(".bio-list-view").length > 0) { 1054 $(".scrolling-view .fieldset-wrapper label").each(function () { 1055 $(this)[0].innerHTML = $(this)[0].innerHTML.replace("BSTP - ", ""); 1056 }); 1057 } 1058 1059 if ($(".bio-list-view").length > 0) { 1060 $(".scrolling-view .fieldset-wrapper label").each(function () { 1061 $(this)[0].innerHTML = $(this)[0].innerHTML.replace( 1062 "Neurosciences - ", 1063 "" 1064 ); 1065 }); 1066 } 1067 1068 if ($(".bio-list-view").length > 0) { 1069 $(".scrolling-view .fieldset-wrapper label").each(function () { 1070 $(this)[0].innerHTML = $(this)[0].innerHTML.replace( 1071 "Schubert Center - ", 1072 "" 1073 ); 1074 }); 1075 } 1076 if (window.location.href.indexOf("medicine/bstp") > -1) { 1077 $(".paragraph--type--additional-job-descriptions div.hidden").removeClass( 1078 "hidden" 1079 ); 1080 } 1081 1082 if (window.location.href.indexOf("bstp") > -1) { 1083 $(".paragraph--type--additional-job-descriptions div.hidden").removeClass( 1084 "hidden" 1085 ); 1086 } 1087 1088 if (window.location.href.indexOf("umc") > -1) { 1089 if ($("ul.ui-autocomplete").length > 0) { 1090 $.each($("ul.ui-autocomplete li a"), function (index, value) { 1091 if ( 1092 value.text.match(" - ") != null && 1093 value.text.match("UMC - ") === null 1094 ) { 1095 $(this).closest("li").remove(); 1096 } else { 1097 $(this)[0].innerHTML = $(this)[0].innerHTML.replace("UMC - ", ""); 1098 } 1099 }); 1100 1101 $.each($("ul.ui-autocomplete li"), function (index, value) { 1102 var keyword = ""; 1103 $(this).on("click", function () { 1104 keyword = $(this).children()[0].innerHTML; 1105 setTimeout(function () { 1106 $("form input#edit-combine").val(keyword); 1107 }, 100); 1108 }); 1109 $("ul.ui-autocomplete").on("keypress", function (e) { 1110 if (e.which == 13) { 1111 setTimeout(function () { 1112 $("form input#edit-combine").val(keyword); 1113 }, 100); 1114 } 1115 }); 1116 }); 1117 } 1118 } 1119 }); 1120 1121 //CEBP Resources page dropdowns 1122 // var BREAKPOINTS = [ 1123 // { name: "small", size: 768 }, 1124 // { name: "medium", size: 992 }, 1125 // { name: "large", size: 1200 }, 1126 // ] 1127 1128 // function isBreakpoint (size) { 1129 // var thisSize = BREAKPOINTS.filter(function(breakpoint) { 1130 // return breakpoint.name === size; 1131 // }); 1132 // return $(window).width() > thisSize[0].size ? false : true; 1133 // } 1134 1135 // // replace "Apply" with magnifying glass icon for search button 1136 // function addSearchIcon () { 1137 // var submitButton = document.getElementsByClassName("button js-form-submit form-submit btn-info btn"); 1138 // if (submitButton.length > 0) { 1139 // submitButton[0].innerHTML= '<span class="sr-only">Search</span><span class="fa fa-search" aria-hidden="true"></span>'; 1140 // } 1141 // } 1142 1143 // $(window).on('load', function () { 1144 // addSearchIcon(); 1145 // }); 1146 1147 // CEBP resource page dropdowns 1148 var resourcePage = $(".cebp-resources-tools"); 1149 function resourcesDropdowns() { 1150 if (resourcePage.length > 0) { 1151 $("fieldset>legend").click(function () { 1152 if (isBreakpoint("small")) { 1153 $(this).next().slideToggle(); 1154 } 1155 }); 1156 $(":checked").each(function () { 1157 $(this).parentsUntil("fieldset").css("display", "block"); 1158 }); 1159 } 1160 } 1161 1162 var resourcePage = $(".research-projects-filters"); 1163 function resourcesDropdowns() { 1164 if (resourcePage.length > 0) { 1165 $("fieldset>legend").click(function () { 1166 if (isBreakpoint("small")) { 1167 $(this).next().slideToggle(); 1168 } 1169 }); 1170 $(":checked").each(function () { 1171 $(this).parentsUntil("fieldset").css("display", "block"); 1172 }); 1173 } 1174 } 1175 1176 $(document).ready(function () { 1177 resourcesDropdowns(); 1178 }); 1179 1180 // Check if you are using a mobile browser 1181 var isMobile = false; //initiate as false 1182 // device detection 1183 if ( 1184 /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test( 1185 navigator.userAgent 1186 ) || 1187 /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
1187sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test( 1188 navigator.userAgent.substr(0, 4) 1189 ) 1190 ) 1191 isMobile = true; 1192 1193 var resetAjax = 0; 1194 1195 $(document).ajaxSuccess(function () { 1196 //addSearchIcon(); 1197 if (window.location.href.indexOf("centerforebp") > -1) { 1198 resourcesDropdowns(); 1199 resetAjax++; 1200 if (resetAjax > 1) { 1201 var filtersEl = $(".view-filters"); 1202 var resultsEl = $(".cebp-resources-tools .view-content"); 1203 if (resultsEl.length > 0 && isMobile) { 1204 $("html, body").animate({ scrollTop: resultsEl.offset().top - 20 }); 1205 } else { 1206 $("html, body").animate({ scrollTop: filtersEl.offset().top - 20 }); 1207 } 1208 } 1209 } 1210 }); 1211 1212 $(document).ajaxSuccess(function () { 1213 //addSearchIcon(); 1214 if (window.location.href.indexOf("researchprojects") > -1) { 1215 resourcesDropdowns(); 1216 resetAjax++; 1217 if (resetAjax > 1) { 1218 var filtersEl = $(".view-filters"); 1219 var resultsEl = $(".research-projects-filters .view-content"); 1220 if (resultsEl.length > 0 && isMobile) { 1221 $("html, body").animate({ scrollTop: resultsEl.offset().top - 20 }); 1222 } else { 1223 $("html, body").animate({ scrollTop: filtersEl.offset().top - 20 }); 1224 } 1225 } 1226 } 1227 }); 1228 1229 function coreFacilitiesFocus() { 1230 $("select").change(function (e) { 1231 if (isMobile) { 1232 $("html, body").animate({ 1233 scrollTop: 1234 $(".view-core-facilities-listing .view-filters").offset().top - 20, 1235 }); 1236 } 1237 }); 1238 } 1239 1240 $(document).ready(function () { 1241 if (window.location.href.indexOf("research") > -1) { 1242 coreFacilitiesFocus(); 1243 } 1244 }); 1245 1246 $(document).ajaxSuccess(function () { 1247 if (window.location.href.indexOf("research") > -1) { 1248 coreFacilitiesFocus(); 1249 } 1250 }); 1251 1252 //Subfeature Grid Hover Effect 1253 $(".field--name-field-grid-description").css("display", "none"); 1254 $(".subfeature-grid-img-text").hover( 1255 function () { 1256 if (!checkBreakpoint(768)) { 1257 $(this).find(".field--name-field-grid-description").slideDown(); 1258 } 1259 }, 1260 function () { 1261 if (!checkBreakpoint(768)) { 1262 $(this).find(".field--name-field-grid-description").slideUp(); 1263 } 1264 } 1265 ); 1266 1267 // temp twitter x fix 10032023 until FA6 is installed 1268 colorChange = function () { 1269 var color = $(this).css("color"); 1270 $(this).find($("svg")).css("fill", color); 1271 }; 1272 1273 // YOUTUBE: Load autoplay attributes BEFORE button click 1274 // The video will only auto play with this attributes 1275 // For videos within the content of the page 1276 $(".paragraph--type--image-or-video") 1277 .find("div .video-embed-field-responsive-video iframe") 1278 .attr("allow", "autoplay; fullscreen"); 1279 1280 // video autoplay on button click 1281 $(".play-button-container").on("click", function (e) { 1282 $(this).parent().find(".field--name-field-image-or-video-image").fadeOut(); 1283 $(this).fadeOut(); 1284 1285 var videoURL = $(this).parent().find("iframe").prop("src"); 1286 var newURL = videoURL + "&autoplay=1&mute=0"; 1287 newURL = newURL.replace("autoplay=0", ""); 1288 1289 $(this) 1290 .closest(".paragraph--type--image-or-video") 1291 .find("div .video-embed-field-responsive-video iframe") 1292 .attr("src", newURL); 1293 }); 1294 1295 //Play and Pause button for Homepage hero video 1296 // $(document).on("click", "#playPause.pause-me", function (e) { 1297 // $("#homeHero").vimeo("pause"); 1298 // $(this).addClass("play-me").removeClass("pause-me"); 1299 // $(this).attr("aria-label", "Play video"); 1300 // }); 1301 1302 // $(document).on("click", "#playPause.play-me", function (e) { 1303 // $("#homeHero").vimeo("play"); 1304 // $(this).addClass("pause-me").removeClass("play-me"); 1305 // $(this).attr("aria-label", "Pause video"); 1306 // }); 1307 1308 // FOR HOME PAGE REBRANDED: Load autoplay attributes BEFORE button click 1309 // The video will only auto play with this attributes 1310 $(".paragraph--type--hero-with-video") 1311 .find("div .field--name-field-hero-with-video-embed-code iframe") 1312 .attr("allow", "autoplay; fullscreen"); 1313
1314 // video autoplay on button click 1315 $(".play-button-container").on("click", function (e) { 1316 $(this).parent().find(".field--name-field-image-or-video-image").fadeOut(); 1317 $(this).fadeOut(); 1318 1319 var videoURL = $(this).parent().find("iframe").prop("src"); 1320 var newURL = videoURL + "&autoplay=1&mute=0"; 1321 newURL = newURL.replace("autoplay=0", ""); 1322 1323 $(this) 1324 .closest(".paragraph--type--hero-with-video") 1325 .find("div .field--name-field-hero-with-video-embed-code iframe") 1326 .attr("src", newURL); 1327 }); 1328 1329 $(document).ready(function () { 1330 // Still use has(.white_background) to narrow the scope 1331 var containers = $("div.field, div.field--item:has(.white_background)"); 1332 1333 containers.each(function () { 1334 var $current = $(this); 1335 var $next = $current.nextAll("div.field, div.field--item").first(); 1336 1337 if ($next.length) { 1338 var $currentFirstDiv = $current.children("div").first(); 1339 var $nextFirstDiv = $next.children("div").first(); 1340 1341 if ( 1342 $currentFirstDiv.hasClass("white_background") && 1343 $nextFirstDiv.hasClass("white_background") 1344 ) { 1345 $currentFirstDiv.css("padding-bottom", "0"); 1346 } 1347 } 1348 }); 1349 }); 1350 1351 // Mobile hero video styling 1352 $(document).ready(function () { 1353 var nextSib = $(".home-page-rebranded .homepage-hero-container").next(); 1354 1355 if (nextSib.length > 0) { 1356 var bgColor = nextSib.css('background-color'); 1357 1358 if (bgColor === 'rgb(255, 255, 255)' || bgColor === '#fff' || bgColor === '#ffffff' || bgColor === 'white') { 1359 $(".home-page-rebranded .homepage-hero-container .title-tagline").addClass('blue_background'); 1360 } 1361 } 1362 }); 1363})(jQuery); 1364 1365// Play and Pause button for Homepage hero video 1366(function ($, Drupal) { 1367 Drupal.behaviors.vimeoPlayPause = { 1368 attach: function (context) { 1369 1370 const iframe = document.getElementById('homeHero'); 1371 const btn = document.getElementById('playPause'); 1372 1373 if (!iframe || !btn) return; 1374 if (typeof Vimeo === 'undefined') return; 1375 if (btn.hasAttribute('data-vimeo-init')) return; 1376 1377 btn.setAttribute('data-vimeo-init', 'true'); 1378 1379 const player = new Vimeo.Player(iframe); 1380 1381 btn.classList.add('pause-me'); 1382 btn.setAttribute('aria-label', 'Pause video'); 1383 btn.style.display = 'flex'; 1384 1385 btn.addEventListener('click', function (e) { 1386 e.preventDefault(); 1387 1388 const paused = btn.classList.contains('pause-me'); 1389 1390 paused ? player.pause() : player.play(); 1391 1392 btn.classList.toggle('pause-me', !paused); 1393 btn.classList.toggle('play-me', paused); 1394 btn.setAttribute('aria-label', paused ? 'Play video' : 'Pause video'); 1395 }); 1396 1397 } 1398 }; 1399})(jQuery, Drupal);
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.