Skip to content

Commit 6f9a981

Browse files
committed
Fix link to zip in solution of exercise 20.4
1 parent 65825f8 commit 6f9a981

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ CHAPTERS := 00_intro 01_values 02_program_structure 03_functions 04_data 05_high
44

55
SVGS := $(wildcard img/*.svg)
66

7-
html: $(foreach CHAP,$(CHAPTERS),html/$(CHAP).html) html/js/chapter_info.js html/js/acorn_codemirror.js \
8-
code/skillsharing.zip code/solutions/20_4_a_public_space_on_the_web.zip \
7+
html: $(foreach CHAP,$(CHAPTERS),html/$(CHAP).html) html/js/acorn_codemirror.js \
8+
code/skillsharing.zip code/solutions/20_4_a_public_space_on_the_web.zip html/js/chapter_info.js \
99
$(patsubst img/%.svg,img/generated/%.png,$(SVGS))
1010

1111
html/%.html: %.txt asciidoc_html.conf

bin/chapter_info.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ dir.forEach(function(file) {
9292
solution: fs.readFileSync("code/solutions/20_3_creating_directories.js", "utf8")
9393
},
9494
{name: "A public space on the web",
95-
file: "code/solutions/20_4_a_public_space_on_the_web",
95+
file: "code/solutions/20_4_a_public_space_on_the_web.zip",
9696
number: 4,
9797
type: "js",
9898
code: nodeInfo,

html/js/code.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ addEventListener("load", function() {
140140
type: exercise.type};
141141
setEditorCode(exercise.code, exercise.type);
142142
visible = "exercise";
143-
document.querySelector("#download").href = "data:text/plain;charset=UTF-8," + exercise.solution;
143+
var link = document.querySelector("#download");
144+
if (/\.zip$/.test(exercise.file))
145+
link.href = exercise.file
146+
else
147+
link.href = "data:text/plain;charset=UTF-8," + exercise.solution;
144148
}
145149
["box", "exercise"].forEach(function(id) {
146150
document.querySelector("#" + id + "_info").style.display =

0 commit comments

Comments
 (0)