// 1141010
(function pomav_2515() {
if (document.readyState === 'loading') {
return window.addEventListener('DOMContentLoaded', pomav_2515);
}
function updateMarkup() {
var neuroTeaser = $('.teaser-neuro');
neuroTeaser.each(function () {
var list = $(this).find('.content .text').html();
$(this)
.find('.links li:first-child')
.after('<li class="text">' + list + '</li>');
$(this).find('.content .text').remove();
});
}
function buildHeadline() {
var neuroTeaser = $('.teaser-neuro');
neuroTeaser.each(function () {
var visual = $(this).find('.figures').html();
var textOverline = $(this).find('.headline > .small').html();
var gbAnzahl = $(this).find('.headline > .h1').html();
var gbLteText = $(this).find('.headline > .h2').html();
var allnetText = $(this).find('.headline > .h3').text();
$(this).find('.headline > .h1').remove();
$(this).find('.headline > .h2').remove();
$(this).find('.headline > .h3').remove();
$(this).find('.headline > br').remove();
$(this).find('.headline > .small').remove();
$(this).find('.figures').remove();
var customMarkup =
"<div class='headline-details'>" +
"<div class='headline-details-text'>" +
(textOverline ? "<span class='overline'>" + textOverline + '</span>' : '') +
"<span class='gb-container'>" +
"<span class='sum'>" +
gbAnzahl +
'</span>' +
"<span class='speed'>" +
gbLteText +
'</span>' +
'</span>' +
"<span class='additional'>" +
allnetText +
'</span>' +
'</div>' +
'</div>';
// START POMAV-4013
// $(this).find('.headline > strong').after(customMarkup);
$(this).find('.headline').append(customMarkup);
// END POMAV-4013
});
}
function initSlider() {
var neuroSlider = $('.teaser-neuro').parents('.slider.slick-initialized');
neuroSlider.parents('section.section').addClass('psy-slider-section');
neuroSlider.parents('.item-collection ').addClass('psy-slider-collection');
if (neuroSlider.filter(':visible').length > 0) {
neuroSlider.slick('unslick');
neuroSlider.removeAttr('data-slider-config');
neuroSlider.slick({
adaptiveHeight: false,
arrows: true,
dots: true,
infinite: false,
slidesToShow: 1,
slidesToScroll: 1,
centerMode: true,
centerPadding: '48px'
});
neuroSlider.slick('slickGoTo', 2);
} else {
requestAnimationFrame(function () {
initSlider();
});
}
}
buildHeadline();
updateMarkup();
if (window.innerWidth < 769) {
initSlider();
}
// Tracking
function tes405Listeners() {
$('body').on('click', '.teaser.teaser-neuro .links a:not([href*=".pdf"]):not(.modal-link):not(.occl-modal-link):not(.occl-info-icon)', function (event) {
var $target = $(event.target);
if (!$target.is('a')) {
// clicked on icon or span or whatever inside the anker
$target = $target.closest('a');
}
if ($target.hasClass('link')) {
triggerTracking('tariff-click-textlink', $target);
} else {
triggerTracking('tariff-click-cta', $target);
}
// make sure we change location, even if trbo my not be available
window.setTimeout(function () {
window.location = $target.attr('href');
}, 1000);
event.preventDefault();
event.stopPropagation();
return false;
});
window.tes405ListenersSet = true;
}
function triggerTracking(name, $target) {
$(document).trigger('trboTrigger', {
triggerName: name,
triggerCallback: function () {
window.location = $target.attr('href');
}
});
}
if (!window.tes405ListenersSet) {
tes405Listeners();
}
// set same height for pricing in teaser & set same height for every headline container (flag, overline, price)
var pricingHeights = [];
var headlineHeights = [];
var neuroTeaser = $('.teaser-neuro');
function findHeights() {
setTimeout(function () {
$(neuroTeaser).find('.pricing').css('height', 'auto');
// $(neuroTeaser).find('.headline').css("height", 'auto');
pricingHeights = [];
headlineHeights = [];
neuroTeaser.each(function () {
this.style.setProperty('display', 'block', 'important');
var pricingHeight = $(this).find('.pricing').outerHeight();
// fix long content breaks on mobile and causes incorrect calculation
if (window.innerWidth < 768) {
if (pricingHeight === 140) {
pricingHeight = 123;
}
}
pricingHeights.push(pricingHeight);
this.style.setProperty('display', '');
});
// calculate the correct height of all headline containers
neuroTeaser.each(function () {
var $element = $(this);
// show all inactive teasers to calculate the correct height of all headline containers
this.style.setProperty('display', 'block', 'important');
var $parentContainer = $element.closest('.asm-neutral-collection');
var $teasers = $parentContainer.find('.teaser');
if ($teasers.length === 2) {
var $firstTeaser = $teasers.eq(0);
var $secondTeaser = $teasers.eq(1);
$firstTeaser.detach();
var headlineHeightFirst = $secondTeaser.find('.headline').outerHeight();
$parentContainer.append($firstTeaser);
$secondTeaser.detach();
var headlineHeightSecond = $firstTeaser.find('.headline').outerHeight();
$parentContainer.append($secondTeaser);
headlineHeights.push(headlineHeightFirst);
headlineHeights.push(headlineHeightSecond);
} else {
var headlineHeight = $element.find('.headline').outerHeight();
headlineHeights.push(headlineHeight);
}
// hide the inactive teasers again
this.style.setProperty('display', '');
});
setHeight();
}, 100);
}
function setHeight() {
$(neuroTeaser).find('.pricing').css('height', Math.max.apply(null, pricingHeights));
// set the height for all headline containers according to the highest height
$(neuroTeaser).find('.headline').css('height', Math.max.apply(null, headlineHeights));
}
findHeights();
// add payment snippet
function addPaymentInfo() {
var paymentInfoMarkup = `<li class="payment-info">
<tef-icon cloak icon="wunschaktivierung" size="3" type="product"></tef-icon>
<p><strong>Flexibler Zahlstart.</strong><br/>Deal jetzt. Tarif später zahlen
<a rel="nofollow" href="#id-1836178" class="modal-link occl-modal-link " occl-modal-fetch="/id/1836178?view=occlModal&amp;p=1836178" data-js="modals" data-cms-target="1836178"><tef-icon icon="information" size="1.0" type="functional" context="default" ratio="even" size-type="numeric"></tef-icon></a>
</p>
</li>`;
neuroTeaser.each(function () {
var teaserContent = $(this).find(' li.text');
teaserContent.after(paymentInfoMarkup);
});
}
// addPaymentInfo();
})();