function goBack(){if (document.referrer.indexOf(window.location.host) !== -1) {history.go(-1); return false;}}; document.addEventListener('DOMContentLoaded', function() { if (document.referrer.indexOf(window.location.host) !== -1) {$('.goBackLink').removeClass('d-none');} function calculatePercent() { if ($('.priceRrp>.Price').length > 0){ $(".savingPercentTarget").removeClass("hidden"); $('.priceRow .price').addClass("salePrice"); var oldUVP=$('.priceRrp>.Price').text().replace(/,/,".").replace(/€/," "); var currentPrice = $('.xx-large>.Price').text().replace(/,/,".").replace(/€/," "); var oldUVP=oldUVP.replace(/[^0-9\.]+/g,""); var currentPrice = currentPrice.replace(/[^0-9\.]+/g,""); var percent = (oldUVP-currentPrice)/oldUVP*100; var percentRound = Math.round(percent); $(".savingPercentTarget").html("
-"+percentRound+"%
"); };}; calculatePercent(); let sel = document.querySelectorAll('.variation-select select'); sel.forEach(function() { this.addEventListener ("change", function () { setTimeout(function(){ calculatePercent(); }, 400); $('.availabilityWrapper').removeClass("opacity_0"); }); if($("select.custom-select option:selected").text().indexOf('Bitte') >= 0) {$('.availabilityWrapper').addClass("opacity_0");}; }); });