Last active
November 14, 2021 22:11
-
-
Save acspike/abb6ec6324d309fdaaa227c53520e3f8 to your computer and use it in GitHub Desktop.
Hide courses that are not on your shortlist in the Oscar Look-up Classes Advanced Search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name GaTech Oscar Course Filter | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Hide courses that are not on your shortlist in the Oscar Look-up Classes Advanced Search | |
// @author aspike3 | |
// @match https://oscar.gatech.edu/bprod/* | |
// @icon https://www.google.com/s2/favicons?domain=gatech.edu | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
if(window.location.href == 'https://oscar.gatech.edu/bprod/bwskfcls.P_GetCrse'){ | |
// Fill in default OMSCS options on Advanced Search page | |
let opt; | |
const subj = document.getElementById('subj_id'); | |
for(opt of subj.options){ | |
if(opt.value === 'CS' || opt.value === 'CSE'){ | |
opt.selected = true; | |
}else{ | |
opt.selected = false; | |
} | |
} | |
const camp = document.getElementById('camp_id'); | |
for(opt of camp.options){ | |
if(opt.value === 'O'){ | |
opt.selected = true; | |
}else{ | |
opt.selected = false; | |
} | |
} | |
}else if(window.location.href == 'https://oscar.gatech.edu/bprod/bwskfcls.P_GetCrse_Advanced'){ | |
// Filter courses on Look-Up Classes to Add page | |
const SUBJ = 5; | |
const CRSE = 7; | |
const courseList = new Set([ | |
// Edit course list below | |
'CS 6035', | |
'CSE 6742' | |
// Edit course list above | |
]); | |
let row; | |
let courseName; | |
const tds = document.querySelectorAll('table.datadisplaytable > tbody > tr > td.dddefault:first-child'); | |
for (const td of tds){ | |
row = td.parentNode; | |
courseName = row.childNodes[SUBJ].textContent + ' ' + row.childNodes[CRSE].textContent; | |
if(!courseList.has(courseName)){ | |
row.style.display = 'none'; | |
} | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment