function runAfterElementExists(jquery_selector, callback) {var checker = window.setInterval(function() {if ($(jquery_selector).length) {clearInterval(checker);callback();}}, 500);} runAfterElementExists('.single-rightside .crossprice>del', function() { var oldUVP=0; var currentPrice = 13.49; function calculatePercent() { var percent = (oldUVP-currentPrice)/oldUVP*100; var percentRound = Math.round(percent); $(".saving_p").html(" (-"+percentRound+"%)"); currentSaving=oldUVP-currentPrice,currentSaving=currentSaving.toFixed(2).replace(/\./,","), $("#saving_eur").html(currentSaving+" EUR") }; 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); });