jQuery(document).ready(function ($) { "use strict"; console.log('misc.js'); // adheres to new iOS video playback rules... $('video').attr('playsinline',''); $('video').attr('webkit-playsinline',''); // enables video controls to all videos including the cover videos $('video').attr('controls','controls'); // removes search bar in mobile because theme customization option does not work $('.searchform[role=search]').remove(); $('.wp-block-kadence-rowlayout').filter(':even').addClass('odd'); $('.wp-block-kadence-rowlayout').filter(':odd').addClass('even'); //setTimeout(function(){ $('.call-to-action').children('div').not(':first-child').wrapAll('
'); // console.log('formatted cta'); //},1000); // Makes PDFs open in new tabs $('a[href*=".pdf"]').each(function() { $(this).attr('target','_blank'); }); $.fn.changeElementType = function(newType) { var attrs = {}; console.log(this); $.each(this[0].attributes, function(idx, attr) { attrs[attr.nodeName] = attr.nodeValue; }); this.replaceWith(function() { return $("<" + newType + "/>", attrs).append($(this).contents()); }); }; $(".parallax-me").paroller({ factor: 0.5, factorXs: 0.2, type: 'background', direction: 'vertical' }); // converts gutenberg gallery block into Owl Carousel friendly syntax var gallery = '.make-me-into-an-owl'; if($(gallery).length) { $(gallery).addClass('owl-carousel custom-owl').removeClass('wp-block-gallery columns-3 is-cropped'); $(gallery + ' .blocks-gallery-item').addClass('item').removeClass('blocks-gallery-item'); //$(gallery + ' figure').wrap('
'); $(gallery + ' li').changeElementType('div'); $(gallery).changeElementType('div'); $(gallery).wrap(''); } setTimeout(function() { // Loads owl carousels $('.owl-carousel').owlCarousel({ loop: true, autoWidth: true, margin: 30, nav: true, navText: [ "
", "
" ], autoplay: false, autoplayHoverPause: true, responsive: { 0: { items: 1 }, 768: { items: 3 }, } }); }, 1000); $(window).load(function(){ let $video = $('#videojs') if ($video.length) { let player = videojs('#videojs',{ autoplay: true, muted: true, loop: true, // controls:false, }) player.addChild('MuteToggle') player.play() videojs.dom.setAttributes(document.getElementById('videojs_html5_api'),{'controls':'controls'}) videojs.on(player.getChild('MuteToggle').contentEl(),'click',function(){ let $this = $('.vjs-mute-control') if ($this.hasClass('mute-on')) { $this.removeClass('mute-on') $this.addClass('mute-off') } else if ($this.hasClass('mute-off')) { $this.removeClass('mute-off') $this.addClass('mute-on') } else { $this.addClass('mute-off') } }) let placeholderSpan = document.createElement('span') placeholderSpan.setAttribute('aria-hidden','true') placeholderSpan.setAttribute('class','vjs-icon-placeholder') let textSpan = document.createElement('span') textSpan.setAttribute('aria-live','polite') textSpan.setAttribute('class','vjs-control-text') textSpan.textContent = 'Tap for sound' videojs.dom.insertContent(player.getChild('MuteToggle').contentEl(),[placeholderSpan,textSpan]) } }) });