PageSourceSearch

https://www.mtbsepp.de/assets/admin/controllers/track_statistics_controller-wKX6s_j.js

js mtbsepp.de collected 2026-10-04 14:09:45 UTC 2,400 bytes, 1 lines download raw bytes

1"use strict";import{Controller}from"@hotwired/stimulus";export default class extends Controller{static values={url:String};static targets=["button"];connect(){this.hasButtonTarget&&this.buttonTarget.addEventListener("click",this.handleClick.bind(this))}disconnect(){this.hasButtonTarget&&this.buttonTarget.removeEventListener("click",this.handleClick.bind(this))}async handleClick(e){if(e.preventDefault(),!this.urlValue){alert("URL für Track-Statistiken nicht gefunden.");return}const t=e.currentTarget,n=t.textContent;t.disabled=!0,t.textContent="Lade Daten...";try{const o=document.getElementById("edit"),a=o?.querySelector('input[type="file"][name*="trackFile"]'),r=a?.files?.length>0,s={headers:{"X-Requested-With":"XMLHttpRequest"}};if(r){const e=new FormData;e.append("trackFile",a.files[0]),s.method="POST",s.body=e}else s.method="GET";const i=await fetch(this.urlValue,s);if(!i.ok){const e=await i.json();throw new Error(e.error||"Fehler beim Laden der Track-Statistiken")}const e=await i.json(),c=o?o.name||"edit":"edit",l={length:e.length,lengthAscending:e.lengthAscending,lengthDescending:e.lengthDescending,ascent:e.ascent,descent:e.descent,altitudeMin:e.altitudeMin,altitudeMax:e.altitudeMax};for(const[e,t]of Object.entries(l))this.fillField(e,t,c);t.textContent=n,t.disabled=!1}catch(e){alert(`Fehler: ${e.message}`),t.textContent=n,t.disabled=!1}}fillField(e,t,n){let s=null;const o=[`${n}[${e}]`,`${n}[route][${e}]`,`${e}`];for(const e of o)if(s=document.querySelector(`input[name="${e}"], textarea[name="${e}"]`),s)break;if(!s){const t=[`${n}_${e}`,`${n}_route_${e}`,`edit_${e}`,`edit_route_${e}`];for(const e of t)if(s=document.getElementById(e),s)break}if(!s){const t=document.querySelectorAll("label");for(const i of t){const n=i.textContent.toLowerCase(),o=e.toLowerCase();if(o==="length"&&n.includes("distanz")||o==="lengthascending"&&n.includes("bergauf")||o==="lengthdescending"&&n.includes("bergab")||o==="ascent"&&n.includes("anstieg")||o==="descent"&&n.includes("abstieg")||o==="altitudemin"&&n.includes("min")&&n.includes("höhe")||o==="altitudemax"&&n.includes("max")&&n.includes("höhe")){const e=i.closest(".flex, fieldset, div");if(e&&(s=e.querySelector("input[type='number'], input[type='text']"),s))break}}}s?(s.value=t,s.dispatchEvent(new Event("change",{bubbles:!0})),s.dispatchEvent(new Event("input",{bubbles:!0}))):console.warn(`Field not found for: ${e}`)}}

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.