PageSourceSearch

https://www.hotelmanagement-network.com/wp-content/themes/goodlife-wp-B2B/assets/js/modules/sectionsNav.js

js hotelmanagement-network.com collected 2026-09-24 18:36:50 UTC 1,743 bytes, 57 lines download raw bytes

1export function initSectionsNav({
2  sectionNavSelector = '.gdm-page-links',
3  sectionTitle = 'What are you looking for today?',
4  excludeHeaders = [],
5  headerSelectors = [
6    'main section .large-9 header:first-of-type h2',
7    'main section > header h2'
8  ]
9} = {}) {
10  // Find all h2 headers using the selectors array
11  let headers = [];
12  headerSelectors.forEach(sel => {
13    headers = headers.concat(Array.from(document.querySelectorAll(sel)));
14  });
15  // Exclude any 'article header h2' elements
16  headers = headers.filter(h => !h.closest('article header'));
17  // Filter out excluded headers by text
18  const filteredHeaders = headers.filter(h => !excludeHeaders.includes(h.textContent.trim()));
19
20  // If no headers, remove the nav container
21  const navSection = document.querySelector(sectionNavSelector);
22  if (!filteredHeaders.length) {
23    if (navSection) navSection.remove();
24    return;
25  }
26
27  // Assign unique ids to headers if missing
28  filteredHeaders.forEach((header, idx) => {
29    if (!header.id) {
30      header.id = 'section-' + (header.textContent.trim().toLowerCase().replace(/[^a-z0-9]+/g, '-') || idx);
31    }
32  });
33
34  // Build nav HTML
35  if (!navSection) return;
36  navSection.innerHTML = '';
37
38  // Create h2 title
39  const h2 = document.createElement('h2');
40  h2.textContent = sectionTitle;
41  navSection.appendChild(h2);
42
43  // Create ul.gdm-page-links
44  const ul = document.createElement('ul');
45  ul.className = 'gdm-article-tags';
46
47  filteredHeaders.forEach(header => {
48    const li = document.createElement('li');
49    const a = document.createElement('a');
50    a.textContent = header.textContent.trim();
51    a.href = '#' + header.id;
52    li.appendChild(a);
53    ul.appendChild(li);
54  });
55
56  navSection.appendChild(ul);
57}

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.