_includes/course.html in askclass-course-theme-0.6.0 vs _includes/course.html in askclass-course-theme-0.7.0
- old
+ new
@@ -49,22 +49,32 @@
{%- endfor -%}
</div>
<div class="control">
<a class="button" href="/segment/{{ segment }}">
{{ info.title }}
- <span class="middle-align material-symbols-outlined">rocket_launch</span>
+ <span data-date="{{ info.end }}"
+ class="middle-align material-symbols-outlined rocket">rocket_launch</span>
</a>
</div>
</li>
{%- endif -%}
{%- endfor -%}
</ul>
<script defer>
const due = document.querySelectorAll('.due');
+ const rocket = document.querySelectorAll('.rocket');
due.forEach( el => {
const d = new Date(el.dataset.date.split('-')).getTime();
if (d < Date.now()) {
el.classList.add('past');
+ }
+ });
+ rocket.forEach( el => {
+ if (el.dataset.date) {
+ const d = new Date(el.dataset.date.split('-')).getTime();
+ if (d < Date.now()) {
+ el.innerText = 'rocket';
+ }
}
});
</script>