11define ( [
22 'jquery' ,
3- 'CustomGento_Cookiebot/js/video-blocker-widget'
4- ] , function ( $ , createVideoBlocker ) {
3+ 'CustomGento_Cookiebot/js/video-blocker-widget' ,
4+ 'CustomGento_Cookiebot/js/video-platform-validator'
5+ ] , function ( $ , createVideoBlocker , isSupportedVideoPlatform ) {
56 'use strict' ;
67
78 return function ( originalWidget ) {
8- function isSupportedVideoPlatform ( url ) {
9- if ( ! url ) {
10- return false ;
11- }
12-
13- var youtubePattern = / ^ h t t p s ? : \/ \/ ( w w w \. ) ? ( y o u t u b e \. c o m | y o u t u \. b e ) \/ / i;
14- var youtubeNocookiePattern = / ^ h t t p s ? : \/ \/ ( w w w \. ) ? y o u t u b e - n o c o o k i e \. c o m \/ / i;
15- var vimeoPattern = / ^ h t t p s ? : \/ \/ ( w w w \. ) ? ( v i m e o \. c o m | p l a y e r \. v i m e o \. c o m ) \/ / i;
16-
17- return youtubePattern . test ( url ) ||
18- youtubeNocookiePattern . test ( url ) ||
19- vimeoPattern . test ( url ) ;
20- }
21-
229 function getValidDimension ( value , fallback ) {
2310 if ( ! value || parseFloat ( value ) === 0 ) {
2411 return fallback ;
@@ -38,12 +25,12 @@ define([
3825 return ;
3926 }
4027
41- var blockVideoConsentConfig = window . cookiebotConfig && window . cookiebotConfig . blockVideosUntilConsent ;
42- var videoSrc = videoElement . getAttribute ( 'data-video-src' ) ;
43- var cookieblockSrc = videoElement . getAttribute ( 'data-cookieblock-src' ) ;
44- var src = videoSrc || cookieblockSrc ;
45- var previousStatus = '' ;
46- var blockerElement = null ;
28+ const blockVideoConsentConfig = window . cookiebotConfig && window . cookiebotConfig . blockVideosUntilConsent ;
29+ const videoSrc = videoElement . getAttribute ( 'data-video-src' ) ;
30+ const cookieblockSrc = videoElement . getAttribute ( 'data-cookieblock-src' ) ;
31+ const src = videoSrc || cookieblockSrc ;
32+ let previousStatus = '' ;
33+ let blockerElement = null ;
4734
4835 if ( ! blockVideoConsentConfig || ! isSupportedVideoPlatform ( src ) ) {
4936 originalWidget ( config , element ) ;
0 commit comments