(function($) { "use strict"; $('body').on('click','.av-lazyload-video-embed .av-click-to-play-overlay', function(e){ // check if videos are disabled by user setting via cookie - or user must opt in. var cookie_check = $('html').hasclass('av-cookies-needs-opt-in') || $('html').hasclass('av-cookies-can-opt-out'); var allow_continue = true; var silent_accept_cookie = document.cookie.match(/aviacookiesilentconsent/); if( cookie_check && ! silent_accept_cookie ) { if( ! document.cookie.match(/aviacookieconsent/) || sessionstorage.getitem( 'aviacookierefused' ) ) { allow_continue = false; } else { if( ! document.cookie.match(/aviaprivacyrefusecookieshidebar/) ) { allow_continue = false; } else if( ! document.cookie.match(/aviaprivacyessentialcookiesenabled/) ) { allow_continue = false; } else if( document.cookie.match(/aviaprivacyvideoembedsdisabled/) ) { allow_continue = false; } } } if( ! allow_continue ) { if( typeof e.originalevent == 'undefined' ) { return; } //human click only var src_url = $(this).parents('.avia-video').data('original_url'); if( src_url ) window.open(src_url , '_blank'); return; } var clicked = $(this), container = clicked.parents('.av-lazyload-video-embed'), video = container.find('.av-video-tmpl').html(); container.html(video); }); $('.av-lazyload-immediate .av-click-to-play-overlay').trigger('click'); }(jquery));