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'); $(document).ready( function() {
var table = elements[0]; $("table thead th:nth-child(5)").after('<th scope=col>Rating</th>');
var header = table.tHead.children[0]; $('table').find('tr').each(function(){
var rating;
var th = document.createElement('th'); var profname = $(this).find('td').eq(4).text();
th.innerHTML = "Rating"; var profurl = $(this).find('td a').prop('href');
header.insertBefore(th,header.children[5]); if(profname == ""){
//console.log("No Professor");
var tableBody = table.getElementsByTagName('tbody')[0]; rating = "No Prof :(";
tr = tableBody.getElementsByTagName("tr"); } else {
for (i = 0; i < tr.length; i++) { console.log(profurl);
if(!(tr[i].children.length == 1)){ //getProfessorFullName(profurl);
var td = document.createElement('td'); console.log(profname);
var newContent = document.createTextNode(Math.random()); rating = "Hello";
td.appendChild(newContent);
tr[i].insertBefore(td,tr[i].children[5]);
} }
$(this).find('td').eq(4).after('<td data-th="Rating"><a href="http://example.com">'+rating+'</a></td>');
});
});
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", "name": "UT Course Extension",
"version": "0.1.0", "version": "0.1.0",
"description": "Chrome Extension to show more information on the UT Course catalog", "description": "Chrome Extension to show more information on the UT Course catalog",
"permissions": [
"*://*.ratemyprofessors.com/*"
],
"content_scripts": [{ "content_scripts": [{
"css": ["styles.css"], "css": ["styles.css"],
"js": ["content.js"], "js": ["jquery-3.3.1.min.js","content.js"],
"matches": ["https://utdirect.utexas.edu/apps/registrar/course_schedule/*"] "matches": ["https://utdirect.utexas.edu/apps/registrar/course_schedule/*"]
}], }]
"background": {
"scripts": ["content.js"],
"persistent": false
}
} }