HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/hcv/wp-content/themes/hockey/frontend/js/core.bundle.js
'use strict';

(function ($) {
  $(document).ready(function () {

    $('.btn--switch').on('click', function () {
      $(this).toggleClass('btn--switch-selected');
    });

    $('.filter__toggle-button').on('click', function (e) {
      e.preventDefault();
      $('.filter__content').toggleClass('filter__content--visible');
      $('.filter').toggleClass('filter--visible');
      $('.filter__toggle').toggleClass('filter__toggle--visible');
      $('.filter__toggle-button').toggleClass('btn--toggle-icon-active');
      $('.filter__reset ').toggleClass('link--underlined-active');
      $('.filter__buttons .btn--switch').toggleClass('btn--switch-hollow');
    });

    $('#js-cart-toggle').on('click', function (e) {
      e.preventDefault();
      $('#js-cart').toggleClass('open');
      $('.cart__background').fadeToggle('fast');
    });

    $('.js-dd-button').on('click', function () {
      $('.js-dd-button-dropdown').not($(this).siblings('.js-dd-button-dropdown')).slideUp('fast');
      $(this).toggleClass('dd-button--active');
      $(this).siblings('.js-dd-button-dropdown').slideToggle('fast');
    });

    //Modal video
    var iframe = $("#video-container iframe");
    $(".modal-video-trigger").click(function (e) {
      e.preventDefault();
      var videoID = $(this).attr('data-video-url');
      videoID = videoID.replace("watch?v=", "embed/");
      iframe.attr("src", videoID);
      $(".modal-window").addClass("visible");
    });
    $(".modal-video-trigger-center").click(function (e) {
      if ($(this).parents('.center').length) {
        e.preventDefault();
        var videoID = $(this).attr('data-video-url');
        videoID = videoID.replace("watch?v=", "embed/");
        iframe.attr("src", videoID);
        $(".modal-window").addClass("visible");
      }
    });

    $(".close-modal").click(function (e) {
      e.preventDefault();
      $(this).closest(".modal-window").removeClass("visible");
      iframe.attr("src", '');
    });
    //#endModal

    // accordion
    $('.accordion .trigger').on('click', function () {
      if ($(this).parent().hasClass('active')) {
        $(this).next().slideToggle('fast');
        $(this).parent().toggleClass('active');
      } else {
        $(this).next().slideToggle('fast');
        $('.accordion__item.active .content').slideToggle('fast');
        $('.accordion__item.active').toggleClass('active');
        $(this).parent().toggleClass('active');
      }
    });

    // toggle more text
    $('.toggle-more-text').on('click', function (e) {
      e.preventDefault();
      var fullText = $(this).attr('data-full-text');
      $(this).parent('p').text(fullText);
    });

    /*** fastspring */
    $('#buy-form').submit(function (e) {
      var userMail = $('#email-input').val();
      var fastSpringUrl = $('#email-input').attr("data-fastspringurl");
      var fastSpringID = $('#email-input').attr("data-fastspringID");
      if (userMail === '') {
        $('#warning-message').css('display', 'block');
      } else {
        var callback = function callback(userId) {
          console.log(userId);
          if (userId > 0) {
            console.log('user is ok');
            var url = 'https://sites.fastspring.com/hockeycoachvision/api/order?referrer=articleId-' + fastSpringID + '_userId-' + userId;
            var form = $('<form method=POST action=' + url + '>' + '<input name=operation value=create>' + '<input name=destination value=order>' + '<input name=product_1_path value=/' + fastSpringUrl + '>' + '<input name=product_1_quantity value=1/>' + '<input name=contact_email  value=' + userMail + ' />' + '<input type=submit  value=Buy />' + '</form>');
            $('body').append(form);
            form.submit();
          } else {
            console.log('user is not ok');
            $('#warning-message').css('display', 'block');
          }
        };

        ;

        // $('#warning-message')
        //   .css('display','inline-block');

        $.ajax({
          headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json'
          },
          'type': 'POST',
          'url': 'https://api.hockeycoachvision.com/hcv/1/user/pro/email',
          'data': userMail,
          'dataType': 'json',
          'success': callback
        });
      }
      return false;
    });

    // Newsletter send to API
    $("#sendToApi").submit(function (e) {
      e.preventDefault();

      var reqData = {};

      $(this).find("input, textarea").each(function () {
        if ($(this).attr("type") != "submit" && $(this).attr("name") != "") {
          reqData[$(this).attr("name")] = $(this).val();
        }
      });

      reqData["url"] = location.pathname + location.search;

      $.ajax({
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json'
        },
        type: 'POST',
        url: 'https://hcv-admin-api.azurewebsites.net/web/registration',
        data: JSON.stringify(reqData),
        dataType: 'json',
        success: function success(res) {
          $("#apiResponse").text(res.message);
        },
        error: function error(res) {
          $("#apiResponse").text(res.responseText);
        }
      });
    });

    //Cookies stuff

    var cookies = {
      createCookie: function createCookie(name, value, days) {
        if (days) {
          var date = new Date();
          date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
          var expires = "; expires=" + date.toUTCString();
        } else var expires = "";
        document.cookie = name + "=" + value + expires + "; path=/";
      },
      readCookie: function readCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(";");
        for (var i = 0; i < ca.length; i++) {
          var c = ca[i];
          while (c.charAt(0) == " ") {
            c = c.substring(1, c.length);
          }if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
        }
        return null;
      },
      eraseCookie: function eraseCookie(name) {
        createCookie(name, "", -1);
      }
    };

    if (!cookies.readCookie('cookiesAccepted')) {
      setTimeout(function () {
        $(".cookies-bar").animate({
          bottom: "0"
        }, 500);
      }, 500);
    }

    $("[data-clear-cookies]").on('click', function (e) {
      cookies.createCookie('cookiesAccepted', 'true', '365');
      $(".cookies-bar").animate({
        bottom: "-100%",
        height: "toggle"
      }, 200);
    });
  });

  var owl = $('.owl-carousel');
  var currentIndex = 1;
  owl.children().each(function (index) {
    $(this).attr('data-position', index);
  });

  $(document).on('click', '.owl-item>div:not(.js-not-clickable .owl-item div)', function () {
    var speed = 300; // in ms
    var index = $(this).data('position');
    currentIndex = index + 1;
    owl.trigger('to.owl.carousel', [index, speed]);
    goToSlide(currentIndex);
  });

  function goToSlide(slideIndex) {
    $('.video-carousel__content-item.active').removeClass('active');
    $('.video-carousel__title.active').removeClass('active');
    $('[data-content-index="' + slideIndex + '"]').addClass('active');
    $('[data-title-index="' + slideIndex + '"]').addClass('active');
  }

  // testimonials gotoLink animation
  if ($('.container--narrow .testimonial').length) {
    var url = window.location.href;
    var goToLink = $('#js-testimonial-' + url.slice(url.length - 3));
    var currentBgColor = goToLink.css('background-color');

    goToLink.css('background-color', '#E1EFF4');
    goToLink.css('border', '2px solid #A3E0FF');
    setTimeout(function () {
      goToLink.css('border', '2px solid transparent');
      goToLink.css('background-color', currentBgColor);
    }, 800);
  }
})(jQuery);
"use strict";

