-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAllProblems.html
More file actions
131 lines (124 loc) · 5.77 KB
/
AllProblems.html
File metadata and controls
131 lines (124 loc) · 5.77 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
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>RobotCoding Practice</title>
<script src="requirejs/require.js" type="text/javascript"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="problems/QuizMaker.js" type="text/javascript"></script>
<script src="problems/ProblemArray.js" type="text/javascript"></script>
<link href="themes/problems.css" type="text/css" rel="stylesheet"/>
<link href="codemirror/lib/codemirror.css" type="text/css" rel="stylesheet"/>
<link href="codemirror/theme/neat.css" type="text/css" rel="stylesheet"/>
<link href="codemirror/addon/fold/foldgutter.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript">
sections = ["motor", "servo", "sensor", "logic", "loops", "mapping"];
//Used by the next button to loop around problems
count = 1;
</script>
</head>
<body>
<div id="arbitrary"></div>
<div id="nav">
<div id="motor" class="nav_wrap">
<div><button name="#motor" class="nav_link">Motor Basics</button></div>
</div>
<div id="servo" class="nav_wrap">
<div><button name="#servo" class="nav_link">Servo Basics</button></div>
</div>
<div id="sensor" class="nav_wrap">
<div><button name="#sensor" class="nav_link">Sensor Basics</button></div>
</div>
<div id="logic" class="nav_wrap">
<div><button name="#logic" class="nav_link">Logic Statements</button></div>
</div>
<div id="loops" class="nav_wrap">
<div><button name="#loops" class="nav_link">Loops</button></div>
</div>
<div id="mapping" class="nav_wrap">
<div><button name="#mapping" class="nav_link">Button Mapping</button></div>
</div>
<div id="home" class="nav_wrap link">
<a href="index.html" onclick="return confirm('Navigating from this page will delete all practice problem progress. Are you sure you want to leave this page?')" class="nav_link active">Back</a>
</div>
</div>
<script>
$(function() {
var container;
//Uses the length sections array and the two-dimention problems array to make the buttons for the problems
for(var i = 0; i < sections.length; i++) {
container = $("#" + sections[i]);
for(var j = 1; j <= problems[i].length; j++) {
var button = divO + ' class="subnav">' + buttonO + ' name="#' + sections[i] + j + '" class="nav_button">' + j + buttonC + divC;
container.append(button);
}
}
});
// Click listener for section headings excluding the 'Back' button
$('.nav_wrap').not('.link').on('click', $('#nav'), function(e){
e.preventDefault();
$('.nav_wrap').not(this).find('.subnav').removeClass('visible');
$(this).find('.subnav').toggleClass('visible');
}); // end click listener for section headings
</script>
<div id="base">
<h2 id="guide">Click on the navigation bar above to open the practice problems.</h2>
<h3>Progress on practice problems will be saved within the session, but if the page is refreshed or navigated away from, all progress will be lost.</h3>
<p>Note that in problems that require typing a full single line of code, <span>proper syntax,</span> such as putting a semicolon at the end of a line, <span>is required for the answer to be correct.</span> Questions that ask you to fill in the blanks of a piece of code, however, will include most syntax in the existing code and <span>will be correct only if they do not include extra syntax.</span></p>
<p>All free-coding questions do not allow for submitting the answer to be checked. Instead of a submit process, they can be downloaded and uploaded to robots to be tested or e-mailed to a mentor or instructor to be checked.<span>However, file downloads do not work on Internet Explorer or Safari. For file downloads, use Chrome or Firefox instead.</span></p>
<h4>Need help with RobotC conventions or methods? Other Ingraham RobotC resources are available <a href="https://ingrahamrobotics.org/resources/ftc-programming-resources/" target="_blank">here.</a></h4>
</div>
<div id="pages"></div>
<script type="text/javascript">
$(function() {
var container = $(pages);
//Reads through the problems array and dynamically calls the methods to make the problems
for(var i = 0; i < sections.length; i++) {
for(var j = 1; j <= problems[i].length; j++) {
var pageDiv = divO + ' id="' + sections[i] + j + '" class="section">\n';
var contDiv = divO + ' id="problem' + count + '" class="content">\n';
pageDiv += contDiv + divC + '\n' + divC;
container.append(pageDiv);
var c = problems[i][j - 1];
window['make' + c.type](c.question, c.specs, "#problem" + count, c.clarify);
count++;
}
}
//Called at the end to make CodeMirror instances
codeBoxMaker();
//Click listener for nav elements
$(".subnav").on("click", function(e) {
//If the clicked element is a navigation button
if(e.target && $(e.target).hasClass("nav_button")) {
//List item found!
var id = e.target.getAttribute("name").substring(1);
e.preventDefault();
$("#" + id).addClass("active");
}
}); //end click listener for nav
//Click listener for sub pages
$("#pages").on("click", function(e) {
//Click background/overlay
if(e.target && $(e.target).hasClass("section")) {
e.target.className = "section";
}
//Click close button
if( e.target && ( e.target.getAttribute("href") === "close" ) ) {
e.preventDefault();
e.target.parentNode.parentNode.parentNode.className = "section";
}
}); //end click listener for overlay
// Click listener for next button
$(".next").on('click', function(e) {
var id = $(this).parent().parent().parent().attr('id');
$("#" + id).parent().removeClass("active");
var idInt = (parseInt(id.substring(7)) + 1);
if(idInt >= count) {
idInt = 1;
}
$("#problem" + idInt).parent().addClass("active");
}); // end click listener for next button
});
</script>
</body>
</html>