<!DOCTYPE html>
<html lang="{{ site.lang | default: "en-US" }}">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  {% seo %}
  <link rel="stylesheet" href="{{ "/assets/css/style.css?v=" | append: site.github.build_revision | relative_url }}">
  <!--[if lt IE 9]>
  <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
  <![endif]-->
</head>
<body>
<div class="wrapper">
  <header>
    <h1><a href="https://my-first-pr.github.io">{{ site.title | default: site.github.repository_name }}</a></h1>

    {% if site.logo %}
    <img src="{{site.logo | relative_url}}" alt="Logo" />
    {% endif %}

    <p>{{ site.description | default: site.github.project_tagline }}</p>

    <p class="view"><a href="https://my-first-pr.github.io">Homepage</a></p>

    <h3>Current projects</h3>

    <div id="side-nav">
      <!-- nav goes here -->
    </div>
    <h3>Want to know your first PR?</h3>

    <p class="view"><a href="http://firstpr.me">firstpr.me</a></p>
  </header>
  <section>

    {{ content }}

  </section>
  <footer>
    <p>This project is maintained by <a href="https://www.github.com/my-first-pr">my-first-pr</a></p>

    <p><small>Hosted on GitHub Pages &mdash; Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
  </footer>
</div>
<script src="{{ "/assets/js/scale.fix.js" | relative_url }}"></script>
{% if site.google_analytics %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ site.google_analytics }}', 'auto');
ga('send', 'pageview');
</script>
{% endif %}
<script>
  var request = new XMLHttpRequest();
  request.open('GET', 'https://api.github.com/orgs/my-first-pr/repos');

  request.onload = function() {
    if (request.status >= 200 && request.status < 400) {
      var data = JSON.parse(request.responseText);
      data.forEach(function(item) {
        if (item.name !== 'my-first-pr.github.io') {
          var nav = document.getElementById('side-nav');
          var link = document.createElement("a");
          var p = document.createElement("p");
          link.innerHTML = item.name;
          link.href = item.homepage;
          p.appendChild(link);
          nav.appendChild(p);
        }
      })
    } else {
      console.error('something went wrong');
    }
  };

  request.onerror = function() {
    console.error('something went wrong');
  };

  request.send();
</script>
</body>
</html>