(function ($) {
  $(document).ready(function () {

    // const mediaQueryMobile = window.matchMedia("(min-width: 992px)");
    // if (mediaQueryMobile.matches) {
    //     // window width is at least 992px
    // } else {
    //     // window width is less than 992px
    // }

    /*
    const slideWrap = $("#js-slider");
    let activeSlideId = 0;
    let paginationItems;
    const sliderItems = document.getElementsByClassName("slider__item-wrap");
    const sliderItemsCount = sliderItems.length;
    const sliderPagination = document.querySelector(".slider__pagination");
    let autoplay;
    let autoplayTimer = 8000;
      if(sliderItems.length) {
       if (activeSlideId === 0) {
        document.querySelector(".slider-arrows__left").classList.add("hide");
      }
       // NEXT
      function nextSlide() {
         document.querySelector(".slider-arrows__left").classList.remove("hide");
        if (activeSlideId < sliderItems.length - 1) {
          sliderItems[activeSlideId].classList.add("removing");
          activeSlideId = activeSlideId + 1;
          setTimeout(() => {
            switchSlideNext(activeSlideId);
          }, 1000);
          updatePagination(activeSlideId);
        }
        if (activeSlideId === sliderItems.length - 1) {
          document.querySelector(".slider-arrows__right").classList.add("hide");
        }
      }
       document.querySelector(".slider-arrows__right").addEventListener("click", function () {
        clearInterval(autoplay);
        setTimeout(() => {
          autoplay = setInterval(() => nextSlide(), autoplayTimer);
        }, 500);
        nextSlide();
      });
       function switchSlideNext(id) {
        sliderItems[id - 1].classList.remove("active");
        sliderItems[id].classList.remove("next");
        sliderItems[id].classList.add("active");
        if (id < sliderItems.length - 1) {
          sliderItems[id + 1].classList.add("next");
        }
      }
       // PREV
      function prevSlide() {
        document.querySelector(".slider-arrows__right").classList.remove("hide");
        if (activeSlideId === 1) {
          document.querySelector(".slider-arrows__left").classList.add("hide");
        }
        if (activeSlideId > 0) {
          sliderItems[activeSlideId].classList.add("next");
          if (activeSlideId === sliderItemsCount - 1) {
          } else {
            sliderItems[activeSlideId + 1].classList.remove("next");
          }
          sliderItems[activeSlideId - 1].classList.add("active");
          sliderItems[activeSlideId].classList.remove("active");
          activeSlideId = activeSlideId - 1;
          setTimeout(() => {
            switchSlidePrev(activeSlideId);
          }, 1000);
          updatePagination(activeSlideId);
        }
      }
       document.querySelector(".slider-arrows__left").addEventListener("click", function () {
        clearInterval(autoplay);
        setTimeout(() => {
          autoplay = setInterval(() => nextSlide(), autoplayTimer);
        }, 500);
        prevSlide();
      });
       function switchSlidePrev(id) {
        sliderItems[id].classList.remove("next");
        sliderItems[id].classList.remove("removing");
      }
       function initPagination() {
        for (let i = 0; i < sliderItemsCount; i++) {
          var paginationItem = document.createElement("div");
          paginationItem.className = "slider__pagination-item";
          sliderPagination.appendChild(paginationItem);
        }
        paginationItems = document.getElementsByClassName("slider__pagination-item");
        paginationItems[0].classList.add("active");
      }
       function updatePagination(id) {
        for (let i = 0; i < paginationItems.length; i++) {
          paginationItems[i].classList.remove("active");
        }
        paginationItems[id].classList.add("active");
      }
       slideWrap.on("swipeleft", function (e, data) {
        clearInterval(autoplay);
        setTimeout(() => {
          autoplay = setInterval(() => nextSlide(), autoplayTimer);
        }, 500);
        nextSlide();
      });
       slideWrap.on("swiperight", function (e, data) {
        clearInterval(autoplay);
        setTimeout(() => {
          autoplay = setInterval(() => nextSlide(), autoplayTimer);
        }, 500);
        prevSlide();
      });
       initPagination();
       autoplay = setInterval(() => nextSlide(), autoplayTimer);
     }*/

  });
})(jQuery);
'use strict';

(function ($) {
  $(document).ready(function () {

    // #js-carousel-blocks
    var carouselBlocks = $('#js-carousel-blocks');
    carouselBlocks.owlCarousel({
      loop: true,
      margin: 20,
      dots: false,
      lazyLoad: false,
      center: false,
      autoWidth: false,
      responsive: {
        0: {
          items: 1.2
        },
        500: {
          items: 2.1
        },
        768: {
          items: 3
        }
      }
    });

    $(".carousel-blocks__next").click(function (e) {
      e.preventDefault();
      carouselBlocks.trigger('next.owl.carousel');
    });

    $(".carousel-blocks__previous").click(function (e) {
      e.preventDefault();
      carouselBlocks.trigger('prev.owl.carousel');
    });

    // #js-carousel-blocks-wide
    var carouselBlocksWide = $('#js-carousel-blocks-wide');
    carouselBlocksWide.owlCarousel({
      loop: true,
      margin: 20,
      dots: false,
      lazyLoad: false,
      center: true,
      autoWidth: false,
      responsive: {
        0: {
          items: 1.2
        },
        768: {
          items: 1.0
        }
      }
    });

    $(".carousel-blocks-wide__next").click(function (e) {
      e.preventDefault();
      carouselBlocksWide.trigger('next.owl.carousel');
    });

    $(".carousel-blocks-wide__previous").click(function (e) {
      e.preventDefault();
      carouselBlocksWide.trigger('prev.owl.carousel');
    });

    // #js-carousel-testimonials
    var carouselTestimonials = $('#js-testimonials');
    carouselTestimonials.owlCarousel({
      loop: true,
      margin: 20,
      dots: false,
      lazyLoad: false,
      center: false,
      autoWidth: false,
      responsive: {
        0: {
          items: 1.2
        },
        768: {
          items: 2.0
        }
      }
    });
    $(".testimonials__next").click(function (e) {
      e.preventDefault();
      carouselTestimonials.trigger('next.owl.carousel');
    });

    $(".testimonials__previous").click(function (e) {
      e.preventDefault();
      carouselTestimonials.trigger('prev.owl.carousel');
    });

    // #js-carousel-video
    var carouselVideo = $('#js-video-carousel');
    carouselVideo.owlCarousel({
      // items:1,
      // merge:true,
      loop: true,
      margin: 10,
      lazyLoad: false,
      center: true,
      autoWidth: false,
      video: false,
      responsive: {
        0: {
          items: 1.2
        },
        500: {
          items: 1.8
        },
        992: {
          items: 4
        }
      }
    });

    $('.js-video-carousel-next').click(function (e) {
      e.preventDefault();
      carouselVideo.trigger('next.owl.carousel');
    });
    $('.js-video-carousel-previous').click(function (e) {
      e.preventDefault();
      carouselVideo.trigger('prev.owl.carousel');
    });

    // #js-carousel-logos
    $('#js-logos').owlCarousel({
      loop: true,
      margin: 10,
      dots: true,
      video: false,
      lazyLoad: true,
      center: false,
      autoWidth: false,
      autoplay: true,
      autoplayTimeout: 4000,
      responsive: {
        0: {
          items: 3
        },
        500: {
          items: 4
        },
        768: {
          items: 6
        }
      }
    });
  });
})(jQuery);
'use strict';

