{{ define "header" }}
<!-- Sir, this is a homepage -->
{{ end }}{{ define "main" }}
<div class="wall"></div>

<div class="window hidden-lg-down">{{ partial "elements/window.html" . }}</div>

<!-- Neon sign above monitor -->
<div class="homepage-neon">{{ partial "elements/neon-sign.html" . }}</div>

<!-- Sticky notes -->
<div class="sticky-note note1 hidden-xl-down">fix bugs</div>
<div class="sticky-note note2 hidden-xl-down">pwd:<br />puppies</div>
<div class="sticky-note note3 hidden-xl-down">finish<br />coffee</div>
<div class="sticky-note note4 hidden-xl-down">CALL<br />WIFE</div>

<!-- Papers pinned to wall -->
<div class="wall-paper paper1"></div>
<div class="wall-paper paper2"></div>

<!-- X-Files "I want to believe" poster -->
<div class="xfiles-poster hidden-lg-down">
  <div class="xfiles-content">
    <div class="ufo-illustration">
      <div class="ufo-dome"></div>
      <div class="ufo-body">
        <div class="ufo-lights">
          <div class="ufo-light"></div>
          <div class="ufo-light"></div>
          <div class="ufo-light"></div>
          <div class="ufo-light"></div>
        </div>
      </div>
      <div class="light-beam"></div>
    </div>
    <div class="believe-text">I WANT TO<br />BELIEVE</div>
  </div>
</div>

<!-- Now playing poster on wall -->
<div class="poster hidden-xl-down">
  <div class="poster-image" id="posterImage">
    <script src="/js/nowplaying.js"></script>

    <div class="nowplayingcard">
      <div class="nowplayingcontainer-inner">
        <img id="trackart" src="" />
      </div>
    </div>
  </div>
  <div class="now-playing-note">Recently Played</div>
  <div class="now-playing-artist">
    <div class="trackInfo">
      <span id="artist"></span>
      <a id="tracktitle" style="display: none"></a>
      <a id="album" style="display: none"></a>
    </div>
  </div>
</div>

<script>
  setInterval(
    getLastTrack("ritualplays", "3a4fef48fecc593d25e0f9a40df1fefe"),
    10 * 1000,
  );
</script>

<!-- Desk -->
<div class="desk"></div>

<div class="homepage-container">
  <!-- LEFT COLUMN -->
  <div>
    <div class="secondary-screen updates-monitor">
      <div class="screen-display crt">
        <div class="scroll">
          > updates -lah<br />
          {{ range first 10 (union (where .Site.RegularPages "Type" "updates")
          (where .Site.RegularPages "Type" "blog")).ByDate.Reverse }} [<time
            >{{ .Lastmod.Format "02-01-2006" }}</time
          >]<br />
          {{ if eq .Type "blog" }} New blog post: {{ .Title }}<br />
          {{ else }} {{ .Plain }}<br />
          {{ end }} ---<br />
          {{ end }}

          <span class="cursor-blink">_</span>
        </div>
      </div>
    </div>

    <div class="secondary-screen wall-monitor-4 hidden-xl-down">
      <div class="screen-display amber crt" id="crt-logs">
        > tail -f /var/log<br />
        <span class="cursor-blink">_</span>
      </div>
    </div>
  </div>
  <!--  END LEFT COLUMN -->
  <!-- CENTER COLUMN -->
  <div class="hidden-lg-down">
    <div class="crt-monitor">
      <div class="crt-screen">
        <div class="content crt">
          <div id="terminal">
            <div id="output"></div>
            <div id="input-container" class="input-line hidden">
              <span class="prompt">></span>
              <input
                type="text"
                id="input"
                autocomplete="off"
                spellcheck="false"
              />
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="monitor-stand">
      <div class="stand-neck"></div>
      <div class="stand-base"></div>
    </div>
  </div>
  <!-- END CENTER COLUMN -->
  <!-- RIGHT COLUMN -->
  <div>
    <div class="secondary-screen wall-monitor-2 hidden-xl-down">
      <div class="screen-display tiny cyan crt">
        <div class="scroll-text">
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 172.16.0.1:22<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 172.16.0.1:22<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 172.16.0.1:22<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 172.16.0.1:22<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 172.16.0.1:22<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 172.16.0.1:22<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 172.16.0.1:22<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 172.16.0.1:22<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 172.16.0.1:22<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 172.16.0.1:22<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 172.16.0.1:22<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 172.16.0.1:22<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 172.16.0.1:22<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 172.16.0.1:22<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
          [PKT] 172.16.0.1:22<br />
          [PKT] 192.168.1.1:443<br />
          [PKT] 10.0.0.15:8080<br />
        </div>
      </div>
    </div>

    <a href="/blog/" class="secondary-screen blog-monitor">
      <div class="screen-display crt">
        <pre>
      ▄▄
 █▄    ██
 ██    ██          ▄▄
 ████▄ ██ ▄███▄ ▄████
 ██ ██ ██ ██ ██ ██ ██
