/** * Tooltip Initialization - Tippy.js * Initializes Tippy.js tooltips for CSV bridge elements * Handles multiple elements with same tt-* ID by using querySelectorAll */ (function () { 'use strict'; function initTooltips() { if (typeof tippy === 'undefined') { console.warn('⚠️ Tippy.js not loaded'); return; } // ==================================================================== // CSV Tooltip Bridge - Map old tt-* IDs to content definitions // ==================================================================== var tooltipMapping = { // Tarife page - euroaming 'tt-euroaming': 'tooltip_euroaming', 'tt-euroaming1-1': 'tooltip_euroaming', 'tt-euroaming1-2': 'tooltip_euroaming', 'tt-euroaming1-3': 'tooltip_euroaming', 'tt-euroaming1-4': 'tooltip_euroaming', 'tt-euroaming124-1': 'tooltip_euroaming', 'tt-euroaming124-2': 'tooltip_euroaming', 'tt-euroaming124-3': 'tooltip_euroaming', 'tt-euroaming124-4': 'tooltip_euroaming', // Homepage (index2) - wechselbonus (OLD LEGACY KEYS) 'tt-wechslerbonus1-1': 'tooltip_wechslerbonus1_10', 'tt-wechslerbonus1-2': 'tooltip_wechslerbonus1_10', 'tt-wechslerbonus1-3': 'tooltip_wechslerbonus1_25', 'tt-wechslerbonus1-4': 'tooltip_wechslerbonus1_10', // Homepage (index2) - eupaket 'tt-eupaket1-1': 'tooltip_eupaket1', 'tt-eupaket1-2': 'tooltip_eupaket1', 'tt-eupaket1-4': 'tooltip_eupaket1', // Bestellungh (phone+tariff) - datenautomatik (consolidate all variants) 'tt-datenautomatik': 'tooltip_datenautomatik', 'tt-datenautomatik_flex': 'tooltip_datenautomatik_flex', 'tt-datenautomatik1-1': 'tooltip_datenautomatik', 'tt-datenautomatik1-2': 'tooltip_datenautomatik', 'tt-datenautomatik1-3': 'tooltip_datenautomatik', 'tt-datenautomatik1-4': 'tooltip_datenautomatik', 'tt-datenautomatik2-1': 'tooltip_datenautomatik', 'tt-datenautomatik2-2': 'tooltip_datenautomatik', // Bestellungh - wechselbonus (all variants to single content) 'tt-wechslerbonus1-5': 'tooltip_wechslerbonus', 'tt-wechslerbonus1-6': 'tooltip_wechslerbonus', 'tt-wechslerbonus1-7': 'tooltip_wechslerbonus', 'tt-wechslerbonus1-8': 'tooltip_wechslerbonus', 'tt-wechslerbonus1-9': 'tooltip_wechslerbonus', 'tt-wechslerbonus1-10': 'tooltip_wechslerbonus', // Bestellungh - eu pakete 'tt-eupaket500mb': 'tooltip_eupaket_500mb', 'tt-eupaket1gb': 'tooltip_eupaket_1gb' }; // Tooltip content definitions var tooltipContent = { 'tooltip_verfuegbarkeit': 'Verfügbarkeit

Die Lieferung erfolgt spätestens innerhalb von 2 Werktagen nach Vertragsabschluss (Mo - Sa, Feiertage ausgenommen).

', 'tooltip_monatlicher_gesamtpreis': 'Monatlicher Paketpreis
Der Monatliche Paketpreis gilt nur im Zusammenhang mit dem Abschluss des Mobilfunkvertrages. Alle Details siehe Produkinformationsblatt.', 'tooltip_einmalpreis': 'Einmaliger Gerätpreis
Der einmalige Preis für das Mobiltelefon gilt nur im Zusammenhang mit dem Abschluss des Mobilfunkvertrages.', 'tooltip_euroaming': 'EU-Roaming
Bei diesem Tarif handelt es sich um einen regulierten EU-Roamingtarif, welchen Sie zu Ihren Inlandskonditionen auch im EU-Ausland nutzen. Dabei fallen keine Aufschläge für die Nutzung von Roamingdiensten (Telefonie, SMS und Datenverbindungen) an, eine angemessene Nutzung "Fair-Use-Policy" vorausgesetzt.', 'tooltip_datenautomatik_flex': 'Datenautomatik (flexibel)
Nach Verbrauch des Inklusiv-Volumens wird bis zu 3x automatisch neues Volumen kostenpflichtig nachgebucht. Diese Option ist monatlich kündbar bzw. deaktivierbar.', 'tooltip_anschluss': 'Anschlussgebühr
Einmaliger Bereitstellungspreis für die Aktivierung.', // Bestellungh specific tooltips 'tooltip_datenautomatik': 'Datenautomatik
Nach Verbrauch des Inklusiv-Volumens wird automatisch neues Datenvolumen gegen Gebühr nachgebucht.', 'tooltip_wechslerbonus': 'Wechselbonus
Sie erhalten einen Bonus bei Wechsel zu SimDiscount. Der genaue Betrag hängt von Ihrem bisherigen Anbieter ab.', 'tooltip_eupaket_500mb': 'EU-Paket 500 MB
Zusätzliches Datenvolumen für die Nutzung im EU-Ausland. 500 MB für 4,99€ pro Kalendermonat.', 'tooltip_eupaket_1gb': 'EU-Paket 1 GB
Zusätzliches Datenvolumen für die Nutzung im EU-Ausland. 1 GB für 7,99€ pro Kalendermonat.', // Legacy 'tooltip_wechslerbonus1_10': 'Wechselbonus 10€
Sie erhalten 10€ Bonus bei Wechsel zu SimDiscount.', 'tooltip_wechslerbonus1_25': 'Wechselbonus 25€
Sie erhalten 25€ Bonus bei Wechsel zu SimDiscount.', 'tooltip_eupaket1': 'EU-Paket
Zusätzliches Datenvolumen für internationale Nutzung.' }; // 1. Handle legacy ID-based tooltips (tt-*) var allTTElements = document.querySelectorAll('[id^="tt-"]'); var bridgedCount = 0; allTTElements.forEach(function (element) { var oldId = element.id; var newPopoverId = tooltipMapping[oldId]; if (newPopoverId && tooltipContent[newPopoverId]) { var content = tooltipContent[newPopoverId]; if (!element._tippy) { tippy(element, { content: content, theme: 'light', arrow: true, animation: 'fade', duration: [200, 150], placement: 'top', interactive: true, maxWidth: 300, allowHTML: true }); bridgedCount++; } } }); // 2. Handle new data-tooltip-id elements var dataElements = document.querySelectorAll('[data-tooltip-id]'); dataElements.forEach(function (element) { var contentKey = element.getAttribute('data-tooltip-id'); // Map short keys (euroaming) to full keys (tooltip_euroaming) if needed, or expect full keys in HTML // Let's support both or assume HTML uses the keys defined in tooltipContent // AUTO-PREFIX mapping: if key is 'euroaming', look for 'tooltip_euroaming' var fullKey = contentKey.startsWith('tooltip_') ? contentKey : 'tooltip_' + contentKey; var content = tooltipContent[fullKey] || tooltipContent[contentKey]; if (content && !element._tippy) { tippy(element, { content: content, theme: 'light', arrow: true, animation: 'fade', duration: [200, 150], placement: 'bottom', interactive: true, maxWidth: 300, allowHTML: true }); bridgedCount++; } }); // ==================================================================== // 2. Tarife Page - "9.99€ sparen" benefit tooltips // ==================================================================== var benefitSpans = document.querySelectorAll('.contract-button__benefit[data-tooltip-content]'); var benefitCount = 0; benefitSpans.forEach(function (span) { var selectorId = span.getAttribute('data-tooltip-content'); if (!selectorId) { return; } // Remove leading # if present (convert CSS selector to ID) var contentId = selectorId.replace(/^#/, ''); var contentElement = document.getElementById(contentId); if (contentElement) { // Use innerText instead of textContent for hidden elements var content = (contentElement.innerText || contentElement.textContent || '').trim(); if (!content) { // Fallback: try innerHTML if innerText/textContent is empty var htmlContent = contentElement.innerHTML || ''; content = htmlContent.replace(/<[^>]*>/g, '').trim(); } if (content && !span._tippy) { tippy(span, { content: content, theme: 'light', arrow: true, animation: 'fade', duration: [200, 150], placement: 'top', interactive: false, maxWidth: 300 }); benefitCount++; } else if (!content) { console.warn('⚠️ No content in: ' + contentId); } } }); } // Initialize when DOM is ready if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', initTooltips); } else { setTimeout(initTooltips, 100); } })();