{% extends "base.html" %}

{% block analytics %}
<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  // tracker methods like "setCustomDimension" should be called before "trackPageView"
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//piwik.kwant-project.org/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', '6']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Piwik Code -->
{% endblock %}

{% block scripts %}
<!-- ThebeLab config -->
<!-- IMPORTANT: Everytime a python file is changed, ref needs to be updated to the latest commit! -->
<script type="text/x-thebe-config">
  {
    predefinedOutput: true,
    binderOptions: {
      repoProvider: "git",
      repo: "https://gitlab.kwant-project.org/solidstate/lectures",
      ref: "e6c970126f4e819e4a3eb717a86ba9fb523d20bf",
    },
    requestKernel: true,
    kernelOptions: {
      name: "python3",
      path: "src"
    },
  }
</script>
<!-- End ThebeLab config -->
{{ super() }}
{% endblock %}

{% block content %}
{% if 'thebelab-code' in super() %}
{{ super() | replace('</h1>', '</h1> <button id="thebelab-activate-button" class="thebelab-button" onclick="initThebelab()">Make live</button>', count=1) }}
{% else %}
{{ super() }}
{% endif %}
{% endblock %}