-
Notifications
You must be signed in to change notification settings - Fork 13
/
powerpack-beaver-builder.php
34 lines (32 loc) · 1.3 KB
/
powerpack-beaver-builder.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
defined( 'ABSPATH' ) or die();
if (!function_exists('cmplz_bb_powerpack_script')) {
function cmplz_bb_powerpack_script() {
ob_start();
?>
<script>
<?php //make sure the ajax loaded lightbox gets a blocked content container ?>
setInterval(function () {
cmplz_set_blocked_content_container();
}, 2000);
function cmplz_bb_add_event(event, selector, callback ) {
document.addEventListener(event, e => {
if ( e.target.closest(selector) ) {
callback(e);
}
});
}
<?php //If the marketing is accepted on the video, the lightbox dismisses the vidoe. We open it again. ?>
cmplz_bb_add_event('click', '.fancybox-container .cmplz-accept-category, .fancybox-container .cmplz-accept-service',
function(e){
document.querySelector('.pp-video-play-icon').click();
}
)
</script>
<?php
$script = ob_get_clean();
$script = str_replace(array('<script>', '</script>'), '', $script);
wp_add_inline_script( 'cmplz-cookiebanner', $script );
}
add_action( 'wp_enqueue_scripts', 'cmplz_bb_powerpack_script',PHP_INT_MAX );
}