1(function (Drupal, drupalSettings) { 2 Drupal.behaviors.ncBreadcrumb = { 3 attach: function (context, settings) { 4 // Get the active trail info from drupalSettings. 5 var activeTrailInfo = drupalSettings.nc_breadcrumb.activeTrailInfo; 6 7 // Find the breadcrumb container. 8 var breadcrumbContainer = document.querySelector('nav[aria-label="breadcrumb"] .breadcrumb'); 9 10 // Check if the breadcrumb container exists. 11 if (!breadcrumbContainer) { 12 return; 13 } 14 15 // Clear existing breadcrumb items. 16 breadcrumbContainer.innerHTML = ''; 17 18 // Add the Home breadcrumb item. 19 var homeItem = document.createElement('li'); 20 homeItem.className = 'breadcrumb-item'; 21 var homeLink = document.createElement('a'); 22 homeLink.href = '/'; 23 homeLink.textContent = 'Home'; 24 homeItem.appendChild(homeLink); 25 breadcrumbContainer.appendChild(homeItem); 26 27 // Get the titles from activeTrailInfo. 28 var titles = Object.keys(activeTrailInfo); 29 30 // Add breadcrumb items from activeTrailInfo. 31 for (var i = 0; i < titles.length; i++) { 32 var title = titles[i]; 33 var breadcrumbItem = document.createElement('li'); 34 breadcrumbItem.className = 'breadcrumb-item'; 35 36 if (i === titles.length - 1) { 37 // Last item, not a link. 38 breadcrumbItem.textContent = title; 39 breadcrumbItem.classList.add('active'); 40 breadcrumbItem.setAttribute('aria-current', 'page'); 41 } else { 42 // Other items, add as links. 43 var breadcrumbLink = document.createElement('a'); 44 breadcrumbLink.href = activeTrailInfo[title]; 45 breadcrumbLink.textContent = title; 46 breadcrumbItem.appendChild(breadcrumbLink); 47 } 48 49 breadcrumbContainer.appendChild(breadcrumbItem); 50 } 51 } 52 }; 53})(Drupal, drupalSettings);
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.