merge, more refactoring

This commit is contained in:
Sriram Hariharan
2019-08-09 15:16:23 -05:00
parent a6236ba0d2
commit 2fbc45a3ec
2 changed files with 51 additions and 51 deletions

View File

@@ -132,6 +132,16 @@ function sepNameParts(name) {
return [name, department, number];
}
function updateLinks(course_info, first_name) {
let {
prof_name,
number
} = course_info;
course_info["first_name"] = first_name;
course_info["links"]["rate_my_prof"] = `http://www.ratemyprofessors.com/search.jsp?queryBy=teacherName&schoolName=university+of+texas+at+austin&queryoption=HEADER&query=${first_name} ${prof_name};&facetSearch=true`;
course_info["links"]["ecis"] = profname ? `http://utdirect.utexas.edu/ctl/ecis/results/index.WBX?&s_in_action_sw=S&s_in_search_type_sw=N&s_in_search_name=${prof_name}%2C%20${first_name}` :
`http://utdirect.utexas.edu/ctl/ecis/results/index.WBX?s_in_action_sw=S&s_in_search_type_sw=C&s_in_max_nbr_return=10&s_in_search_course_dept=${department}&s_in_search_course_num=${number}`;
}
function buildCourseLinks(course_info) {
@@ -177,25 +187,6 @@ function buildBasicCourseInfo(row, course_name, individual) {
return buildCourseLinks(course_info);
}
function buildTimeTitle(course_info) {
$("h2.dateTimePlace").remove();
let {
days,
times,
places
} = course_info["time_data"]
datetimearr = [];
var lines = [];
for (var i = 0; i < days.length; i++) {
var date = days[i];
var time = times[i];
var place = places[i];
lines.push($(`<h2 class="dateTimePlace">${makeLine(date, time, place)}</th>`));
}
return lines;
}
/*For a row, get all the course information and add the date-time-lines*/
function getCourseInfo(row) {
let course_name = "";
@@ -401,11 +392,28 @@ function getDistribution(course_data, sem) {
});
}
function buildTitle(course_data) {
return `${course_data["name"]} (${course_data["department"]} ${course_data["number"]})`
}
function buildTimeTitle(course_info) {
$("h2.dateTimePlace").remove();
let {
days,
times,
places
} = course_info["time_data"]
datetimearr = [];
var lines = [];
for (var i = 0; i < days.length; i++) {
var date = days[i];
var time = times[i];
var place = places[i];
lines.push($(`<h2 class="dateTimePlace">${makeLine(date, time, place)}</th>`));
}
return lines;
}
function buildProfTitle(course_data) {
const {
initial,
@@ -461,22 +469,7 @@ function openDialog(course_info, res) {
}
function allowClosing() {
$('.close').click(function () {
close();
});
$('#myModal').click(function (event) {
if (event.target.id == 'myModal') {
close();
}
});
}
function close() {
$("#myModal").fadeOut(fadetime);
$("#snackbar").attr("class", "");
}
function setChart(data) {
// set up the chart
@@ -518,6 +511,15 @@ function buildFormattedDescription(description_lines) {
}
function extractFirstName(response_node) {
let full_name = response_node.find('td[data-th="Instructor"]').text().split(', ');
let first = full_name[full_name.length - 1];
first = first.indexOf(' ') > 0 ? first.split(' ')[0] : first;
return capitalizeString(first);
}
function displayDescription(description) {
$("#description").animate({
'opacity': 0
@@ -548,21 +550,19 @@ function getDescription(course_info) {
});
}
function allowClosing() {
$('.close').click(function () {
close();
});
$('#myModal').click(function (event) {
if (event.target.id == 'myModal') {
close();
}
});
function updateLinks(course_info, first_name) {
let {
prof_name,
number
} = course_info;
course_info["first_name"] = first_name;
course_info["links"]["rate_my_prof"] = `http://www.ratemyprofessors.com/search.jsp?queryBy=teacherName&schoolName=university+of+texas+at+austin&queryoption=HEADER&query=${first_name} ${prof_name};&facetSearch=true`;
course_info["links"]["ecis"] = profname ? `http://utdirect.utexas.edu/ctl/ecis/results/index.WBX?&s_in_action_sw=S&s_in_search_type_sw=N&s_in_search_name=${prof_name}%2C%20${first_name}` :
`http://utdirect.utexas.edu/ctl/ecis/results/index.WBX?s_in_action_sw=S&s_in_search_type_sw=C&s_in_max_nbr_return=10&s_in_search_course_dept=${department}&s_in_search_course_num=${number}`;
}
function extractFirstName(response_node) {
let full_name = response_node.find('td[data-th="Instructor"]').text().split(', ');
let first = full_name[full_name.length - 1];
first = first.indexOf(' ') > 0 ? first.split(' ')[0] : first;
return capitalizeString(first);
function close() {
$("#myModal").fadeOut(fadetime);
$("#snackbar").attr("class", "");
}

View File

@@ -17,12 +17,12 @@
"content_scripts": [{
"css": ["css/styles.css"],
"js": ["js/lib/moment.min.js", "js/lib/highcharts.js", "js/lib/jquery-3.3.1.min.js", "js/lib/jquery.initialize.min.js", "js/config.js", "js/util.js",
"js/qol.js", "js/courseCatalog.js"
"js/qol.js", "js/templates.js", "js/courseCatalog.js"
],
"matches": ["https://utdirect.utexas.edu/apps/registrar/course_schedule/*"]
}, {
"css": ["css/styles.css"],
"js": ["js/lib/moment.min.js", "js/lib/highcharts.js", "js/lib/jquery-3.3.1.min.js", "js/lib/jquery.initialize.min.js", "js/config.js", "js/util.js", "js/templates.js", "js/utPlanner.js"],
"js": ["js/lib/moment.min.js", "js/lib/highcharts.js", "js/lib/jquery-3.3.1.min.js", "js/lib/jquery.initialize.min.js", "js/config.js", "js/util.js", "js/utPlanner.js"],
"matches": ["https://utexas.collegescheduler.com/*"]
}, {
"css": ["css/styles.css"],