fix support for waiting list pages
This commit is contained in:
parent
37b7e05fb3
commit
a95dbeea79
1 changed files with 16 additions and 4 deletions
20
directory.js
20
directory.js
|
|
@ -127,14 +127,26 @@ function generateTrombi() {
|
||||||
trombi.classList.add("kf-trombi_enhanced");
|
trombi.classList.add("kf-trombi_enhanced");
|
||||||
const form = $G("idTNListe");
|
const form = $G("idTNListe");
|
||||||
|
|
||||||
const table_body = $G("idTNVWTable").tBodies[0];
|
const table = $G("idTNVWTable");
|
||||||
|
const table_head_first_row = table.tHead.rows[0];
|
||||||
|
const table_body = table.tBodies[0];
|
||||||
|
|
||||||
|
// check if the page is a waiting list (Warteliste)
|
||||||
|
// in which case columns are shifted because of the 'Pos'
|
||||||
|
// column.
|
||||||
|
|
||||||
|
const isWaitingList = (table_head_first_row.children[1].textContent.trim() == "Pos");
|
||||||
|
|
||||||
|
const lastnameOffset = 1 + isWaitingList;
|
||||||
|
const fistnameOffset = 2 + isWaitingList;
|
||||||
|
const studentFileLinkOffset = 1 - isWaitingList;
|
||||||
|
|
||||||
const student_list = [];
|
const student_list = [];
|
||||||
for (let row of table_body.children) {
|
for (let row of table_body.children) {
|
||||||
student_list.push({
|
student_list.push({
|
||||||
lastname: row.children[1].textContent,
|
lastname: row.children[lastnameOffset].textContent,
|
||||||
firstname: row.children[2].textContent,
|
firstname: row.children[fistnameOffset].textContent,
|
||||||
ids: extractIDs(row.children[1].children[1].href)
|
ids: extractIDs(row.children[lastnameOffset].children[studentFileLinkOffset].href)
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue