<?php

// Add the colorbox style sheet
$GLOBALS['TL_CSS'][] = 'files/themes/aldegott_2022/assets/js/lib/jBox/1.2.3/jBox.min.css|static';
$GLOBALS['TL_CSS'][] = 'files/themes/aldegott_2022/assets/js/lib/jBox/1.2.3/plugins/jBox.Image.css|static';
$GLOBALS['TL_CSS'][] = 'files/themes/aldegott_2022/assets/css/jBox.TooltipDurbacher.css|static';

?>

<script src="files/themes/aldegott_2022/assets/js/lib/jBox/1.2.3/jBox.all.min.js"></script>
<script>
  jQuery(function($) {
    $('a[data-jbox-iframe]').map(function() {
      new jBox('Modal', {
      	attach: $(this),
      	preventDefault: true,
        title: $(this).data('jbox-title') ? '<h3>' + $(this).data('jbox-title') + '</h3>' : ($(this).attr('title') ? '<h3>' + $(this).attr('title') + '</h3>' : ''),
        content: '<iframe frameborder="0" class="jBox-iframe" src="' + $(this).attr('href') + '"></iframe>',
        closeButton: 'title',
        width: 700,
        height: 650,
        theme: 'iframe',
        addClass: 'jBox-noPadding'
      });
    });

    $('a[data-jbox-modal]').map(function() {
      new jBox('Modal', {
        attach: $(this),
        preventDefault: true,
        title: $(this).data('jbox-title') ? '<h3>' + $(this).data('jbox-title') + '</h3>' : ($(this).attr('title') ? '<h3>' + $(this).attr('title') + '</h3>' : ''),
        content: $($(this).data('jbox-modal')),
        closeButton: 'title',
        width: 700,
        height: 650,
        theme: 'iframe',
        // addClass: 'jBox-noPadding'
      });
    });

    $('a[data-jbox-basic-modal]').map(function() {
      new jBox('Modal', {
        attach: $(this),
        preventDefault: true,
        // content: $($(this).data('jbox-basic-modal')),
        closeButton: 'box',
        // width: 700,
        // height: 650,
        theme: 'iframe',
        addClass: 'jBox-noPadding',
        // addClass: 'jBox-noPadding'
        onOpen: function () {
          this.setContent($($(this.source[0]).data('jbox-basic-modal'))[0].innerHTML);
        },
        onCloseComplete: function() {
          this.setContent('');
        }
      });
    });

    $lbImages = $('[data-lightbox]').filter(function(index) {
      if (!$(this).parents().eq(3).hasClass('slick-cloned'))
      {
        return true;
      }
    });

    new jBox('Image', {
      // Put custom options here
      gallery: 'data-lightbox',
      attach: $lbImages,
      imageCounter: true
    });

    new jBox('Tooltip', {
      attach: '[data-tooltip-title]',
      // pointer: 'right:60',
      getContent: 'data-tooltip-title',
      maxWidth: 250,
      /*position: {
        x: 'right',
        y: 'bottom'
      },
      offset: {
        x: -5,
        y: 5
      },*/
      // outside: 'x',
      zIndex: 4000,
      adjustPosition: true,
      adjustTracker: true,
      closeOnClick: true
    });

  });
</script>