1
0
Fork 0

[SITE] activate js files in html-end separately for each template

This commit is contained in:
Jannik Beyerstedt 2016-04-15 22:53:09 +02:00
parent 2a2cf3bb89
commit 64cb550e9f
8 changed files with 52 additions and 38 deletions

View file

@ -4,44 +4,44 @@
// 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 echo js('assets/vendors/jquery-2.2.2.min.js') ?>
<?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('navbar-affix')) : ?>
<script>
$('.navbar-wrapper').affix({
offset: {
top: $('header').height()
}
});
</script>
<?php endif; ?>
<?php if (c::get('plg_masonry.enable') && $plg_masonry==true) : ?>
<?php echo js('assets/vendors/masonry/dist/masonry.pkgd.min.js');?>
<?php if (c::get('plg_masonry.enable')) {
echo js('assets/vendors/masonry/dist/masonry.pkgd.min.js');
}?>
<?php if (c::get('plg_masonry.lightbox')=='swipebox') {
echo js('assets/vendors/swipebox/src/js/jquery.swipebox.min.js');
}?>
<?php if ((c::get('plg_masonry.lightbox')=='swipebox')) : ?>
<script type="text/javascript">
$(document).ready(function () {
$('.swipebox' ).swipebox();
});
</script>
<?php endif; ?>
<?php if (c::get('plg_masonry.enable')) : ?>
<script type="text/javascript">
$('#masonry').masonry({
isFitWidth: true,
@ -50,8 +50,17 @@ echo js('assets/vendors/bootstrap/js/dist/carousel.js');
itemSelector: '.masonryitem'
});
</script>
<?php echo js('assets/vendors/swipebox/src/js/jquery.swipebox.min.js');?>
<script type="text/javascript">
$(document).ready(function () {
$('.swipebox' ).swipebox();
});
</script>
<?php endif; ?>
<?php echo piwik(); ?>
</body>