jquery and updating ui

This commit is contained in:
10001shh
2018-07-02 22:28:33 -05:00
parent ffbcbbc04f
commit 330bdc89b0
3 changed files with 30 additions and 23 deletions

View File

@@ -1,18 +1,25 @@
var elements = document.getElementsByClassName('rwd-table results');
var table = elements[0];
var header = table.tHead.children[0];
$(document).ready( function() {
$("table thead th:nth-child(5)").after('<th scope=col>Rating</th>');
$('table').find('tr').each(function(){
var rating;
var profname = $(this).find('td').eq(4).text();
var profurl = $(this).find('td a').prop('href');
if(profname == ""){
//console.log("No Professor");
rating = "No Prof :(";
} else {
console.log(profurl);
//getProfessorFullName(profurl);
console.log(profname);
rating = "Hello";
}
$(this).find('td').eq(4).after('<td data-th="Rating"><a href="http://example.com">'+rating+'</a></td>');
});
});
var th = document.createElement('th');
th.innerHTML = "Rating";
header.insertBefore(th,header.children[5]);
var tableBody = table.getElementsByTagName('tbody')[0];
tr = tableBody.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
if(!(tr[i].children.length == 1)){
var td = document.createElement('td');
var newContent = document.createTextNode(Math.random());
td.appendChild(newContent);
tr[i].insertBefore(td,tr[i].children[5]);
}
}
function getProfessorFullName(profurl){
}
//http://www.ratemyprofessors.com/search.jsp?queryBy=teacherName&schoolName=university of texas at austin&query="+url+"&facetSearch=true"

2
jquery-3.3.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -4,14 +4,12 @@
"name": "UT Course Extension",
"version": "0.1.0",
"description": "Chrome Extension to show more information on the UT Course catalog",
"permissions": [
"*://*.ratemyprofessors.com/*"
],
"content_scripts": [{
"css": ["styles.css"],
"js": ["content.js"],
"js": ["jquery-3.3.1.min.js","content.js"],
"matches": ["https://utdirect.utexas.edu/apps/registrar/course_schedule/*"]
}],
"background": {
"scripts": ["content.js"],
"persistent": false
}
}]
}