-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathShowHide.js
More file actions
142 lines (128 loc) · 5.04 KB
/
Copy pathShowHide.js
File metadata and controls
142 lines (128 loc) · 5.04 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<!-- Mathjax -->
<script type='text/x-mathjax-config'>
MathJax.Hub.Config({
extensions: ['tex2jax.js'],
jax: ['input/TeX', 'output/HTML-CSS'],
tex2jax: {
inlineMath: [ ['$','$'], ['\\(','\\)'] ],
displayMath: [ ['$$','$$'], ['\\[','\\]'] ],
processEscapes: true
},
'HTML-CSS': { availableFonts: ['TeX'] }
});
</script>
<!-- The following code is for the quizzes -->
<script src="https://surveyjs.azureedge.net/1.0.50/survey.jquery.js"></script>
<link href="https://surveyjs.azureedge.net/1.0.50/survey.css" type="text/css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.6.4/showdown.min.js"></script>
<script>
function markdownConverterEWF() {
//Create showdown markdown converter
var converter = new showdown.Converter();
converter.setOption('ghCompatibleHeaderId', true);
survey
.onTextMarkdown
.add(function (survey, options) {
//convert the mardown text to html
var str = converter.makeHtml(options.text);
//remove root paragraphs <p></p>
str = str.substring(3);
str = str.substring(0, str.length - 4);
//set html
options.html = str;
MathJax.Hub.Queue(['Typeset',MathJax.Hub, 'options']);
});
};
// Quiz Header info
const jsonHeader = {
showProgressBar: "bottom",
showTimerPanel: "none",
maxTimeToFinishPage: 10000,
maxTimeToFinish: 25000,
firstPageIsStarted: true,
startSurveyText: "Start Quiz" //,
// title: "Does This Make Sense?"
}
// Three, four, and five question quizzes
function jsonSummary3EWF(json) {
let jsonEnd3 = {
completedHtml:
json["pages"][1]["questions"][0]["name"]+ "<br>"+
"<i>Question: </i>"+json["pages"][1]["questions"][0]["title"]+"<br>"+
"<i>Answer: </i>"+json["pages"][1]["questions"][0]["correctAnswer"]
+"<br>"+
json["pages"][2]["questions"][0]["name"]+ "<br>"+
"<i>Question: </i>"+json["pages"][2]["questions"][0]["title"]+"<br>"+
"<i>Answer: </i>"+json["pages"][2]["questions"][0]["correctAnswer"]
+"<br>"+
json["pages"][3]["questions"][0]["name"]+ "<br>"+
"<i>Question: </i>"+json["pages"][3]["questions"][0]["title"]+"<br>"+
"<i>Answer: </i>"+json["pages"][3]["questions"][0]["correctAnswer"]
};
return jsonEnd3;
};
function jsonSummary4EWF(json) {
jsonEnd4 = jsonSummary3EWF(json);
jsonEnd4.completedHtml = jsonEnd4.completedHtml +
"<br>"+
json["pages"][4]["questions"][0]["name"]+ "<br>"+
"<i>Question: </i>"+json["pages"][4]["questions"][0]["title"]+"<br>"+
"<i>Answer: </i>"+json["pages"][4]["questions"][0]["correctAnswer"]
;
return jsonEnd4;
};
function jsonSummary5EWF(json) {
jsonEnd5 = jsonSummary4EWF(json);
jsonEnd5.completedHtml = jsonEnd5.completedHtml +
"<br>"+
json["pages"][5]["questions"][0]["name"]+ "<br>"+
"<i>Question: </i>"+json["pages"][5]["questions"][0]["title"]+"<br>"+
"<i>Answer: </i>"+json["pages"][5]["questions"][0]["correctAnswer"]
;
return jsonEnd5;
};
</script>
<!-- This completes the code for the quizzes -->
<!-- Various toggle functions used throughout -->
<script language="javascript">
function toggle(id1,id2) {
var ele = document.getElementById(id1); var text = document.getElementById(id2);
if (ele.style.display == "block") {ele.style.display = "none"; text.innerHTML = "Show Solution";}
else {ele.style.display = "block"; text.innerHTML = "Hide Solution";}}
function togglecode(id1,id2) {
var ele = document.getElementById(id1); var text = document.getElementById(id2);
if (ele.style.display == "block") {ele.style.display = "none"; text.innerHTML = "Show R Code";}
else {ele.style.display = "block"; text.innerHTML = "Hide R Code";}}
function toggleEX(id1,id2) {
var ele = document.getElementById(id1); var text = document.getElementById(id2);
if (ele.style.display == "block") {ele.style.display = "none"; text.innerHTML = "Show Example";}
else {ele.style.display = "block"; text.innerHTML = "Hide Example";}}
function toggleTheory(id1,id2) {
var ele = document.getElementById(id1); var text = document.getElementById(id2);
if (ele.style.display == "block") {ele.style.display = "none"; text.innerHTML = "Show Theory";}
else {ele.style.display = "block"; text.innerHTML = "Hide Theory";}}
function toggleQuiz(id1,id2) {
var ele = document.getElementById(id1); var text = document.getElementById(id2);
if (ele.style.display == "block") {ele.style.display = "none"; text.innerHTML = "Show Quiz Solution";}
else {ele.style.display = "block"; text.innerHTML = "Hide Quiz Solution";}}
</script>
<!-- A few functions for revealing definitions -->
<script language="javascript">
<!-- $( function() {
$("#tabs").tabs();
} ); -->
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});
$(document).ready(function(){
$('[data-toggle="popover"]').popover();
});
</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-125587869-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-125587869-1');
</script>