Skip to content

Commit 6ddd0b1

Browse files
committed
Improve PR, DEV-1111
1 parent 76843a9 commit 6ddd0b1

File tree

3 files changed

+10
-29
lines changed

3 files changed

+10
-29
lines changed

view/frontend/templates/iframe-handler.phtml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ $scriptString = '
7979
})(document, "iframe", "marketing");
8080
}
8181
82-
addEventListener("CookiebotOnConsentReady", function() {
83-
fixIframeStyle()
84-
});
82+
addEventListener("CookiebotOnConsentReady", fixIframeStyle);
8583
})';
8684
// checking on if SecureHtmlRenderer exists first, because this module is still compatible with Magento 2.3.x which doesn't include this class
8785
if (class_exists(SecureHtmlRenderer::class)) {

view/frontend/web/js/fotorama-video-events-mixin.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ define([
1414
return;
1515
}
1616

17-
const videoElement = event.target.querySelector('.product-video');
18-
19-
// Use the video blocker widget
20-
createVideoBlocker(videoElement);
17+
createVideoBlocker(e.target.querySelector('.product-video'));
2118
},
2219

2320
_initialize: function () {

view/frontend/web/js/slide-widget-mixin.js

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ define([
1010
return function (originalWidget) {
1111
return function (config, element) {
1212
let videoElement = element[0].querySelector('[data-background-type=video]');
13-
let PreviousStatus = '';
13+
let previousStatus = '';
1414
if (!videoElement) {
1515
return;
1616
}
@@ -25,7 +25,7 @@ define([
2525
)
2626

2727
function sliderVideoBlocker(){
28-
if (PreviousStatus === 'blocked' && !Cookiebot?.consent?.marketing) {
28+
if (previousStatus === 'blocked' && !Cookiebot?.consent?.marketing) {
2929
return;
3030
}
3131

@@ -34,7 +34,7 @@ define([
3434
videoElement.removeAttribute('data-video-src');
3535
createVideoBlocker(videoElement);
3636
videoElement.style.display = 'none';
37-
PreviousStatus = 'blocked';
37+
previousStatus = 'blocked';
3838
return;
3939
}
4040

@@ -48,9 +48,8 @@ define([
4848
videoElement.setAttribute('data-video-src', videoElement.getAttribute('data-cookieblock-src'));
4949
videoElement.style.display = 'block';
5050
videoElement.removeAttribute('data-cookieblock-src');
51-
52-
// Safely remove the consent blocker element with null checks
53-
const customSlide = videoElement.closest('.custom-slide-uwt');
51+
52+
const customSlide = videoElement.closest('.slick-slide');
5453
if (customSlide) {
5554
const consentBlocker = customSlide.querySelector('.cookieconsent-optout-marketing');
5655
if (consentBlocker) {
@@ -62,25 +61,12 @@ define([
6261
videoElement.appendChild(viewportElement);
6362
videoBackground(config, videoElement);
6463
videoElement.style.display = 'block';
65-
PreviousStatus = 'unblocked';
66-
67-
if ($slider.data('afterChangeIsSet')) {
68-
return;
69-
}
70-
71-
$slider.on('afterChange init', function () {
72-
var videoSlides = $slider[0].querySelectorAll('.jarallax');
73-
74-
_.each(videoSlides, function (videoSlide) {
75-
videoSlide.jarallax && videoSlide.jarallax.onScroll();
76-
});
77-
});
78-
79-
$slider.data('afterChangeIsSet', true);
64+
previousStatus = 'unblocked';
8065

66+
this.super(config, element);
8167
}
8268

8369
sliderVideoBlocker();
8470
};
8571
};
86-
});
72+
});

0 commit comments

Comments
 (0)