PageSourceSearch

https://fischr.org/assets/js/gpx-loader.474e3b2d6291.js

js fischr.org collected 2026-10-06 15:27:26 UTC 2,090 bytes, 64 lines download raw bytes

1(function initGpxLoader() {
2  "use strict";
3
4  const loader = document.currentScript || document.querySelector("script[data-gpx-loader]");
5  const embeds = [...document.querySelectorAll(".gpx-embed[data-gpx-src]")];
6  if (!loader || embeds.length === 0) return;
7
8  const coreSource = loader.dataset.gpxCore;
9  const viewerSource = loader.dataset.gpxViewer;
10  let runtimePromise;
11
12  function loadScript(source) {
13    return new Promise((resolve, reject) => {
14      const script = document.createElement("script");
15      script.src = source;
16      script.onload = resolve;
17      script.onerror = () => reject(new Error("GPX-Modul konnte nicht geladen werden."));
18      document.head.append(script);
19    });
20  }
21
22  function loadRuntime() {
23    if (window.RWGpxViewer) return Promise.resolve(window.RWGpxViewer);
24    if (!runtimePromise) {
25      runtimePromise = loadScript(coreSource)
26        .then(() => loadScript(viewerSource))
27        .then(() => {
28          if (!window.RWGpxViewer) throw new Error("GPX-Modul konnte nicht gestartet werden.");
29          return window.RWGpxViewer;
30        });
31    }
32    return runtimePromise;
33  }
34
35  function initialize(embed) {
36    if (embed.dataset.gpxState !== "waiting") return;
37    embed.dataset.gpxState = "loading";
38    embed.querySelector(".gpx-status").textContent = "Tourdaten werden geladen …";
39
40    loadRuntime()
41      .then((viewer) => viewer.initialize(embed))
42      .catch((error) => {
43        embed.dataset.gpxState = "error";
44        const status = embed.querySelector(".gpx-status");
45        status.textContent = error.message || "GPX-Modul konnte nicht geladen werden.";
46        status.classList.add("gpx-error");
47      });
48  }
49
50  if (!("IntersectionObserver" in window)) {
51    embeds.forEach(initialize);
52    return;
53  }
54
55  const observer = new IntersectionObserver((entries) => {
56    for (const entry of entries) {
57      if (!entry.isIntersecting) continue;
58      observer.unobserve(entry.target);
59      initialize(entry.target);
60    }
61  }, { rootMargin: "800px 0px" });
62
63  embeds.forEach((embed) => observer.observe(embed));
64})();

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.