2021-07-13 22:51:53 +00:00
|
|
|
// Scripts that run on document load need to be manually refreshed when inside the customizer
|
2021-10-14 19:12:44 +00:00
|
|
|
if (window.ctEvents) {
|
|
|
|
|
|
|
|
if ( window.ctEvents.default )
|
|
|
|
window.ctEvents.default.on('blocksy:frontend:init', onBlocksyFrontendInit);
|
|
|
|
else
|
|
|
|
window.ctEvents.on('blocksy:frontend:init', onBlocksyFrontendInit);
|
|
|
|
|
|
|
|
function onBlocksyFrontendInit() {
|
2021-07-13 22:51:53 +00:00
|
|
|
|
|
|
|
/* Handles updating Media Items component */
|
2021-04-27 17:43:03 +00:00
|
|
|
if (tainacan_plugin?.classes?.TainacanMediaGallery && tainacan_plugin?.tainacan_media_components) {
|
|
|
|
(Object.values(tainacan_plugin.tainacan_media_components) || []).forEach((component) => {
|
|
|
|
new tainacan_plugin.classes.TainacanMediaGallery(
|
|
|
|
component.has_media_thumbs ? '#' + component.media_thumbs_id : null,
|
|
|
|
component.has_media_main ? '#' + component.media_main_id : null,
|
|
|
|
component
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
2021-07-13 22:51:53 +00:00
|
|
|
|
|
|
|
/* Handles reloading the Items list */
|
2021-04-27 17:43:03 +00:00
|
|
|
document.dispatchEvent(new Event('TainacanReloadItemsListComponent'));
|
2021-07-14 00:06:16 +00:00
|
|
|
|
2021-07-13 22:51:53 +00:00
|
|
|
/* Handles updating Items carousel */
|
|
|
|
document.dispatchEvent(new Event('TainacanReloadCarouselItemsListBlock'));
|
2021-10-14 19:12:44 +00:00
|
|
|
|
|
|
|
/* Handles Dynamic Items lists */
|
|
|
|
document.dispatchEvent(new Event('TainacanReloadDynamicItemsBlock'));
|
|
|
|
|
|
|
|
}
|
2021-04-27 17:43:03 +00:00
|
|
|
}
|