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

@ -43,11 +43,6 @@ c::set('plg_masonry.sort', 'sort'); // sortBy parameter: sort, title, etc.
c::set('plg_masonry.dir', 'asc'); // sortBy direction: asc, desc c::set('plg_masonry.dir', 'asc'); // sortBy direction: asc, desc
c::set('plg_masonry.lightbox', 'swipebox'); c::set('plg_masonry.lightbox', 'swipebox');
// plg-navbar style:
//c::set('navbar-class', 'navbar-inverse navbar-fixed-top');
//c::set('navbar-ignoreChildren', true);
//c::set('navbar-affix', true);
// bastians columns.php plugin from https://github.com/getkirby/plugins/tree/master/columns // bastians columns.php plugin from https://github.com/getkirby/plugins/tree/master/columns
c::set('columns.container', 'row'); c::set('columns.container', 'row');
c::set('columns.item', 'col-sm-6 columns'); c::set('columns.item', 'col-sm-6 columns');

View file

@ -4,44 +4,44 @@
// copyright: Jannik Beyerstedt | https://jannikbeyerstedt.de // copyright: Jannik Beyerstedt | https://jannikbeyerstedt.de
// license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License // 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--> <!-- Bootstrap core JavaScript-->
<?php echo js('assets/vendors/jquery-2.2.2.min.js') ?>
<?php <?php
if($bs_util) {
echo js('assets/vendors/bootstrap/js/dist/util.js'); echo js('assets/vendors/bootstrap/js/dist/util.js');
}
if($bs_collapse) {
echo js('assets/vendors/bootstrap/js/dist/collapse.js'); echo js('assets/vendors/bootstrap/js/dist/collapse.js');
}
if($bs_carousel) {
echo js('assets/vendors/bootstrap/js/dist/carousel.js'); echo js('assets/vendors/bootstrap/js/dist/carousel.js');
}
?> ?>
<?php if (c::get('navbar-affix')) : ?> <?php if (c::get('plg_masonry.enable') && $plg_masonry==true) : ?>
<script> <?php echo js('assets/vendors/masonry/dist/masonry.pkgd.min.js');?>
$('.navbar-wrapper').affix({
offset: {
top: $('header').height()
}
});
</script>
<?php endif; ?>
<?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"> <script type="text/javascript">
$('#masonry').masonry({ $('#masonry').masonry({
isFitWidth: true, isFitWidth: true,
@ -50,8 +50,17 @@ echo js('assets/vendors/bootstrap/js/dist/carousel.js');
itemSelector: '.masonryitem' itemSelector: '.masonryitem'
}); });
</script> </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 endif; ?>
<?php echo piwik(); ?> <?php echo piwik(); ?>
</body> </body>

View file

@ -21,4 +21,5 @@ snippet('base/cont-header');
</main> </main>
<?php snippet('base/cont-footer') ?> <?php snippet('base/cont-footer') ?>
<?php snippet('base/html-end') ?> <?php snippet('base/html-end', ["bs_util"=>1,
"bs_collapse"=>1]) ?>

View file

@ -24,4 +24,5 @@ snippet('base/cont-header');
</main> </main>
<?php snippet('base/cont-footer') ?> <?php snippet('base/cont-footer') ?>
<?php snippet('base/html-end') ?> <?php snippet('base/html-end', ["bs_util"=>1,
"bs_collapse"=>1]) ?>

View file

@ -27,4 +27,7 @@ snippet('base/cont-header');
</main> </main>
<?php snippet('base/cont-footer') ?> <?php snippet('base/cont-footer') ?>
<?php snippet('base/html-end') ?> <?php snippet('base/html-end', ["bs_util"=>1,
"bs_collapse"=>1,
"bs_carousel"=>1,
"plg_masonry"=>1]) ?>

View file

@ -24,4 +24,7 @@ snippet('base/cont-header');
</main> </main>
<?php snippet('base/cont-footer') ?> <?php snippet('base/cont-footer') ?>
<?php snippet('base/html-end') ?> <?php snippet('base/html-end', ["bs_util"=>1,
"bs_collapse"=>1,
"bs_carousel"=>0,
"plg_masonry"=>1]) ?>

View file

@ -39,4 +39,5 @@ snippet('base/cont-header');
</main> </main>
<?php snippet('base/cont-footer') ?> <?php snippet('base/cont-footer') ?>
<?php snippet('base/html-end') ?> <?php snippet('base/html-end', ["bs_util"=>1,
"bs_collapse"=>1]) ?>

View file

@ -33,4 +33,5 @@ snippet('base/cont-header');
</main> </main>
<?php snippet('base/cont-footer') ?> <?php snippet('base/cont-footer') ?>
<?php snippet('base/html-end') ?> <?php snippet('base/html-end', ["bs_util"=>1,
"bs_collapse"=>1]) ?>