Skip to content

Commit

Permalink
add minerva prof data based on profs on page
Browse files Browse the repository at this point in the history
  • Loading branch information
demetrios-koziris committed Dec 17, 2016
1 parent 289cd41 commit b25d9a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/js/addProfLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The GNU General Public License can also be found at <http://www.gnu.org/licenses
function makeProfLinks() {
profs = {};
const profsByTerm = {};
const minervaProfs = getProfData();
let profsLength = 0;

let profsFullSource = document.getElementsByClassName("catalog-instructors")[0].innerHTML;
Expand Down Expand Up @@ -46,7 +47,7 @@ function makeProfLinks() {
newProfsHTML += "<p>Instructors (" + termKey + "): ";
for (let p=0; p<profsByTerm[termKey].length; p++) {

let profName = generateProfNameObject(profsByTerm[termKey][p]);
let profName = generateProfNameObject(minervaProfs, profsByTerm[termKey][p]);
const profCoursesURL = "https://www.mcgill.ca/study/" + urlYears + "/courses/search" + (isNewStyle ? "?search_api_views_fulltext=" : "/") + profName.fullName;
profs[profName.fullNameKey] = profName;
newProfsHTML += '<a href="' + profCoursesURL + '" class="tooltip ' + profName.fullNameKey + '" title="' + profHoverMessage + '">' + profName.fullName + '</a>';
Expand Down Expand Up @@ -93,15 +94,15 @@ function encodeSymbolsWin1252(string) {
}


function generateProfNameObject(origName) {
function generateProfNameObject(minervaProfs, origName) {
const name = origName.trim();
const splitName = name.split(' ');
const profName = {
fullName: name,
fullNameKey: name.replace(/\W/g, ''),
firstName: splitName[0],
lastName: splitName[splitName.length-1],

minerva: minervaProfs[name]
};
const forURL = {
fullName: profName.fullName.replace(/ /g, '&nbsp').replace(/-/g, '&#8209'),
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "McGill Enhanced",
"author": "Demetrios Koziris",
"manifest_version": 2,
"version": "3.0.12",
"version": "3.0.13",
"description": "Enhance the functionality of McGill.ca",
"permissions" : [
"declarativeContent",
Expand Down

0 comments on commit b25d9a6

Please sign in to comment.