This repository has been archived by the owner on Oct 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
275 lines (263 loc) · 11.9 KB
/
index.html
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<!DOCTYPE html>
<html>
<head>
<link rel="icon" href="/media/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/media/favicon.ico" type="image/x-icon" />
<title>QuACS</title>
<script src="https://unpkg.com/vue"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.4.1.min.js" crossorigin="anonymous"></script>
<script
src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"
integrity="sha256-eGE6blurk5sHj+rmkfsGYeKyZx3M4bG+ZlFyA7Kns7E="
crossorigin="anonymous"></script>
</head>
<body>
<div id="app">
<div class="container">
<div class="row">
<br>
</div>
<div class="row">
<div class="col-xs">
</div>
<div class="col-lg">
<div class="alert alert-info" role="alert">
<b>NOTE:</b> QuACS is currently showing course schedules for Fall 2020
</div>
<img src="/media/quacs_logo.png" alt="QuACS logo" height="50">
<a href="https://bit.ly/RPIUPES20" style="float:right">
<img src="/media/upe.png" alt="Join UPE">
</a>
<br>
<p>
<h3>Welcome to QuACS!</h3>
QuACS the QUestionably Accurate Course Scheduler, is an alternative to yacs but our goal is to update as soon as sis releases the schedule for a semester. Sure yacs has more features, but while you wait for yacs to update why not use QuACS.
<br>
QuACS and the scrapers we use to collect the data are open source. View the code here <a href="https://github.com/quacs">https://github.com/quacs</a>. Feel free to make a PR or add an issue.
<br>
If you are intrested in QuACS development, we also have a discord server <a href="https://discord.gg/3xNxfBy">https://discord.gg/3xNxfBy</a>
</p>
<h3>How to use:</h3>
<ul>
<li>Click on sections you want to add to your selected courses.
<li>When you hover over a new section it turns green if there are no conflicts or red if there are
</ul>
<br>
<div class="desktop-hide">
<h3 style="padding-top:2rem">Selected courses:</h3>
<div v-for="(val,crn) in selected.courses">
<div v-if="val">
<div>{{crn_to_name[crn]}}</div>
<div style="margin-left:1rem">{{crn}}</div>
<br>
</div>
</div>
<br>
<br>
<br>
</div>
<div class="row">
<div class="col">
<h3>All courses:</h3>
<div v-for="department in courses">
<h3 class="course_title" onclick="$(this).parent().children('.course-container').slideToggle()" style="cursor: pointer;">{{department.code}}: <span style="font-size:15pt">{{department.name}}</span></h3>
<ul class="course-container list-group list-group-flush" style="display: none;">
<li v-for="course in department.courses" style="margin-left:2rem" class="list-group-item">
<h5><b>{{course.title}}</b> ({{course.subj}}-{{course.crse}}) <a :href="getCatalogUrl(course.subj, course.crse)" target="_blank" rel="noopener noreferrer">Catalog</a></h5>
<p>{{getDescription(course.subj, course.crse)}}</p>
<template v-for="section in course.sections">
<label :for="section.crn" style="margin-left:2rem; padding:.25rem; margin-bottom:0px" @mouseleave="removeColors()" @mouseover="checkConflict(section.timeslots, $event, section.crn)">
<input type="checkbox" :id="section.crn" v-model="selected.courses[section.crn]" v-bind="timeslots[section.crn]=section.timeslots, crn_to_name[section.crn] = section.title+' '+section.subj+'-'+section.crse+' (Section: '+section.sec+')', crn_to_times[section.crn]=section.timeslots">
<span :for="section.crn">Section:{{section.sec}} CRN:{{section.crn}} Dates:{{section.timeslots[0].date_start}}-{{section.timeslots[0].date_end}} <a :href="'https://sis.rpi.edu/rss/bwckschd.p_disp_detail_sched?term_in=202009&crn_in='+section.crn" target="_blank" rel="noopener noreferrer">View prereqs on sis</a></span>
<div v-for="time in section.timeslots" style="margin-left:2rem">
<div v-for="day in time.days" style="margin-left:2rem">
<span>{{day}}: {{formatTime(time.time_start)}}-{{formatTime(time.time_end)}} ({{time.Instructor}})</span>
</div>
</div>
</label>
<br>
</template>
</li>
</ul>
</div>
</div>
<div class="col-3 mobile-hide">
<div class="sticky-top">
<h3>Selected courses:</h3>
<div v-for="(val,crn) in selected.courses">
<div v-if="val" :id="'selected-'+crn" style="padding:.25rem">
<button type="button" class="close" v-on:click="removeClass(crn)" title="Remove Class">
<span>×</span>
</button>
<div>{{crn_to_name[crn]}}</div>
<div style="margin-left:1rem">{{crn}}</div>
<div v-for="time in crn_to_times[crn]" style="margin-left:2rem">
<div v-for="day in time.days" style="margin-left:2rem">
<span>{{day}}: {{formatTime(time.time_start)}}-{{formatTime(time.time_end)}}</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs">
</div>
</div>
</div>
</div>
<style media="screen">
.course_title{
padding: .25rem;
}
.course_title:hover{
background-color: lightgrey;
}
.desktop-hide{
display: none;
}
@media only screen and (max-width: 550px) {
/* Put this on elements you dont need on mobile */
.mobile-hide {
display: none !important;
}
.desktop-hide{
display: block;
}
}
.red{
background-color: red;
}
.green{
background-color: #00FF00;
}
</style>
<script>
var app = new Vue({
el: '#app',
data: {
courses: null,
selected: {'courses':[]},
crn_to_name: {},
crn_to_times: {},
timeslots: {},
catalog: {},
version: 'fall-20-v2'
},
mounted() {
if (localStorage.selected) {
this.selected = JSON.parse(localStorage.getItem('selected'));
if(this.selected == null || this.selected == "" || !this.selected['version'] || this.selected['version'] != this.version){
this.selected = {'version':this.version, 'courses':{}};
localStorage.setItem('selected', JSON.stringify(this.selected));
}
}else{
this.selected = {'version':this.version, 'courses':{}};
localStorage.setItem('selected', JSON.stringify(this.selected));
}
},
watch: {
selected: {
handler() {
localStorage.setItem('selected', JSON.stringify(this.selected));
},
deep: true,
}
},
methods: {
checkConflict(times, object, crn) {
let conflict_found = false;
for(let i=0;i<Object.keys(app.selected.courses).length;i++){//Check every enabled class
let key = Object.keys(app.selected.courses)[i]
if(crn == key){
continue;
}
if(app.selected.courses[key]){//only if it is actually enabled
let this_conflicts = false;
for(let j=0;j<times.length;j++){//for every time in the current class
for(let k=0;k<app.timeslots[key].length;k++){//for every time in the enabled class
if(app.timeslots[key][k].days.some(r=> times[j].days.includes(r))){
if(app.timeslots[key][k].time_start == -1 || app.timeslots[key][k].time_end == -1){
continue;
}
if(new Date(times[j].date_start+"/2020") >= new Date(app.timeslots[key][k].date_start+"/2020") && new Date(times[j].date_start+"/2020") <= new Date(app.timeslots[key][k].date_end+"/2020")){
}else if(new Date(times[j].date_end+"/2020") >= new Date(app.timeslots[key][k].date_start+"/2020") && new Date(times[j].date_end+"/2020") <= new Date(app.timeslots[key][k].date_end+"/2020")){
}else if(new Date(times[j].date_start+"/2020") <= new Date(app.timeslots[key][k].date_start+"/2020") && new Date(times[j].date_end+"/2020") >= new Date(app.timeslots[key][k].date_start+"/2020")){
}else if(new Date(times[j].date_start+"/2020") <= new Date(app.timeslots[key][k].date_end+"/2020") && new Date(times[j].date_end+"/2020") >= new Date(app.timeslots[key][k].date_end+"/2020")){
}else{
continue;
}
if(times[j].time_start >= app.timeslots[key][k].time_start && times[j].time_start <= app.timeslots[key][k].time_end){
this_conflicts = true;
}else if(times[j].time_end >= app.timeslots[key][k].time_start && times[j].time_end <= app.timeslots[key][k].time_end){
this_conflicts = true;
}else if(times[j].time_start <= app.timeslots[key][k].time_start && times[j].time_end >= app.timeslots[key][k].time_start){
this_conflicts = true;
}else if(times[j].time_start <= app.timeslots[key][k].time_end && times[j].time_end >= app.timeslots[key][k].time_end){
this_conflicts = true;
}
}
}
}
if(this_conflicts){
$('#selected-'+key).addClass('red');
$(event.currentTarget).addClass('red');
conflict_found = true;
}
}
}
if(conflict_found){
return;
}
$(event.currentTarget).addClass('green');
// $(event.currentTarget).css({'background-color': '#00FF00'}, 0).animate({'background-color': ''}, 1000);
},
removeColors() {
$('.red').removeClass('red');
$('.green').removeClass('green');
},
removeClass(crn) {
app.selected.courses[crn] = false;
},
formatTime(time) {
let hour = Math.floor(time/100)
let min = (time%100).toString()
let output = ""
if(hour > 12){
output = ('0' + (hour-12)).slice(-2);
}else{
output = ('0' + hour).slice(-2);
}
output+=":"+('0' + min).slice(-2);
if(hour > 11){
output+="pm";
}else{
output+="am";
}
return output;
},
getDescription(subject, code){
let output = ""
if(subject+'-'+code in app.catalog)
output+=app.catalog[subject+'-'+code].description + ' '
if(subject+'-'+code in app.catalog)
output+=app.catalog[subject+'-'+code].pre_req + ' '
return output
},
getCatalogUrl(subject, code){
if(subject+'-'+code in app.catalog)
return app.catalog[subject+'-'+code].url
}
}
})
$.getJSON('./courses.json', function (json) {
app.courses = json.departments;
});
$.getJSON('./catalog.json', function (json) {
app.catalog = json;
});
</script>
</body>
</html>