// start keen slider after all images have loaded
var imgs = document.images,
    len = imgs.length,
    counter = 0,
    wpadminbar = document.getElementById("wpadminbar"),
    slider = document.getElementById('js-keen-slider');

if (wpadminbar) {
  len = len - 1;
}

[].forEach.call(imgs, function (img) {
  if (img.complete) incrementCounter();else img.addEventListener('load', incrementCounter, false);
});

function incrementCounter() {
  counter++;
  if (counter === len && slider) {
    startSlider();
  }
}

function startSlider() {
  var slider = new KeenSlider("#js-keen-slider", { // start keen slider
    loop: true,
    created: function created(instance) {
      document.getElementById("arrow-left").addEventListener("click", function () {
        instance.prev();
      });

      document.getElementById("arrow-right").addEventListener("click", function () {
        instance.next();
      });
      var dots_wrapper = document.getElementById("dots");
      var thumbs_wrapper = document.getElementById("thumbs");
      var thumbs = document.querySelectorAll(".slider-thumbs__thumb");
      var slides = document.querySelectorAll(".keen-slider__slide");
      if (slides.length > 1) {
        if (dots_wrapper) {
          slides.forEach(function (t, idx) {
            var dot = document.createElement("button");
            dot.classList.add("dot");
            dots_wrapper.appendChild(dot);
            dot.addEventListener("click", function () {
              instance.moveToSlide(idx);
            });
          });
        } else if (thumbs_wrapper) {
          thumbs.forEach(function (item, idx) {
            item.addEventListener('click', function () {
              instance.moveToSlide(idx);
            });
          });
        }
      }
      updateClasses(instance);
    },
    slideChanged: function slideChanged(instance) {
      updateClasses(instance);
    }
  });
}

function updateClasses(instance) {
  var slide = instance.details().relativeSlide;
  var arrowLeft = document.getElementById("arrow-left");
  var arrowRight = document.getElementById("arrow-right");
  slide === 0 ? arrowLeft.classList.add("arrow--disabled") : arrowLeft.classList.remove("arrow--disabled");
  slide === instance.details().size - 1 ? arrowRight.classList.add("arrow--disabled") : arrowRight.classList.remove("arrow--disabled");

  var dots = document.querySelectorAll(".dot");
  dots.forEach(function (dot, idx) {
    idx === slide ? dot.classList.add("dot--active") : dot.classList.remove("dot--active");
  });
  var thumbs = document.querySelectorAll(".slider-thumbs__thumb");
  thumbs.forEach(function (item, idx) {
    idx === slide ? item.classList.add("slider-thumbs__thumb--active") : item.classList.remove("slider-thumbs__thumb--active");
  });
}
"use strict";

(function ($) {
  $(document).ready(function () {
    // const mediaQueryMobile = window.matchMedia("(min-width: 992px)");
    // Headroom
    // grab an element

    var headerElement = document.querySelector(".site-header");
    // construct an instance of Headroom, passing the element
    // initialise

    var headroom = new Headroom(headerElement, { 'offset': 300 });
    headroom.init();

    $(".hamburger").click(function (e) {
      $(".site-header__wrap").toggleClass("open");
      $(".site-header").toggleClass("menu-open");
      if ($("html").hasClass("menu-open")) {
        setTimeout(function () {
          $("html").removeClass("menu-open");
        }, 300);
      }
      $("html").addClass("menu-open");
      $("body").toggleClass("menu-open");
      $(this).toggleClass("active");
    });

    $(".site-header__item").click(function (e) {
      $(".site-header__wrap").removeClass("open");
      $(".site-header").removeClass("menu-open");
      $("html").removeClass("menu-open");
      $("body").removeClass("menu-open");
      $(".hamburger").removeClass("active");
    });
    // if (mediaQueryMobile.matches) {
    //   $(".site-header__item.dropdown").hover(function (e) {
    //     // window width is at least 992px
    //   });
    // } else {
    //   $(".site-header__item.dropdown").click(function (e) {
    //     // window width is less than 992px
    //     $(this).find(".site-header__submenu").slideToggle();
    //   });
    // }
  });
})(jQuery);