function runAfterElementExists(jquery_selector, callback) { var checker = window.setInterval(function() {if ($(jquery_selector).length) {clearInterval(checker);callback();}}, 500);} $(document).ready(function(){var oldArtNr = $('.art-no>span.variationNumber').html();var newArtNr = oldArtNr.split('-', 3); /* runAfterElementExists('li.xmas.xmas10.d-none', function() {var newArtNr = oldArtNr.split('-', 3);if(newArtNr[0]==10){$('li.xmas.xmas10').removeClass('d-none')};}); */ runAfterElementExists('select.custom-select', function() { var oldArtNr = $('.art-no>span.variationNumber').html(); var newArtNr = oldArtNr.split('-', 3); $('.p-container').removeClass('d-none');$('.widget-add-to-basket').removeClass('d-none');if($("select.custom-select option").val() == '-1'){ $('.info>li.av').hide(); if (newArtNr.length > 2) { $('.art-no>span:nth-child(2)').after('' + newArtNr[0] +'-'+ newArtNr[1] +'').hide();} else {$('.art-no>span:nth-child(2)').after(''+ newArtNr[0] +'').hide();}}; $("select.custom-select").change(function() { $('.fromPrice').addClass('d-none'); $('.newnr').remove(); $('.art-no>span:nth-child(2)').delay( 1500 ).show(); $('.add-to-basket-container').removeClass("disabled"); $('.info>li.av').delay( 1500 ).show();}); $("select[id='custom-select_Diamant Qualität']").change(function() { $('.diamondInfoText').show();});}); $('input[name="variationid"]').val('21-3978-60-TW-if'); $(".ItemQuestionForm form > input[data-mail='subject']").val("Artikel-Nummer: " + oldArtNr); $('.ItemQuestionForm input[name="Artikelnr."]').attr('disabled', 'disabled').val(oldArtNr); $("select.custom-select").change(function() { $(".ItemQuestionForm form > input[data-mail='subject']").val("Artikel-Nummer: " + oldArtNr);}); runAfterElementExists('.img-container .bubble', function() {var oldUVP=694;var currentPrice = 509;function calculatePercent() {var percent = (oldUVP-currentPrice)/oldUVP*100;var percentRound = Math.round(percent);if(percentRound>2){$(".img-container .bubble").html("-"+percentRound+"%");}else {$(".short .crossprice").hide();$(".img-container .bubble").hide();};};calculatePercent();});var averageCount=$('.feedback-average-count').text();$('.sectionHeader .reviewCountTarget').html(averageCount);}); runAfterElementExists('.single .cross-box>div.col-12>.itemBox', function() { $('.single .cross-box>div.col-12>.itemBox').addClass('col-xs-6 col-sm-4 col-lg-3 col-xl-2 item');});