PageSourceSearch

https://www.bwgv.de/_assets/d8c770632cf3475a4f5235bb32b72617/JavaScript/Extensions/go_maps_ext.js?1790927285

js bwgv.de collected 2026-10-06 13:26:50 UTC 2,567 bytes, 68 lines download raw bytes

1/**
2 * go_maps_ext: a marker whose info window links to a content element on the same page opens a small
3 * info window with the club name and a "Mehr Informationen" button that scrolls to that element.
4 */
5document.addEventListener('DOMContentLoaded', () => {
6  document.querySelectorAll('.js-map').forEach((mapElement) => {
7    mapElement.addEventListener('mapcreated', () => {
8      const controller = mapElement.gomapsext && mapElement.gomapsext.controller;
9      if (!controller) {
10        return;
11      }
12      const infoWindow = controller.infoWindow || new google.maps.InfoWindow();
13      controller.markers.forEach((marker) => {
14        const section = sectionOnThisPage(marker.infoWindowContent);
15        if (!section) {
16          return;
17        }
18        google.maps.event.clearListeners(marker, 'click');
19        google.maps.event.addListener(marker, 'click', () => {
20          // go_maps_ext uses AdvancedMarkerElement: map/title are properties, not getters
21          infoWindow.setContent(buildContent(section.name || marker.title || '', section.target));
22          infoWindow.open({ anchor: marker, map: marker.map || controller.map });
23        });
24      });
25    });
26  });
27
28  function sectionOnThisPage(html) {
29    if (!html) {
30      return null;
31    }
32    const wrapper = document.createElement('div');
33    wrapper.innerHTML = html;
34    const link = wrapper.querySelector('a[href*="#"]');
35    if (!link || link.pathname !== window.location.pathname || !link.hash) {
36      return null;
37    }
38    const target = document.getElementById(decodeURIComponent(link.hash.substring(1)));
39    return target ? { target, name: link.textContent.trim() } : null;
40  }
41
42  function buildContent(name, target) {
43    const content = document.createElement('div');
44    content.className = 'mapinfo';
45    const title = document.createElement('div');
46    title.className = 'mapinfo__title';
47    title.textContent = name;
48    const button = document.createElement('a');
49    button.className = 'mapinfo__button font__button';
50    button.href = '#' + target.id;
51    button.textContent = 'Mehr Informationen';
52    button.addEventListener('click', (event) => {
53      event.preventDefault();
54      scrollToElement(target);
55    });
56    content.append(title, button);
57    return content;
58  }
59
60  function scrollToElement(element) {
61    const header = document.querySelector('.top');
62    const offset = (header ? header.offsetHeight : 0) + 50;
63    window.scrollTo({
64      top: element.getBoundingClientRect().top + window.scrollY - offset,
65      behavior: 'smooth',
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.