1(function () { 2 3 function shouldScroll() { 4 var params = new URLSearchParams(window.location.search); 5 6 // Scroll if user is navigating steps/completion OR clicked a nav control previously 7 return ( 8 params.has('jstep') || 9 params.has('step') || 10 params.has('completed') || 11 sessionStorage.getItem('inspire_journey_scroll') === '1' 12 ); 13 } 14 15 function findTarget() { 16 // If journey_id is present, target the matching anchor 17 var params = new URLSearchParams(window.location.search); 18 var jid = params.get('journey_id'); 19 20 if (jid) { 21 var byId = document.getElementById('inspire-journey-anchor-' + jid); 22 if (byId) return byId; 23 } 24 25 // Fallback: first anchor on page 26 return document.querySelector('.inspire-journey-anchor') || 27 document.querySelector('.inspire-journey-shell'); 28 } 29 30 function scrollToTarget() { 31 if (!shouldScroll()) return; 32 33 var el = findTarget(); 34 if (!el) return; 35 36 // Clear flag (so it doesn't scroll on unrelated future navigations) 37 sessionStorage.removeItem('inspire_journey_scroll'); 38 39 // Use native scrollIntoView (CSS scroll-margin-top handles banner offset) 40 el.scrollIntoView({ behavior: 'smooth', block: 'start' }); 41 } 42 43 // Set a flag before navigation when user clicks step links / back / continue / finish 44 document.addEventListener('click', function (e) { 45 var link = e.target.closest('a.inspire-journey-steplink, a.inspire-journey-btn'); 46 var btn = e.target.closest('button.inspire-journey-btn'); 47 48 // Click on sidebar step links or Back/Continue anchors 49 if (link) { 50 sessionStorage.setItem('inspire_journey_scroll', '1'); 51 return; 52 } 53 54 // Click on Continue/Finish submit button (form POST causes navigation) 55 if (btn) { 56 sessionStorage.setItem('inspire_journey_scroll', '1'); 57 return; 58 } 59 }, true); 60 61 // Run after load, and again after a short delay to handle banner/image/layout shifts 62 window.addEventListener('load', function () { 63 setTimeout(scrollToTarget, 120); 64 setTimeout(scrollToTarget, 600); 65 }); 66 67})(); 68``
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.