(number, context)
| 155 | } |
| 156 | |
| 157 | selectChapter(number, context) { |
| 158 | this.per.textContent = "" |
| 159 | let chapter = getChapter(number) |
| 160 | if (chapter.exercises.length) { |
| 161 | this.per.appendChild(opt("box", "Select an exercise")) |
| 162 | chapter.exercises.forEach(exercise => { |
| 163 | let num = chapter.number + "." + exercise.number |
| 164 | this.per.appendChild(opt(num, num + " " + exercise.name)) |
| 165 | }) |
| 166 | } else { |
| 167 | this.per.appendChild(opt("box", "This chapter has no exercises")) |
| 168 | } |
| 169 | this.fileInfo.style.display = this.runLocally.style.display = "none" |
| 170 | this.fileList.textContent = this.localFileList.textContent = "" |
| 171 | if (chapter.links) chapter.links.forEach((file, i) => { |
| 172 | if (!i) this.runLocally.style.display = "" |
| 173 | addItem(this.localFileList, file) |
| 174 | }) |
| 175 | if (chapter.include) chapter.include.forEach((file, i) => { |
| 176 | if (!i) this.fileInfo.style.display = "" |
| 177 | if (!/(^|\/)_/.test(file)) addItem(this.fileList, file) |
| 178 | }) |
| 179 | this.selectContext(context || "box") |
| 180 | } |
| 181 | |
| 182 | parseFragment() { |
| 183 | let hash = document.location.hash.slice(1) |
no test coverage detected