function runAfterElementExists(jquery_selector, callback) {var checker = window.setInterval(function() {if ($(jquery_selector).length) {clearInterval(checker);callback();}}, 500);} runAfterElementExists('.ItemQuestionForm', function() { var ArtNr = $('#articleID').text(); $('input[name="variationid"]').val('4932307070'); $(".ItemQuestionForm form > input[data-mail='subject']").val("Artikel-ID: " + ArtNr); $('.ItemQuestionForm input[name="Artikelnr."]').attr('disabled', 'disabled').val(ArtNr); }); runAfterElementExists('.savingPart', function() { var oldUVP=3.3; var currentPrice = 3.3; function calculatePercent() {var percent = (oldUVP-currentPrice)/oldUVP*100;var percentRound = Math.round(percent);if(percentRound>2){$(".savingPart").html("-"+percentRound+"%");} else {$(".savingPart").hide();};}; calculatePercent(); }); 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');} var catURL = $('.breadcrumb li:nth-last-child(2)>a').attr('href');$('.single a.parentCatlink').attr("href", catURL); });