Skip to content

Commit 14f2322

Browse files
committedAug 1, 2017
remove the requirements check
The requirements were updated in the pages without any interactivity. Now, the quizzes and playfields are updated first an then the requirements to pass the step are updated. This way, we can remove the requirements update from the pages.
1 parent 8bdc7c2 commit 14f2322

File tree

8 files changed

+22
-37
lines changed

8 files changed

+22
-37
lines changed
 

‎de/00-01.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,3 @@
1919
Du kannst immer zwischen allen Schritten des Tutorials springen, indem du
2020
du Kreise oben auf der Seite verwendest.
2121
</p>
22-
<script type="text/javascript">
23-
window.addEventListener("load", function(){
24-
updateRequirements(); // nächste Seite grün machen
25-
});
26-
</script>

‎de/50-01.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,3 @@ <h3>Feedback</h3>
2727
<ul>
2828
<li>Ich fand es gut in kleinen Schritten erklärt. - <a target="_blank" href="https://github.com/kirstin">kirstin</a></li>
2929
</ul>
30-
31-
32-
<script type="text/javascript">
33-
window.addEventListener("load", function(){
34-
updateRequirements(); // nächste Seite grün machen
35-
});
36-
</script>

‎en/00-01.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,3 @@
1717
You can always go back and forth between the steps of the tutorial using the
1818
circles on the top of the page.
1919
</p>
20-
<script type="text/javascript">
21-
window.addEventListener("load", function(){
22-
updateRequirements(); // nächste Seite grün machen
23-
});
24-
</script>

‎en/50-01.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,3 @@
2121
<a target="_blank" href="{{ site.sourcecode.pullrequest }}">pull request</a>.
2222
</li>
2323
</ul>
24-
25-
<script type="text/javascript">
26-
window.addEventListener("load", function(){
27-
updateRequirements(); // nächste Seite grün machen
28-
});
29-
</script>

‎js/playfield.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ function getPlayfieldElement(playfield, index, name) {
151151
return playfieldElements[0];
152152
}
153153

154-
window.addEventListener("load", function(){
154+
function loadPlayfields(){
155+
if (playfieldsLoaded) {
156+
return;
157+
}
155158
var playfields = document.getElementsByClassName("playfield");
156159
for (var i = 0; i < playfields.length; i += 1) {
157160
var playfield = playfields[i];
@@ -165,7 +168,8 @@ window.addEventListener("load", function(){
165168
}
166169
}
167170
playfieldsLoaded = true;
168-
});
171+
}
172+
window.addEventListener("load", loadPlayfields);
169173

170174
window.addEventListener("keypress", function(event){
171175
if (event.which === 13 || event.keyCode === 13) {

‎js/quiz.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2+
var quizzesLoaded = false;
3+
14
function prependChoice(choice, correctness) {
25
var div = document.createElement("span");
36
div.classList.add("button");
@@ -54,7 +57,10 @@ function getQuizElement(quiz, index, name) {
5457
return playfieldElements[0];
5558
}
5659

57-
window.addEventListener("load", function(){
60+
function loadQuizzes(){
61+
if (quizzesLoaded) {
62+
return;
63+
}
5864
var quizzes = document.getElementsByClassName("quiz");
5965
for (var i = 0; i < quizzes.length; i += 1) {
6066
var quiz = quizzes[i];
@@ -63,4 +69,6 @@ window.addEventListener("load", function(){
6369

6470
watchQuiz(quiz, expression, choices, i);
6571
}
66-
});
72+
quizzesLoaded = true;
73+
}
74+
window.addEventListener("load", loadQuizzes);

‎js/requirements.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ function updateLinks() {
5757
}
5858
}
5959

60-
window.addEventListener("load", function(){
61-
updateLinks();
62-
});
63-
64-
60+
function loadRequirements(){
61+
loadPlayfields();
62+
loadQuizzes();
63+
updateRequirements(); // turn pages green if they are not interactive
64+
};
65+
window.addEventListener("load", loadRequirements);

‎sv/00-01.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,3 @@
1616
Du kan gå vidare till nästa steg genom att klicka på knappen nedan.
1717
Du kan alltid gå fram och tillbaka mellan stegen med hjälp av cirklarna på toppen av sidan.
1818
</p>
19-
<script type="text/javascript">
20-
window.addEventListener("load", function(){
21-
updateRequirements(); // nächste Seite grün machen
22-
});
23-
</script>

0 commit comments

Comments
 (0)
Please sign in to comment.