Skip to content

Commit 4dec238

Browse files
authored
Merge pull request barbarer#182 from xinyinghou/master
Updated files to get rid of the navigation buttons
2 parents c792df0 + adf4d16 commit 4dec238

File tree

6 files changed

+76
-62
lines changed

6 files changed

+76
-62
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
Practice Problems
2+
============================
3+
4+
.. raw:: html
5+
6+
<h3>Loading...</h3>
7+
8+
<script type="text/javascript">
9+
10+
EXP_COOKIE = "mooc_nested";
11+
12+
// helper: set cookie
13+
function setCookie(name, value) {
14+
document.cookie = name + "=" + (value || "") + "; path=/";
15+
}
16+
17+
18+
// helper: get cookie
19+
function getCookie(name) {
20+
var cookieName = name + "=";
21+
var ca = document.cookie.split(';');
22+
for (var i = 0; i < ca.length; i++) {
23+
var c = ca[i].trim();
24+
if (c.indexOf(cookieName) === 0) return c.substring(cookieName.length);
25+
}
26+
return null;
27+
}
28+
29+
30+
window.onload = function() {
31+
32+
var href = '';
33+
// get prev set cookie
34+
var cond = getCookie(EXP_COOKIE);
35+
// if no prev set cookie: generate random condition and set cookie
36+
if (cond != 'nt' && cond != 'wt') {
37+
var v = Math.floor(Math.random() * 2);
38+
if (v < 1) {
39+
cond = 'nt';
40+
} else {
41+
cond = 'wt';
42+
}
43+
setCookie(EXP_COOKIE, cond); // expires at end of session
44+
}
45+
46+
if (cond == 'nt') {
47+
href = "mc_nested-nt.html"
48+
} else if (cond == 'wt') {
49+
href = "mc_nested-wt.html"
50+
}
51+
window.location.href = href;
52+
};
53+
</script>
54+

_sources/_hidden/mc_nested-nt.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
Practice
2-
=============
1+
Practice Problems
2+
============================
3+
34

45
.. activecode:: w1-mooc_nested
56
:autograde: unittest
@@ -22,9 +23,9 @@ Practice
2223
+======================================================================================+=======================================================================+
2324
|``add_quantity({"Fruits": ["Apples", "Bananas"], "Bakery": ["Bagels"]}, [3, 4, 6])`` | ``{"Fruits": {"Apples": 3, "Bananas": 4}, "Bakery": {"Bagels": 6}}`` |
2425
+--------------------------------------------------------------------------------------+-----------------------------------------------------------------------+
25-
|``add_quantity({"Drinks": ["Coffee", "Tea", "Juice"]}, [10, 5, 7])`` | `` {"Drinks": {"Coffee": 10, "Tea": 5, "Juice": 7}}`` |
26+
|``add_quantity({"Drinks": ["Coffee", "Tea", "Juice"]}, [10, 5, 7])`` | ``{"Drinks": {"Coffee": 10, "Tea": 5, "Juice": 7}}`` |
2627
+--------------------------------------------------------------------------------------+-----------------------------------------------------------------------+
27-
|``add_quantity({"Dairy": ["Milk"]}, [1])`` | `` {"Dairy": {"Milk": 1}}`` |
28+
|``add_quantity({"Dairy": ["Milk"]}, [1])`` | ``{"Dairy": {"Milk": 1}}`` |
2829
+--------------------------------------------------------------------------------------+-----------------------------------------------------------------------+
2930

3031
~~~~

_sources/_hidden/mc_nested-wt.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
Practice
2-
=============
1+
Practice Problems
2+
============================
3+
34

45

56
.. selectquestion:: t1-mooc_nested

_sources/_hidden/mc_pre_survey.rst

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -124,51 +124,17 @@ What to do next
124124

125125
.. raw:: html
126126

127-
<p>Click on the following link to go the practice problems: <b><a id="nested-practice"> <font size="+1">Practice</font></a></b></p>
127+
<p>Click on the following link to go the practice problems: <b><a id="mc_assign_more_practice"> <font size="+1">Practice</font></a></b></p>
128+
128129

129130
.. raw:: html
130131

131-
<script type="text/javascript">
132-
133-
function getCookie(cname) {
134-
let name = cname + "=";
135-
let decodedCookie = decodeURIComponent(document.cookie);
136-
let ca = decodedCookie.split(';');
137-
for(let i = 0; i <ca.length; i++) {
138-
let c = ca[i];
139-
while (c.charAt(0) == ' ') {
140-
c = c.substring(1);
141-
}
142-
if (c.indexOf(name) == 0) {
143-
return c.substring(name.length, c.length);
144-
}
145-
}
146-
return "";
147-
}
148-
149-
function setCookie(cname, cvalue) {
150-
document.cookie = cname + "=" + cvalue + ";";
151-
}
152-
153-
window.onload = function() {
154-
155-
a = document.getElementById("nested-practice")
156-
157-
// get prev set cookie
158-
var EXP_COOKIE = 'mooc_nested'
159-
var cond = getCookie(EXP_COOKIE);
160-
161-
// if no prev set cookie: generate random condition and set cookie
162-
if (cond != 'wt' && cond != 'nt') {
163-
var v = Math.random();
164-
cond = (v < 0.5) ? 'wt' : 'nt';
165-
setCookie(EXP_COOKIE, cond);
166-
}
167-
168-
if (cond == 'wt') {
169-
a.href = "mc_nested-wt.html"
170-
} else if (cond == 'nt') {
171-
a.href = "mc_nested-nt.html"
172-
}
173-
};
174-
</script>
132+
<script type="text/javascript" >
133+
134+
window.onload = function() {
135+
136+
a = document.getElementById("mc_assign_more_practice")
137+
a.href = "mc_assign_more_practice.html"
138+
};
139+
140+
</script>

_sources/_hidden/mc_start.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Rights
4444
^^^^^^^^^^^^^^^^^
4545
Your participation in this study is voluntary. You have the right to withdraw at any time without penalty. Refusal to participate or withdrawal of your consent or discontinued participation in the study will not result in any penalty or loss of benefits or rights to which you might otherwise be entitled.
4646

47-
If you have any questions about the study, please contact the research team at [email protected] or [email protected].
47+
If you have any questions about the study, please contact the research team at [email protected] or [email protected] or [email protected].
4848

4949
Voluntary Consent
5050
^^^^^^^^^^^^^^^^^
@@ -77,7 +77,7 @@ What to do next
7777
const consent_sent = document.getElementById('consent_sent');
7878
7979
if (!consent_sent) {
80-
alert('Please check the consent form before moving to the next.');
80+
alert('Please check the consent form before moving to the next. If it already appears as clicked, kindly re-click to confirm.');
8181
event.preventDefault();
8282
return false;
8383
}

_sources/index.rst

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,8 @@ Table of Contents
5757
:hidden:
5858
:maxdepth: 2
5959

60-
_hidden/student_survey.rst
61-
_hidden/mc_intro.rst
6260
_hidden/mc_start.rst
63-
_hidden/mc_nested-nt.rst
64-
_hidden/mc_puzzle_bank.rst
65-
_hidden/mc_nested-wt.rst
66-
_hidden/mc_post_survey.rst
67-
_hidden/mc_posttest.rst
68-
_hidden/mc_pre_survey.rst
69-
_hidden/mc_review.rst
61+
7062

7163
Acknowledgements
7264
::::::::::::::::

0 commit comments

Comments
 (0)