titleElement = document.querySelector('h2');if (document.location.href=='https://alpinfans.com/search.php') { const form = document.querySelector("form"); if (form) { // --- Create and insert the new panel with
layout --- const newPanel = document.createElement("div"); newPanel.className = "panel"; newPanel.innerHTML = `

Suche in der Challenge

(nächste Skigebiete)
`; // Insert as 2nd child if (form.children.length > 1) { form.insertBefore(newPanel, form.children[1]); } else { form.appendChild(newPanel); } console.log("✅ Added 'Suche in der Challenge' panel with phpBB style layout."); // --- Add CSS for dropdown --- const style = document.createElement('style'); style.textContent = ` #resortResults { position: absolute; background: #fff; border: 1px solid #ccc; display: none; max-height: 250px; overflow-y: auto; box-shadow: 0 4px 8px rgba(0,0,0,0.1); z-index: 11; } #resortResults .result-item { padding: 6px 10px; cursor: pointer; } #resortResults .result-item:hover { background-color: #f0f0f0; } #resortResults a { text-decoration: none; color: #333; display: block; width: 100%; } #keywords2 { position: relative; } `; document.head.appendChild(style); // --- AJAX search function --- const keywordsInput = document.getElementById('keywords2'); const resortResults = document.getElementById('resortResults'); keywordsInput.addEventListener('input', function() { const query = this.value.trim(); if (query.length < 1) { resortResults.innerHTML = ''; resortResults.style.display = 'none'; return; } fetch(`https://alpinfans.com/challenge/ajax/ajax_searchresort_search.php?search=${encodeURIComponent(query)}`) .then(r => r.text()) .then(data => { const lines = data.split('\n').filter(l => l.trim() !== ''); let html = ''; lines.forEach(line => { const match = line.match(/\[(.*?)\]/); if (!match) return; const urlPart = match[1]; const link = 'https://alpinfans.com/skigebiete/' + urlPart; const displayText = line.replace(/\s*\[.*?\]\s*/, ''); html += `
${displayText}
`; }); resortResults.innerHTML = html || '
Keine Ergebnisse
'; resortResults.style.display = 'block'; }) .catch(err => { console.error(err); resortResults.innerHTML = '
Fehler beim Laden
'; }); }); // --- Hide dropdown when clicking outside --- document.addEventListener('click', function(event) { if (!keywordsInput.contains(event.target) && !resortResults.contains(event.target)) { resortResults.style.display = 'none'; } }); // --- GPS-based search --- window.searchGPS = function() { if (!navigator.geolocation) { alert('Geolocation wird von Ihrem Browser nicht unterstützt.'); return; } navigator.geolocation.getCurrentPosition(function(position) { const lat = position.coords.latitude; const lon = position.coords.longitude; fetch(`https://alpinfans.com/challenge/ajax/ajax_searchresort_closest.php?lat=${lat}&lon=${lon}`) .then(r => r.text()) .then(data => { const lines = data.split('\n').filter(l => l.trim() !== ''); let html = ''; lines.forEach(line => { const match = line.match(/\[(.*?)\]/); if (!match) return; const urlPart = match[1]; const displayText = line.replace(/\s*\[.*?\]\s*/, ''); html += `
${displayText}
`; }); resortResults.innerHTML = html || '
Keine Ergebnisse
'; resortResults.style.display = 'block'; }) .catch(err => { console.error(err); resortResults.innerHTML = '
Fehler beim Laden
'; }); }, function(err) { alert('Fehler beim Abrufen der Position: ' + err.message); }); }; // --- Attach click listener to GPS link --- const gpsLink = document.getElementById('gpsLink'); if (gpsLink) { gpsLink.addEventListener('click', function(e) { e.preventDefault(); searchGPS(); }); } } } if (document.location.href=='https://alpinfans.com/' || document.location.href.substring(0,31)=='https://alpinfans.com/index.php') { //newHTML = "
"; newHTML = ""; document.querySelector('#nav-breadcrumbs').innerHTML += newHTML + "
Alpinfans-Challenge 2025/26: 1. ski-chrigel, 2. Wenzel, 3. Vero69, 4. Fabian_Skiing, 5. hitparade, 6. Laaxi, 7. Snowboard-Tobi, 8. LOL, 9. Sabine, 10. highlander - Karte mit aktuellen Berichten
Sommer-Challenge | NEU: Ski-Weltcup-Tippspiel"; } else { // newHTML = "
"; //titleElement.insertAdjacentHTML('afterend', newHTML); } if (document.location.href.substring(0,56)=='https://alpinfans.com/memberlist.php?mode=viewprofile&u=') { let url = new URL(document.location.href); let params = new URLSearchParams(url.search); let u = params.get('u'); var result; var xhr = new XMLHttpRequest(); xhr.open('GET', '/challenge/profileembed.php?id='+u, true); xhr.onload = function() { if (xhr.status >= 200 && xhr.status < 300) { result = xhr.responseText; if (result.includes("insgesamt 0 ")) { } else { let existingDiv = document.querySelector('.panel.bg2'); let newDiv = document.createElement('div'); newDiv.classList.add('panel', 'bg2'); existingDiv.parentNode.insertBefore(newDiv, existingDiv.nextSibling); newDiv.innerHTML = '

Alpinfans-Challenge

'+result+'

'; } } }; xhr.send(); //console.log(result); } document.addEventListener("DOMContentLoaded", function () { setTimeout(addInsta, 100); }); function addInsta() { const target2 = document.querySelector("li.responsive-menu.dropdown-container"); // create the element const link = document.createElement("a"); link.href = "https://www.instagram.com/alpinfans"; link.target = "_blank"; link.rel = "noopener noreferrer"; link.ariaLabel = "Instagram"; link.style.display = "inline-block"; link.style.marginLeft = "0px"; link.style.transform = "translateY(-1px)"; // <-- moves it 2px higher // SVG icon (white, semi-transparent) link.innerHTML = ` `; // hover opacity effect link.addEventListener("mouseenter", () => link.querySelector("svg").setAttribute("fill-opacity", "1")); link.addEventListener("mouseleave", () => link.querySelector("svg").setAttribute("fill-opacity", "0.7")); if (target2.firstChild) { target2.replaceChild(link, target2.firstChild); } else { // if there is no child, just append target2.appendChild(link); } } const trackStats = () => { const tracker = new Image(); tracker.src = 'https://hung.ch/alog.asp'; }; trackStats();