-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlearning.js
More file actions
65 lines (45 loc) · 956 Bytes
/
learning.js
File metadata and controls
65 lines (45 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
class Problem{
constructor(title, text, eq, answ, feedback ){
this.title = title;
this.text = text;
this.eq = eq;
this.answ = answ;
this.feedback = feedback;
}
generateSlide( markdown=true ){
return `
<section data-markdown>
<textarea data-template>
### this.title
###### this.text
\` this.eq \`
<form onsubmit="this.submitAnswer(1);"; return false;" action="#" >
<input class="input" type="text" name="text">
<input type="submit" name="submit">
</form>
</textarea>
</section>
`;
}
appendSlide(){
document.getElementsByClassName('slides').innerHTML += this.generateSlide() ;
}
submitAnswer( answ ){
if( this.answ === answ ){
return true;
}else{
return false;
}
}
}
class Feedback{
constructor( type, cond, text, callback=null){
this.type = type;
this.cond = cond;
this.text = text;
this.callback = callback;
}
get(){
return true;
}
}