{% load i18n %}
<footer class="footer">
  <hr>
  <div class="grid">
    {% for link in site_links %}<a target="_blank" rel="noopener" href="{{ link.url }}">{{ link.title }}</a>{% endfor %}
    <!-- <a href="/pages/rules/">{% trans 'Rules' %}</a> -->
    <!-- <a href="/pages/terms/">{% trans 'Terms' %}</a> -->
    <a href="{% url 'users:announcements' %}">{% trans 'Announcements' %}</a>
    <a href="{% url 'common:developer' %}">{% trans 'Developer' %}</a>
    <a title="{{ neodb_version }}"
       target="_blank"
       rel="noopener"
       href="https://github.com/neodb-social">{% trans 'Source Code' %}</a>
  </div>
  <div class="hide_unless_alter_domain" style="padding-top: 1em;">
    {% blocktrans %}You are visiting an alternative domain for {{ site_name }}, please always use <a href="{{ site_url }}{{ request.get_full_path }}">original version</a> if possible.{% endblocktrans %}
  </div>
</footer>
<div class="player"></div>
<script>
  document.body.addEventListener('htmx:configRequest', (event) => {
    event.detail.headers['X-CSRFToken'] = '{{ csrf_token }}';
  });
  $(function () {
    function _sidebar_auto_collapse(mm){
      if (mm.matches) {
        $('.auto-collapse').removeAttr('open')
      } else {
        $('.auto-collapse').attr('open', '')
      }
    }
    var mm = window.matchMedia("(max-width: 768px)")
    mm.addListener(_sidebar_auto_collapse);
    _sidebar_auto_collapse(mm);
    $('.auto-keep-collapse').each(function(){
      if (mm.matches || window.localStorage.getItem('details-'+$(this).attr('id'))=="closed") {
        $(this).removeAttr('open');
      } else {
        $(this).attr('open', '');
      }
    });
    setTimeout(function(){
      $('.auto-keep-collapse').on('toggle', function(event) {
        var id = $(this).attr('id')
        var isOpen = $(this).attr('open') === ''
        window.localStorage.setItem('details-' + id, isOpen ? 'open' : 'closed')
      });
    }, 0);
  });
</script>
