1(function ($, Drupal, drupalSettings, once) { 2 Drupal.behaviors.inPageNav = { 3 attach: function (context) { 4 5 $(once('inPageNav', 'a[href*="#"]', context)).on('click', function (e) { 6 7 if (!this.hash || this.hash === '#') { 8 return; 9 } 10 11 if ( 12 this.pathname !== window.location.pathname || 13 this.hostname !== window.location.hostname 14 ) { 15 return; 16 } 17 18 // Find the target using the native DOM API. 19 var target = document.getElementById(this.hash.substring(1)); 20 21 if (!target) { 22 return; 23 } 24 25 var $target = $(target); 26 var targetOffset = $target.offset(); 27 28 // jQuery couldn't determine the position. 29 if (!targetOffset) { 30 return; 31 } 32 33 e.preventDefault(); 34 35 var adminHeight = parseInt($('body').css('paddingTop'), 10) || 0; 36 37 var offset = 38 drupalSettings?.topplus?.inPageNavigation?.inPageNavigationOffset || 0; 39 40 $('html, body').animate({ 41 scrollTop: targetOffset.top - offset - adminHeight 42 }, 1000); 43 44 if (history.pushState) { 45 history.pushState(null, '', this.hash); 46 } else { 47 window.location.hash = this.hash; 48 } 49 }); 50 } 51 }; 52})(jQuery, Drupal, drupalSettings, once);
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.