Skip to content
Snippets Groups Projects
Commit 8692810d authored by Jonas Zohren's avatar Jonas Zohren :speech_balloon:
Browse files

Make it work with the newest Assess version

parent bd94b4ba
Branches
No related tags found
No related merge requests found
......@@ -71,12 +71,25 @@ function timeSlotDiff(s, e) {
function run()
{
const prioTable = document.getElementsByTagName('table')[0];
const prioTableBody = prioTable.getElementsByTagName('tbody')[0];
if (!prioTableBody.innerText.includes("# Plätze")) {
// no parsable table
return;
}
const flexWrapper = document.createElement("div");
flexWrapper.style = "display: flex; flex-wrap: wrap;";
prioTable.parentElement.insertBefore(flexWrapper, prioTable)
flexWrapper.appendChild(prioTable);
prioTable.insertAdjacentHTML('afterend', timetable);
const trs = prioTable.getElementsByTagName('tr');
const tableRows = prioTableBody.getElementsByTagName('tr');
const timeslots = []
for (let i = 1; i+1 < trs.length; i++) {
let row = trs[i].getElementsByTagName('td');
for (let i = 1; i+1 < tableRows.length; i++) {
let row = tableRows[i].getElementsByTagName('td');
// get time info
let timeStr = row[0].textContent;
......@@ -84,18 +97,22 @@ function run()
const endNum = parseInt(timeStr.substr(14,2)+ timeStr.substr(17,2))
const slotLen = timeSlotDiff(startNum, endNum)
const slotStartId = timeStr.substr(1,2).toLowerCase()+'_'+ startNum
const isFull = tableRows[i].innerText.includes("VOLL")
// get prio info
const rankElem = row[row.length-1].getElementsByTagName('div')[0].getElementsByTagName('div')[2]
const rankText = row[row.length-1]?.getElementsByTagName('div')?.[0]?.getElementsByTagName('div')?.[2]?.textContent ?? ""
try {
// enter into timetable
const slotElem = document.getElementById(slotStartId)
slotElem.setAttribute("rowspan", slotLen)
slotElem.innerHTML = rankElem.textContent + '<br>' + row[row.length-3].textContent
slotElem.innerHTML = rankText + '<br>' + row[row.length-3].textContent
if (isFull) {
slotElem.setAttribute("style","background-color: #FFCCCC;")
} else {
slotElem.setAttribute("style","background-color: #726a6a;")
}
console.log(slotStartId + ' -> '+slotLen)
} catch (e) {console.error(e)}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment