1/* Opportunity disclosures. Application links alone select the enquiry type. */ 2(function () { 3 'use strict'; 4 5 const cards = Array.from(document.querySelectorAll('.pgo-c[data-type]')); 6 const panels = Array.from(document.querySelectorAll('.pg-detail')); 7 const form = document.querySelector('.pga-form'); 8 const select = form.querySelector('select[name="type"]'); 9 const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)'); 10 11 function showOpportunity(card, expanded, scroll) { 12 cards.forEach(function (item) { 13 item.setAttribute('aria-expanded', String(item === card && expanded)); 14 }); 15 16 panels.forEach(function (panel) { 17 panel.hidden = !expanded || panel.id !== card.getAttribute('aria-controls'); 18 }); 19 20 if (expanded && scroll) { 21 const grid = document.querySelector('.pgo-grid'); 22 const header = document.querySelector('.hdx'); 23 const headerHeight = header ? Math.max(0, header.getBoundingClientRect().bottom) : 0; 24 /* cards in one column (phones): the panel opens far below the tapped card, so show the panel */ 25 const stacked = getComputedStyle(grid).gridTemplateColumns.split(' ').length === 1; 26 const target = stacked ? panels.find(function (p) { return !p.hidden; }) || grid : grid; 27 28 window.scrollTo({ 29 top: window.scrollY + target.getBoundingClientRect().top - headerHeight - 20, 30 behavior: reducedMotion.matches ? 'instant' : 'smooth' 31 }); 32 } 33 } 34 35 cards.forEach(function (card) { 36 card.addEventListener('click', function () { 37 showOpportunity(card, card.getAttribute('aria-expanded') !== 'true', true); 38 }); 39 }); 40 41 panels.forEach(function (panel) { 42 panel.querySelector('.pg-detail-close').addEventListener('click', function () { 43 const card = cards.find(function (item) { return item.getAttribute('aria-controls') === panel.id; }); 44 45 showOpportunity(card, false, false); 46 card.focus({ preventScroll: true }); 47 48 card.scrollIntoView({ behavior: reducedMotion.matches ? 'instant' : 'smooth', 49 block: 'nearest' }); 50 }); 51 }); 52 53 document.querySelectorAll('[data-apply-type]').forEach(function (link) { 54 link.addEventListener('click', function () { 55 select.value = link.getAttribute('data-apply-type'); 56 }); 57 }); 58 59 // Submission and accessible status are handled by /site/hubspot.js. 60})();
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.