▄████▀▄██▄▀███▀ ▀████
                   ██
██ NEW! ██▶▶▶    ▀▀▀</pre
        >
      </div>
    </a>
  </div>
  <!-- END RIGHT COLUMN -->
</div>

<div class="navigation">
  <div class="nav-lamp">{{ partial "elements/lavalamp.html" . }}</div>
  <div>
    <a href="/audio/">
      <div class="music">
        <div class="music-text">Music &amp; Audio Gear</div>

        {{ partial "elements/ipod.html" . }}

        <div class="">{{ partial "elements/vu-meter.html" . }}</div>

        <div class="notes">
          <div class="note">♪</div>
          <div class="note">♫</div>
          <div class="note">♪</div>
          <div class="note">♫</div>
          <div class="note">♪</div>
          <div class="note">♫</div>
        </div>
      </div>
    </a>
  </div>
  <div>
    <a href="/now/">
      <div class="time-display">
        {{ partial "elements/lcd-screen.html" (dict "text" "12:03:31"
        "placeholder" "00:00:00") }}
      </div>
    </a>
  </div>

  <div>
    <a href="/resources/">
      <div class="nav-cube">
        {{ partial "elements/companion-cube.html" . }}
        <div class="nav-cube-text">Experiments &amp; Resources</div>
      </div>
    </a>
  </div>

  <div>
    <div class="nav-floppy top">
      <a href="/guestbook/">
        {{ partial "elements/floppy.html" (dict "title" "Guestbook" "lines"
        (slice "" "" "DO NOT DELETE" "" "") "bgColor" "#1a4d8f" "bgColorDark"
        "#0d2747") }}
        <div class="nav-floppy-text">Guestbook</div>
      </a>
    </div>
    <div class="nav-floppy bottom">
      <a href="/buttons/">
        {{ partial "elements/floppy.html" (dict "title" "Buttons" "lines" (slice
        "" "" "NOT STICKERS" "" "") "bgColor" "#85112e" "bgColorDark" "#660a21")
        }}
        <div class="nav-floppy-text">Buttons &amp; Links</div>
      </a>
    </div>
  </div>

  <div>{{ partial "elements/crt-tv.html" . }}</div>
</div>

<!-- prettier-ignore -->
{{ range first 1 (union (where .Site.RegularPages "Type" "updates") (where .Site.RegularPages "Type" "blog")).ByDate.Reverse }}
<div id="latest-post">
  <div id="latest-post-link">{{ .Permalink }}</div>
  <div id="latest-post-title">
    {{ if eq .Type "blog" }} New blog post: {{ .Title }} {{ else }} {{ .Plain }}
    {{ end }}
  </div>
  <div id="latest-post-date">{{ .Lastmod.Format "Jan 2, 2006" }}</div>
</div>
{{ end }}

<!-- GitHub-style posting graph -->
<div class="posting-graph" style="display: none">
  <!-- Blog posts data as JSON -->
  <script id="blog-posts-data" type="application/json">
    {
      {{ $oneYearAgo := now.AddDate -1 0 0 }}
      {{ $allBlogPosts := where .Site.RegularPages "Type" "blog" }}
      {{ $recentBlogPosts := slice }}
      {{ range $allBlogPosts }}
        {{ if ge .Date.Unix $oneYearAgo.Unix }}
          {{ $recentBlogPosts = $recentBlogPosts | append . }}
        {{ end }}
      {{ end }}
      {{ $postsByDate := dict }}
      {{ range $recentBlogPosts }}
        {{ $dateKey := .Date.Format "2006-01-02" }}
        {{ $existing := index $postsByDate $dateKey }}
        {{ if $existing }}
          {{ $postsByDate = merge $postsByDate (dict $dateKey ($existing | append .)) }}
        {{ else }}
          {{ $postsByDate = merge $postsByDate (dict $dateKey (slice .)) }}
        {{ end }}
      {{ end }}
      {{ range $date, $posts := $postsByDate }}
        "{{ $date }}": [
          {{ range $index, $post := $posts }}
            {{ if $index }},{{ end }}
            {
              "title": {{ $post.Title | jsonify }},
              "url": "{{ $post.Permalink }}"
            }
          {{ end }}
        ]{{ if ne $date (index (last 1 (slice ($postsByDate | collections.KeyVals))) 0).Key }},{{ end }}
      {{ end }}
    }
  </script>

  <div class="post-graph-container">
    <div id="post-graph-info" class="post-graph-info">
      Hover over a day to see posts
    </div>
    <div id="weeks-container" class="weeks-container"></div>
  </div>
</div>

{{ end }}
