Skip to content

Commit

Permalink
remove now redundant sidebar section for related courses by departmen…
Browse files Browse the repository at this point in the history
…t or by prof
  • Loading branch information
demetrios-koziris committed Dec 17, 2016
1 parent bf7a5e7 commit 195700e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 42 deletions.
43 changes: 2 additions & 41 deletions src/js/addSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,46 +184,7 @@ function makeSidebarContent() {
}



//SIDEBAR RELATED COURSES AND RELATED PROGRAMS BLOCKS

const sidebarRelatedBlock = generateSidebarBlock("Related Courses");
sidebar.appendChild(sidebarRelatedBlock);

if (deps.length > 0) {

const deptCourses = generateRelatedCoursesSection("View Related Courses by Subject");
sidebarRelatedBlock.appendChild(deptCourses);

for (let d = 0; d<deps.length; d++)
{
const deptCoursesURL = "https://www.mcgill.ca/study/" + urlYears + "/courses/search?" + (isNewStyle ? "f[0]=field_subject_code%3A" : "filters=ss_subject%3A") + deps[d];
const deptCoursesLinkDiv = document.createElement('div');
deptCoursesLinkDiv.className = (d === deps.length-1 ? "views-row views-row-last" : "views-row");
deptCoursesLinkDiv.appendChild(generateRelatedCoursesLink(deptCoursesURL, deps[d]+" Courses"));
deptCourses.appendChild(deptCoursesLinkDiv);
}
}

const profKeys = Object.keys(profs);
if (profKeys.length > 0) {

const profCourses = generateRelatedCoursesSection("View Related Courses by Professor");
sidebarRelatedBlock.appendChild(profCourses);

for (let p = 0; p < profKeys.length; p++) {
const profFullName = profs[profKeys[p]].fullName;
const profURLName = profFullName.replace(/\&nbsp/g, " ").replace(/\&\#8209/g, "-");

const profCoursesURL = "https://www.mcgill.ca/study/" + urlYears + "/courses/search" + (isNewStyle ? "?search_api_views_fulltext=" : "/") + profURLName;
const profCoursesLinkDiv = document.createElement('div');
profCoursesLinkDiv.className = (p === profKeys.length-1 ? "views-row views-row-last" : "views-row");
profCoursesLinkDiv.appendChild(generateRelatedCoursesLink(profCoursesURL, profFullName));
profCourses.appendChild(profCoursesLinkDiv);
}
}


// related programs section
if (document.getElementsByClassName("view-catalog-program").length > 0) {

const sidebarRelatedBlock = generateSidebarBlock("Related Programs");
Expand All @@ -234,7 +195,7 @@ function makeSidebarContent() {
sidebarRelatedBlock.appendChild(relatedPrograms);
}

//insert enhanced sidebar
// insert enhanced sidebar
const container = document.getElementById(isNewStyle ? "inner-container" : "container");
if (document.getElementById(isNewStyle ? "sidebar-column" : "right-sidebar")) {
document.createElement("div").appendChild(document.getElementById(isNewStyle ? "sidebar-column" : "right-sidebar"));
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.9",
"version": "3.0.10",
"description": "Enhance the functionality of McGill.ca",
"permissions" : [
"declarativeContent",
Expand Down

0 comments on commit 195700e

Please sign in to comment.