// Plyr player

const players = Plyr.setup('.plyr-player');

// Matomo track attributes

$('.video').each(function(){
  if($(this).find('.plyr-player source').is('source')){
    var src = $(this).find('.plyr-player source').attr('src');
    $(this).attr({'data-track-content':'', 'data-content-name':'video', 'data-content-piece':src});
  };
})
$('#container > .row:not(.video)').each(function(){
  var getClass = $(this).attr('class').split(' ');
  if (getClass.length > 1){
    var name = getClass.pop();
    $(this).attr({'data-track-content':'', 'data-content-name':'block', 'data-content-piece':name});
  }
})

// Max width

location.search.substr(1).split('&').forEach(function(e){
  if (e.split('=')[0] == 'container' && e.split('=')[1] == 'max'){
    document.getElementById('container').className = 'container-fluid';
  };
});

// Processor bullets

if ($('.processor span').is('span')){
  $('.processor span').html($('.processor span').html().replace('<b>', '<h2>').replace('</b><br><br>', '</h2>').replace(/<br>-/g, '<br>&bull;'));
};

//Slider

$('.slider').slick({
  infinite: true,
  dots: true,
  prevArrow: '<i class="slick-prev fas fa-chevron-left"></i>',
  nextArrow: '<i class="slick-next fas fa-chevron-right"></i>'
});

//Other JS

// $(document).ready(function() {
//   $('.wide[style]').each(function() {
//     console.log($(this).css('background-image'));
//   });
// });