4 {% include base_path.html %}
7 window.onload = function() {
8 var lesson_episodes = [
9 {% for episode in site.episodes %}
10 "{{ episode.url}}"{% unless forloop.last %},{% endunless %}
13 var xmlHttp = []; /* Required since we are going to query every episode. */
14 for (i=0; i < lesson_episodes.length; i++) {
15 xmlHttp[i] = new XMLHttpRequest();
16 xmlHttp[i].episode = lesson_episodes[i]; /* To enable use this later. */
17 xmlHttp[i].onreadystatechange = function() {
18 if (this.readyState == 4 && this.status == 200) {
19 var article_here = document.getElementById(this.episode);
20 var parser = new DOMParser();
21 var htmlDoc = parser.parseFromString(this.responseText,"text/html");
22 var htmlDocArticle = htmlDoc.getElementsByTagName("article")[0];
23 article_here.innerHTML = htmlDocArticle.innerHTML;
26 var episode_url = "{{ relative_root_path }}" + lesson_episodes[i];
27 xmlHttp[i].open("GET", episode_url);
28 xmlHttp[i].send(null);
33 Create an anchor for every episode.
35 {% for episode in site.episodes %}
36 <article id="{{ episode.url }}"></article>