@@ -9,15 +9,16 @@ define([
99
1010 return function ( originalWidget ) {
1111 return function ( config , element ) {
12- let videoElement = element [ 0 ] . querySelector ( '[data-background-type=video]' ) ;
12+ const videoElement = element [ 0 ] . querySelector ( '[data-background-type=video]' ) ;
13+ const blockVideoConsentConfig = window . cookiebotConfig && window . cookiebotConfig . blockVideosUntilConsent ;
1314 let previousStatus = '' ;
14- if ( ! videoElement ) {
15+ if ( ! videoElement || ! blockVideoConsentConfig ) {
1516 originalWidget ( config , element ) ;
1617 return ;
1718 }
1819
19- let viewportElement = document . createElement ( 'div' ) ;
20- const blockVideoConsentConfig = window . cookiebotConfig && window . cookiebotConfig . blockVideosUntilConsent ;
20+ const viewportElement = document . createElement ( 'div' ) ;
21+
2122
2223 addEventListener ( 'CookiebotOnLoad' , sliderVideoBlocker ) ;
2324
@@ -26,7 +27,7 @@ define([
2627 return ;
2728 }
2829
29- if ( ! Cookiebot ?. consent ?. marketing && blockVideoConsentConfig ) {
30+ if ( ! Cookiebot ?. consent ?. marketing ) {
3031 videoElement . setAttribute ( 'data-cookieblock-src' , videoElement . getAttribute ( 'data-video-src' ) ) ;
3132 videoElement . removeAttribute ( 'data-video-src' ) ;
3233 createVideoBlocker ( videoElement ) ;
@@ -50,7 +51,6 @@ define([
5051 if ( customSlide ) {
5152 const consentBlocker = customSlide . querySelector ( '.cookieconsent-optout-marketing' ) ;
5253 consentBlocker ?. remove ( ) ;
53-
5454 }
5555 }
5656 videoElement . setAttribute ( 'data-element-in-viewport' , '.jarallax-viewport-element' ) ;
0 commit comments