Countdown in closed-View

This commit is contained in:
MaZderMind 2015-04-30 13:07:38 +02:00
parent 88fa2b84ef
commit 91a548285c
5 changed files with 42 additions and 0 deletions

View file

@ -5,4 +5,17 @@ body.closed {
h1, h2, p {
text-align: center;
}
.countdown {
display: block;
text-align: center;
color: @gray-light;
font-size: @font-size-h3;
&::before,
&::after {
content: ' ';
}
}
}

7
assets/js/lib/moment.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -539,3 +539,23 @@ $(function() {
$(this).select();
});
});
// closed-countdown
$(function() {
var
$el = $('.closed .countdown'),
dt = moment($el.data('dt'));
$el.attr('title', 'on '+dt.format('dddd, MMM Do YYYY'))
function update() {
setTimeout(update, 5000);
var now = moment('2015-03-31');
if(dt.dayOfYear() == now.dayOfYear() && dt.year() == now.year())
$el.text('today');
else
$el.text( dt.from(now) );
}
update();
});

View file

@ -3,6 +3,7 @@
<? if($next): ?>
<h2>See you soon at <?=h($next['name'])?></h2>
<span class="countdown" data-dt="<?=h($next['start_date'])?>"></span>
<? endif ?>
<p>

View file

@ -39,6 +39,7 @@
<script type="text/javascript" src="assets/js/lib/jquery.scrollTo.min.js"></script>
<script type="text/javascript" src="assets/js/lib/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/js/lib/bootstrap-datepicker.min.js"></script>
<script type="text/javascript" src="assets/js/lib/moment.min.js"></script>
<script type="text/javascript" src="assets/mejs/mediaelement-and-player.min.js"></script>
<script type="text/javascript" src="assets/js/lustiges-script.js"></script>