{{ $wideViewAsDefault := $.context.Param "wideViewAsDefault" }}
<div class="mid">
  <div class="divider">

    <nav id="list-menu" class="l" data-dir="{{ $.context.Param "languagedir" | default "ltr" }}">
      {{ if $.context.Param "enableMenu" }}
        {{ partial "main/sections/list-menu.html" .context }}
      {{ end }}
    </nav>

    <article id="list-main" class="{{ if $wideViewAsDefault }}mr{{ else }}m{{ end }}" data-dir="{{ $.context.Param "languagedir" | default "ltr" }}">
      {{ partial "main/sections/list-main.html" .context }}
      {{ if .section_to_display }}
        {{ partial "main/sections/list-section.html" (dict "section_to_display" .section_to_display) }}
      {{ end }}
      {{ partial "main/component/pagination-single.html" .context }}
    </article>

    <section id="list-side" class="{{ if $wideViewAsDefault }}hide{{ else }}r{{ end }}" data-dir="{{ $.context.Param "languagedir" | default "ltr" }}">
    </section>

  </div>
</div>

<script>
  var listMenu = document.getElementById('list-menu');
  var listMain = document.getElementById('list-main');
  var listSide = document.getElementById('list-side');
  var switchElem = document.querySelector('.switch');
  var wideViewAsDefault = JSON.parse({{ $wideViewAsDefault | jsonify }});

  enquire.register("screen and (max-width:1280px)", {
    match: function () {
      if (wideViewAsDefault) {
        listMenu.className = 'l';
        listMain.className = 'mr';
        listSide.className = 'hide';
      } else {
        listMenu.className = 'l';
        listMain.className = 'm';
        listSide.className = 'r';
      }
    },
    unmatch: function () {
      if (wideViewAsDefault) {
        listMenu.className = 'l';
        listMain.className = 'mr';
        listSide.className = 'hide';
      } else {
        listMenu.className = 'l';
        listSide.className = 'r';
        listMain.className = 'm';
      }
    },
  }).register("screen and (max-width:960px)", {
    match: function () {
      listMenu.className = 'l';
      listMain.className = 'mr';
      listSide.className = 'hide';
      switchElem.className = 'hide';
    },
    unmatch: function () {
      if (wideViewAsDefault) {
        listMenu.className = 'l';
        listMain.className = 'mr';
        listSide.className = 'hide';
      } else {
        listMenu.className = 'l';
        listMain.className = 'm';
        listSide.className = 'r';
      }
      
      switchElem.className = 'switch';
    },
  }).register("screen and (max-width:600px)", {
    match: function () {
      listMenu.className = 'hide';
      listMain.className = 'lmr';
      listSide.className = 'hide';
      switchElem.className = 'hide';
    },
    unmatch: function () {
      listMenu.className = 'l';
      listMain.className = 'mr';
      listSide.className = 'hide';
      switchElem.className = 'hide';
    },
  });
</script>