<?php
// -------------------------------------------
// kirby snippet FOR GENERAL

// copyright: Jannik Beyerstedt | https://jannikbeyerstedt.de
// license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License

// set switches, to enable parts of the code. All disabled by default!
// -------------------------------------------

// available switches:
$switches = array("bs_util", "bs_collapse", "bs_carousel", "plg_masonry");
$jquery = false;

foreach ($switches as $switch) {
  if (isset(${$switch}) && ${$switch}==true) {
    $jquery = true;
    ${$switch} = true;
  }else {
    ${$switch} = false;
  }
}
?>

<?php if($jquery) {
  echo js('assets/vendors/jquery-2.2.2.min.js');
}?>

<!-- Bootstrap core JavaScript-->
<?php
if($bs_util) {
echo js('assets/vendors/bootstrap/js/dist/util.js');
}
if($bs_collapse) {
echo js('assets/vendors/bootstrap/js/dist/collapse.js');
}
if($bs_carousel) {
echo js('assets/vendors/bootstrap/js/dist/carousel.js');
}
?>

<?php if (c::get('plg_masonry.enable') && $plg_masonry==true) : $width = c::get('plg_masonry.width');?>
  <style nonce="nRfqpuKWNuYyUAFPTr6WVNZk9">
    #masonry {margin: 0 auto;}
      .masonryitem { width: <?php echo $width ?>px; margin-bottom: 10px;}
      .masonryitem.w2 { width: 40%; }
  </style>

  <?php echo js('assets/vendors/masonry/dist/masonry.pkgd.min.js');?>

  <script type="text/javascript" nonce="nRfqpuKWNuYyUAFPTr6WVNZk9">
    $('#masonry').masonry({
      isFitWidth: true,
      columnWidth: <?php echo c::get('plg_masonry.width') ?>,
      gutter: 10,
      itemSelector: '.masonryitem'
    });
  </script>

  <?php echo js('assets/vendors/swipebox/src/js/jquery.swipebox.min.js');?>
  <?php echo css('assets/vendors/swipebox/src/css/swipebox.css') ?>

  <script type="text/javascript" nonce="nRfqpuKWNuYyUAFPTr6WVNZk9">
  $(document).ready(function () {
    $('.swipebox' ).swipebox();
  });
  </script>
<?php endif; ?>


<?php echo piwik(); ?>

</body>
</html>