{% extends "base.html" %}
{% block init %}
{% set page_class = "index" %}
{% endblock%}
{% block links %}
  <link rel="alternate" type="application/atom+xml" title="Atom Feed"
    href="{{ get_url(path="atom.xml", trailing_slash=false) }}">
{% endblock %}
{% block header %}{% endblock %}
{% block content %}
<section class="home">
<h1 class="my-name">Dustin C. Hatch</h1>
<ul class="my-attributes">
<li>Software Engineer</li>
<li>Linux Administrator</li>
<li>Tinkerer</li>
<li>Writer</li>
</ul>
<div class="links">
<div class="link">
<a href="{{ get_url(path='/cv') }}">
{{ load_data(path='static/file-document-outline.svg') | safe }}
Curriculum Vitae
</a>
</div>
<div class="link">
<a href="{{ get_url(path='/projects') }}">
{{ load_data(path='static/bug.svg') | safe }}
Projects
</a>
</div>
<div class="link">
<a href="{{ get_url(path='/blog') }}">
{{ load_data(path='static/post.svg') | safe }}
Blog
</a>
</div>
<div class="link">
<a href="{{ get_url(path='/gallery') }}">
{{ load_data(path='static/image.svg') | safe }}
Photos
</a>
</div>
</div>
</section>
{% endblock %}
{% block after_content %}
<div id="songquote"></div>
<script>
(function() {
window.addEventListener('DOMContentLoaded', (event) => {
    var xhr = new XMLHttpRequest();
    xhr.addEventListener('load', () => {
        var songs = JSON.parse(xhr.responseText);
        var idx = Math.floor(Math.random() * (songs.length - 1));
        var song = songs[idx];

        var elm = document.querySelector('#songquote');
        var elm_quote = document.createElement('span');
        elm_quote.className = 'quote';
        elm_quote.appendChild(document.createTextNode("“" + song.quote + "”"));
        elm.appendChild(elm_quote);
        elm.appendChild(document.createTextNode(" — "));
        var elm_citation = document.createElement('span');
        elm_citation.className = 'citation';
        elm_citation.title = song.album + " (" + song.year + ")";
        var elm_title = document.createElement('span');
        elm_title.className = 'title';
        elm_title.appendChild(document.createTextNode(song.title));
        elm_citation.appendChild(elm_title);
        elm_citation.appendChild(document.createTextNode(" by "));
        var elm_artist = document.createElement('span');
        elm_artist.className = 'artist';
        elm_artist.appendChild(document.createTextNode(song.artist));
        elm_citation.appendChild(elm_artist);
        elm.appendChild(elm_citation);
        elm.style.display = 'block';
    });
    xhr.open('GET', 'songquotes.json');
    xhr.send();
})
})();
</script>
{% endblock %}
