{% extends "base.html" %}

{% block libs %}
<script type="text/javascript">
// Watch for body creation and add the last used scheme
"use strict";

(function () {
  var observer = new MutationObserver(function (mutations) {
    mutations.forEach(function (mutation) {
      if (mutation.type === "childList") {
        if (mutation.addedNodes.length) {
          for (var i = 0; i < mutation.addedNodes.length; i++) {
            var el = mutation.addedNodes[i];

            if (el.nodeType === 1 && el.tagName.toLowerCase() === "body") {
              var scheme = localStorage.getItem('data-md-color-scheme');

              if (scheme) {
                el.setAttribute("data-md-color-scheme", scheme);
              }
            }
          }
        }
      }
    });
  });
  observer.observe(document.querySelector("html"), {
    childList: true
  });
})();

function toggleScheme() {
  var body = document.querySelector("body"),
      scheme = body.getAttribute("data-md-color-scheme");

  scheme = (scheme !== "dracula") ? "dracula" : "default";
  body.setAttribute("data-md-color-scheme", scheme);
}
</script>
{% endblock %}

{% block announce %}{% include "announce.html" ignore missing %}{% endblock %}

{% block content %}
  {{ super() }}
  <footer class="sponsorship">
    <hr>
    <a href="https://github.com/sponsors/facelessuser" title="Become a sponsor">
      <span class="twemoji heart-throb-hover">
        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M7.655 14.916L8 14.25l.345.666a.752.752 0 01-.69 0zm0 0L8 14.25l.345.666.002-.001.006-.003.018-.01a7.643 7.643 0 00.31-.17 22.08 22.08 0 003.433-2.414C13.956 10.731 16 8.35 16 5.5 16 2.836 13.914 1 11.75 1 10.203 1 8.847 1.802 8 3.02 7.153 1.802 5.797 1 4.25 1 2.086 1 0 2.836 0 5.5c0 2.85 2.045 5.231 3.885 6.818a22.075 22.075 0 003.744 2.584l.018.01.006.003h.002z"/></svg>
      </span>
    </a>
    <hr>
  </footer>
{% endblock %}
