Skip to content

Latest commit

 

History

History
50 lines (47 loc) · 1.54 KB

template.index.markdown

File metadata and controls

50 lines (47 loc) · 1.54 KB
layout
liste
{% assign sorted = site.data.EVENT | sort_natural: 'name' %} {% for entry in sorted %} {% endfor %}
Name Company ASN IRC nick
{{ entry.name }} {{ entry.company }} {% if entry.asn %} {% if entry.asn contains ',' %} {% assign asns=entry.asn | split: ',' %} {% else %} {% assign asns=entry.asn | split: ' ' %} {% endif %} {% for asn in asns %} {{ asn|remove:"AS" }}
{% endfor %} {% endif %}
{{ entry.irc }}
<script> const getCellValue = (tr, idx) => tr.children[idx].innerText || tr.children[idx].textContent; const comparer = (idx, asc) => (a, b) => ((v1, v2) => v1 !== '' && v2 !== '' && !isNaN(v1) && !isNaN(v2) ? v1 - v2 : v1.toString().localeCompare(v2) )(getCellValue(asc ? a : b, idx), getCellValue(asc ? b : a, idx)); document.querySelectorAll('th').forEach(th => th.addEventListener('click', (() => { const table = th.closest('table').querySelector('tbody'); Array.from(table.querySelectorAll('tr')) .sort(comparer(Array.from(th.parentNode.children).indexOf(th), this.asc = !this.asc)) .forEach(tr => table.appendChild(tr) ); }))); </script>