titleElement = document.querySelector('h2');openingTime="";titleElement = document.querySelector('h2');newHTML = "
Interaktiver Pistenplan Katschberg
"; newHTML = newHTML + "
" + openingTime + "
"; if (document.location.href.indexOf('thanks=')==-1)titleElement.insertAdjacentHTML('afterend', newHTML); (function() { const info = document.getElementById("resortinfo"); const rightLinks = document.getElementById("resortlinks"); if (!info) return console.warn("❌ resortinfo not found"); // Find the h2 element const h2 = document.querySelector("h2.topic-title"); if (!h2) return console.warn("❌ h2.topic-title not found"); // Create round "i" button const btn = document.createElement("button"); btn.textContent = "Infos Skigebiet"; // small "i" Object.assign(btn.style, { //position: "sticky", top: "10px", left: "10px", width: "140px", borderRadius: "5px", background: "#777", color: "white", border: "none", fontSize: "14px", fontWeight: "bold", fontFamily: "Tahoma, Arial, Helvetica, sans-serif", zIndex: 1000, display: "none", cursor: "pointer", textAlign: "center", lineHeight: "40px", padding: "0", float: "left", marginRight: "10px" }); h2.parentNode.insertBefore(btn, h2.nextSibling); // Create close button const closeBtn = document.createElement("button"); closeBtn.textContent = "×"; Object.assign(closeBtn.style, { position: "absolute", top: "10px", right: "20px", background: "transparent", border: "none", fontSize: "40px", cursor: "pointer", }); const baseStyle = info.style.cssText; window.showOverlay = () => { info.style.cssText = ` display:flex !important; flex-direction:column; position:fixed; top:0;left:0;right:0;bottom:0; background:white; justify-content:flex-start; align-items:center; z-index:2000; padding:20px; overflow-y:auto; `; if (rightLinks) rightLinks.classList.remove("desktoponly"); const container = info.querySelector("div"); if (container && rightLinks) { const imgSpan = Array.from(container.querySelectorAll("span")) .find(s => s.querySelector("img[src*='info_resort']")); if (imgSpan) { container.insertBefore(imgSpan, rightLinks); } } if (!info.contains(closeBtn)) info.appendChild(closeBtn); resortlinks.style.marginTop="20px"; //document.getElementById('planspan').style.marginRight = "40px"; const resortInfo = document.getElementById("resortinfo"); if (resortInfo) { // Make the overlay a column flex container resortInfo.style.display = "flex"; resortInfo.style.flexDirection = "column"; resortInfo.style.justifyContent = "center"; // vertical centering resortInfo.style.alignItems = "center"; // horizontal centering // Optionally, keep the right links at the bottom const rightLinks = document.getElementById("resortlinks"); if (rightLinks) { rightLinks.style.marginTop = "20px"; // spacing if needed rightLinks.style.alignSelf = "flex-end"; // push it to the right side } } const resortlinksContainer = document.querySelector("#resortlinks > div"); // swap the two spans const spans = resortlinksContainer.querySelectorAll("span"); if (spans[1].querySelector("img")) { // check if span[1] contains an resortlinksContainer.insertBefore(spans[1], spans[0]); } // align #resortlinks to flex-start const resort = document.getElementById("resortlinks"); resort.style.alignSelf = "flex-start"; // modify the link span (text-align + padding) const linkSpan = resortlinksContainer.querySelector('span[style*="text-align:right"]'); if (linkSpan) { linkSpan.style.textAlign = "left"; linkSpan.style.paddingLeft = "10px"; } // add margin-left to the info image span (now first) //const infoSpan = resortlinksContainer.querySelector("span:first-child"); //if (infoSpan) { // infoSpan.style.marginLeft = "15px"; //} document.querySelector("#resortinfo div").style.width = "100%"; if (document.getElementById('opening') && document.getElementById('resortinfo')) { // Only insert if not already inserted if (!document.getElementById('resortinfo').querySelector('.opening-copy')) { // Get the original content and replace " | " with
const openingContent = document.getElementById('opening').innerHTML.replace(/ \| /g, '
'); document.getElementById('resortinfo').insertBefore( Object.assign(document.createElement('div'), { innerHTML: 'Betriebszeiten:
' + openingContent, style: 'font-size:14px;padding-bottom:16px;width:100%;', className: 'opening-copy' // marker to avoid duplicates }), document.getElementById('resortinfo').firstChild ); } } }; window.hideOverlay = () => { info.style.cssText = baseStyle; if (rightLinks) rightLinks.classList.add("desktoponly"); if (info.contains(closeBtn)) info.removeChild(closeBtn); resortlinks.style.marginTop="0"; document.getElementById('resortinfo').style.display='none'; }; function checkScreen() { if (window.innerWidth <= 768) { info.style.display = "none"; btn.style.display = "inline-block"; } else { info.style.cssText = baseStyle; btn.style.display = "none"; } } checkScreen(); window.addEventListener("resize", checkScreen); btn.addEventListener("click", showOverlay); closeBtn.addEventListener("click", hideOverlay); })(); document.querySelectorAll(".back2top").forEach(div => { const toggle = document.createElement("div"); toggle.className = "toggleinfo mobileonly"; toggle.textContent = "Infos Skigebiet"; Object.assign(toggle.style, { position: "absolute", right: "40px", bottom: "14px", background: "#777", color: "#fff", padding: "4px 6px", borderRadius: "6px", cursor: "pointer", zIndex: 1, fontSize: "10px", fontWeight: "bold", textAlign: "center" }); div.parentNode.insertBefore(toggle, div.nextSibling); // Toggle overlay on click toggle.addEventListener("click", () => { const info = document.getElementById("resortinfo"); if (!info) return; if (info.style.display === "flex") { window.hideOverlay(); } else { window.showOverlay(); } }); }); if (document.location.href === 'https://alpinfans.com/app.php/thankslist') { // Create the "Likes pro Post und Benutzer" link after the H2 const h2 = document.querySelector('h2.solo'); if (h2) { const div = document.createElement('div'); div.id = 'likeslink'; div.style.paddingBottom = '0'; const link = document.createElement('a'); link.href = '#'; link.textContent = 'Die Posts mit den meisten Danksagungen'; div.appendChild(link); h2.insertAdjacentElement('afterend', div); // Add click handler link.addEventListener('click', async (e) => { e.preventDefault(); await replaceThanksTableWithLikes(); // Update the div to a "back to Liste der Danksagungen" link div.style.paddingBottom = '20px'; div.innerHTML = 'Liste der Danksagungen'; }); } } // Global async function to replace the table async function replaceThanksTableWithLikes() { try { const h2 = document.querySelector('h2.solo'); if (h2) h2.textContent = 'Die Posts mit den meisten Danksagungen'; const response = await fetch('/getlikes.php'); const data = await response.json(); const tableContainer = document.querySelector('.forumbg.forumbg-table'); if (!tableContainer) return; // Hide pagination bars const paginationTop = document.querySelector('.action-bar.top'); if (paginationTop) paginationTop.style.display = 'none'; const paginationBottom = document.querySelector('.action-bar.bottom'); if (paginationBottom) paginationBottom.style.display = 'none'; // Create new table const table = document.createElement('table'); table.className = 'table1 thankslist not-responsive'; table.setAttribute('cellspacing', '1'); // Table header table.innerHTML = ` Topic Benutzername Anzahl Likes ${data.map((row, index) => ` ${row.post_subject} ${row.username} ${row.likes} `).join('')} `; // Replace old table tableContainer.innerHTML = ''; const innerDiv = document.createElement('div'); innerDiv.className = 'inner'; innerDiv.appendChild(table); tableContainer.appendChild(innerDiv); } catch (err) { console.error('Error loading likes table:', err); } } 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 + "
Ski-Challenge 2025/26: 1. Wenzel, 2. ski-chrigel, 3. Vero69, 4. Fabian_Skiing, 5. Laaxi, 6. hitparade, 7. sheridan, 8. LOL, 9. Miki, 10. Stäntn - Karte mit aktuellen Berichten
365-Challenge | Ski-Weltcup-Tippspiel | Karte offene Skigebiete

Live-Berichte: Arosa Lenzerheide (easyrider)  | Sölden (biofleisch) | Tignes/Val d\'Isère (FORZAM) | Zermatt/Breuil-Cervinia/Valtournenche (sheridan)  | Zermatt/Breuil-Cervinia/Valtournenche (seilreiter) | Gurgl (biofleisch) | Parsenn (Davos Klosters) (hitparade)  | Parsenn (Davos Klosters) (ChristianK) | Hintertuxer Gletscher (highlander)  | Kaunertaler Gletscher (hausi24) 
Neueste Berichte: Chäserrugg (Ludra) | Gerlitzen (skido) | Les Marécottes (Salvan) (ski-py) | Jakobshorn (Davos Klosters) (Vero69) | Zauchensee/Flachauwinkl (Miki) | SkiWelt Wilder Kaiser-Brixental (Basti) | Anzère (Wursti) | Raupennesthang (Neuroski) | Saalbach Hinterglemm Leogang Fieberbrunn (Skicircus) (LOL) | Kronplatz (Plan de Corones) (brunelli) | Hintertuxer Gletscher (hch) | Wiriehorn (Nüllischnee) | Todtnauberg (Schneegott) | Alpe Cermis (Rossignol Race) | Raupennesthang (Deepwhite) | Muggenbrunn (Schneegott) | Haldenköpfle (Schneegott) | 4 Vallées (Nico05) | Sölden (smiletoyou) | Feldberg (julizzi) | Elsigen-Metsch (intermezzo)"; } 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();