timer
This commit is contained in:
parent
8a7b950a36
commit
9b447462ca
2 changed files with 4 additions and 12 deletions
|
|
@ -44,20 +44,12 @@ image: /assets/vid/discogs.jpg
|
|||
{% for track in album.tracks %}
|
||||
<p style="margin-bottom: 30px; font-family: monospace;font-size: 14px">
|
||||
<strong>{{ track.common.track.no }}. {{ track.common.title }}</strong><br />
|
||||
<span id="{{ track.common.title | slugify | remove: '-' }}"></span> |
|
||||
<span>{% assign round_seconds = track.format.duration | round %}{% assign minutes = round_seconds | divided_by: 60 %}{% assign leftover_seconds = minutes | times: 60 %}{{ minutes }}:{% assign seconds_without_zero = round_seconds | minus: leftover_seconds %}{% if seconds_without_zero < 10 %}0{% endif %}{{ seconds_without_zero }}</span> |
|
||||
<span style="font-family: monospace;font-size: 14px">{{ track.common.genre }} </span>
|
||||
</p>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var {{ track.common.title | slugify | remove: '-' }}timestamp = {{ track.format.duration | round }};
|
||||
var {{ track.common.title | slugify | remove: '-' }}hours = Math.floor({{ track.common.title | slugify | remove: '-' }}timestamp / 60 / 60);
|
||||
var {{ track.common.title | slugify | remove: '-' }}minutes = Math.floor({{ track.common.title | slugify | remove: '-' }}timestamp / 60) - ({{ track.common.title | slugify | remove: '-' }}hours * 60);
|
||||
var {{ track.common.title | slugify | remove: '-' }}seconds = {{ track.common.title | slugify | remove: '-' }}timestamp % 60;
|
||||
var {{ track.common.title | slugify | remove: '-' }}formatted = {{ track.common.title | slugify | remove: '-' }}hours.toString().padStart(2, '0') + ':' + {{ track.common.title | slugify | remove: '-' }}minutes.toString().padStart(2, '0') + ':' + {{ track.common.title | slugify | remove: '-' }}seconds.toString().padStart(2, '0');
|
||||
var theSpan = document.getElementById("{{ track.common.title | slugify | remove: '-' }}");
|
||||
theSpan.innerHTML = {{ track.common.title | slugify | remove: '-' }}formatted;
|
||||
</script>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
<br />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue