$(document).ready(function () { console.log('Jasper script loaded'); if ($("#category-description").length) { var jasperData = $.parseJSON($("#category-description").text()); console.log(jasperData); if (("sub_slider" in jasperData) && jasperData.sub_slider != false && jasperData.sub_slider != null && jasperData.sub_slider != '') { if (jasperData.hero_title != false && jasperData.hero_title != '') { $('.cta-container .cta-title').text(jasperData.hero_title); } if (jasperData.hero_copy != false && jasperData.hero_copy != '') { $('.cta-container .cta-description').text("We created the indoor cycling category and the first Spinner® bike, setting the fitness industry standard for the past 25 years. Whether you are a high-end studio or just looking for a great ride at home, we have the world’s best bikes for you."); $('.category-description-mobile .content-description').text("We created the indoor cycling category and the first Spinner® bike, setting the fitness industry standard for the past 25 years. Whether you are a high-end studio or just looking for a great ride at home, we have the world’s best bikes for you."); } $('.cta-container .cta-button').hide(); $('#header-container').find('img:first').attr('src', "https://maddogg-assets.s3.amazonaws.com/1c2153ecd544926aca3f696b9cccdeaef048022179a32f8ba5f735238f246a48.jpg"); } else { if (jasperData.hero_title != false && jasperData.hero_title != '') { $('.cta-container .cta-title').text(jasperData.hero_title); } if (jasperData.hero_copy != false && jasperData.hero_copy != '') { $('.cta-container .cta-description').text(jasperData.hero_copy); } if (jasperData.cta_label == false || jasperData.cta_label == '' || jasperData.cta_link == false || jasperData.cta_link == "") { $('.cta-container .cta-button').hide(); } else { $('.cta-container .cta-button').text(jasperData.cta_label).attr('href', jasperData.cta_link); } if (jasperData.background_image != false && jasperData.background_image != '') { $('#header-container').find('img:first').attr('src', jasperData.background_image); } } if (("sub_slider" in jasperData) && jasperData.sub_slider != false && jasperData.sub_slider != null && jasperData.sub_slider != '') { // } else { if (jasperData.sub_hero != false && jasperData.sub_hero != '') { $( "#why-spinning-wrapper" ).load("https://s3.amazonaws.com/maddogg-english-blocks/" + jasperData.sub_hero, function () { $('.page-content .section:first .tabbed-z--slider').slick({ slidesToShow: 1, arrows: !1, autoplay: !0, dots: !0, speed: 1e3 }); }); } else { $("#why-spinning-wrapper").hide(); } } if (jasperData.right_promo != false && jasperData.right_promo != '' && jasperData.left_promo != false && jasperData.left_promo != '') { $('.promotion-boxes').html(''); $.get("https://s3.amazonaws.com/maddogg-english-blocks/" + jasperData.left_promo, function (data) { $('.promotion-boxes').append(data); }); $.get("https://s3.amazonaws.com/maddogg-english-blocks/" + jasperData.right_promo, function (data) { $('.promotion-boxes').append(data); }); } else { $('.promotion-boxes').hide(); } if (jasperData.sub_head != false && jasperData.sub_head != '') { $(".section.grey .section-header").text(jasperData.sub_head) } else { $(".section.grey .section-header").hide(); } if (jasperData.sub_description != false && jasperData.sub_description != '') { $(".section.grey .section-description").text(jasperData.sub_description) } else { $(".section.grey .section-description").hide(); } if ("product_grid" in jasperData) { if (jasperData.product_grid != false && jasperData.product_grid != null && jasperData.product_grid != '') { $("#categoryProductGrid").load("https://s3.amazonaws.com/maddogg-english-blocks/" + jasperData.product_grid, function () { // }); } else { // $("#categoryProductGrid").hide(); } } if (jasperData.gradient != false && jasperData.gradient != '') { $(".category-gradient").load("https://s3.amazonaws.com/maddogg-english-blocks/" + jasperData.gradient, function () { // }); } else { $(".category-gradient").hide(); } } } );