Skip to content

Commit

Permalink
add show courses button
Browse files Browse the repository at this point in the history
  • Loading branch information
Highfire1 committed Jun 22, 2024
1 parent 190c496 commit e3fe4a8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
11 changes: 7 additions & 4 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
<label>
<input type="button" id="mode2Button" value="Generate Timetables">
</label>
<label>
<input type="button" id="mode3Button" value="Load">
</label>
<label>
<input type="button" id="colorModeButton" value="🌒">
</label>
Expand All @@ -67,9 +70,6 @@
<!-- <label>
<input type="button" id="saveButton" value="Save">
</label> -->
<label>
<input type="button" id="mode3Button" value="Load">
</label>
</fieldset>

<div id="sidebar_mode1">
Expand Down Expand Up @@ -188,6 +188,9 @@
<label>
<input type="button" id="clearButton" value="Hide all courses.">
</label>
<label>
<input type="button" id="showCRNsButton" value="Show selected courses.">
</label>
</div>


Expand Down Expand Up @@ -315,7 +318,7 @@ <h3>Loading courses...</h3>
</fieldset>
<p id="saveResultText"></p>
-->
<div class="csidebar savediv green" id="betterSaveButton"><h3><span>Click here to create a new save.</span></h3></div>
<div class="csidebar savediv green" id="betterSaveButton"><h3><span>Click here to create a new save.<br>(note: it will not autosave)</span></h3></div>

<div id="savedSchedulesList" class="sidebarlist">
<!-- Add timetables here -->
Expand Down
13 changes: 13 additions & 0 deletions static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,19 @@ document.addEventListener('DOMContentLoaded', async function () {
c.clearFCalendar(false)
})

document.getElementById("showCRNsButton").addEventListener("click", function (event) {
let out = ""
let details = ""
for (const id of c.courses_oncalendar) {
out += id.split("-")[2] + " "

let c_obj = c.coursesMap.get(id)
details += `${c_obj.crn} ${c_obj.subject} ${c_obj.course_code} ${c_obj.section} ${c_obj.title} ${c_obj.schedule[0].instructor}\n`
console.log(c_obj)
}
alert(out + "\n\n" + details)
})

// TODO: redo this
// populate termSelector and event handler for changing terms
let ts = document.getElementById("termSelector")
Expand Down

0 comments on commit e3fe4a8

Please sign in to comment.