jquery and updating ui
This commit is contained in:
39
content.js
39
content.js
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user