Update script.js
parent
26f4a0c664
commit
2b9ad226c6
20
script.js
20
script.js
|
@ -1,9 +1,11 @@
|
||||||
|
// Removed useless bits of code
|
||||||
|
|
||||||
(async function() {
|
(async function() {
|
||||||
const fetched = await fetch('https://loc.sh/int/directory');
|
const fetched = await fetch('https://loc.sh/int/directory');
|
||||||
//const fetched = await fetch('http://localhost:3890/int/directory');
|
//const fetched = await fetch('http://localhost:3890/int/directory');
|
||||||
const data = await fetched.json();
|
const data = await fetched.json();
|
||||||
const table = document.getElementById('directory');
|
const table = document.getElementById('directory');
|
||||||
const table2 = document.getElementById('roles');
|
//const table2 = document.getElementById('roles');
|
||||||
// users.sort((a, b) => a.firstname.localeCompare(b.firstname))
|
// users.sort((a, b) => a.firstname.localeCompare(b.firstname))
|
||||||
let completed = 0;
|
let completed = 0;
|
||||||
document.getElementById('loading').innerText += ` ${completed}/${data.length - 1}`
|
document.getElementById('loading').innerText += ` ${completed}/${data.length - 1}`
|
||||||
|
@ -17,15 +19,10 @@
|
||||||
// console.log(user);
|
// console.log(user);
|
||||||
if (!user.staff) continue;
|
if (!user.staff) continue;
|
||||||
const row = table.insertRow();
|
const row = table.insertRow();
|
||||||
const row2 = table2.insertRow();
|
//const row2 = table2.insertRow();
|
||||||
let name = `<strong>${user.username}</strong>`;
|
let name = `<strong>${user.username}</strong>`;
|
||||||
let pn = [];
|
let pn = [];
|
||||||
if (info.pn && info.pn.length > 0) {
|
|
||||||
for (const nominal of info.pn) {
|
|
||||||
pn.push(`<abbr title="${getAbbreviations().get(nominal)}">${nominal}</abbr>`)
|
|
||||||
}
|
|
||||||
name += `, ${pn.join(', ')}`;
|
|
||||||
}
|
|
||||||
row.insertCell().innerHTML = `<img src="${user.avatarURL}" alt="${user.username}" style="width:30px;height:30px;"> ${name}`;
|
row.insertCell().innerHTML = `<img src="${user.avatarURL}" alt="${user.username}" style="width:30px;height:30px;"> ${name}`;
|
||||||
// row.insertCell().innerText = `${info.userID} | #${user.discriminator}`;
|
// row.insertCell().innerText = `${info.userID} | #${user.discriminator}`;
|
||||||
let departmentAndTitle = '';
|
let departmentAndTitle = '';
|
||||||
|
@ -36,10 +33,8 @@
|
||||||
}
|
}
|
||||||
row.insertCell().innerText = departmentAndTitle;
|
row.insertCell().innerText = departmentAndTitle;
|
||||||
row.insertCell().innerHTML = info.emailAddress ? `<a href="mailto:${info.emailAddress}">${info.emailAddress}</a> ` : '';
|
row.insertCell().innerHTML = info.emailAddress ? `<a href="mailto:${info.emailAddress}">${info.emailAddress}</a> ` : '';
|
||||||
row.insertCell().innerText = user.pager ? user.pager : '';
|
|
||||||
row.insertCell().innerText = info.extension ? info.extension : '';
|
|
||||||
|
|
||||||
row2.insertCell().innerHTML = `${name}`;
|
// row2.insertCell().innerHTML = `${name}`;
|
||||||
let rankings = '<ul>';
|
let rankings = '<ul>';
|
||||||
if (info.additionalRoles && info.additionalRoles.length > 0) {
|
if (info.additionalRoles && info.additionalRoles.length > 0) {
|
||||||
for (const rank of info.additionalRoles) {
|
for (const rank of info.additionalRoles) {
|
||||||
|
@ -49,8 +44,9 @@
|
||||||
} else {
|
} else {
|
||||||
rankings = '';
|
rankings = '';
|
||||||
}
|
}
|
||||||
row2.insertCell().innerHTML = rankings;
|
// row2.insertCell().innerHTML = rankings;
|
||||||
}
|
}
|
||||||
document.getElementById('loading').style.display = "none";
|
document.getElementById('loading').style.display = "none";
|
||||||
document.getElementById('directory').style.display = "block";
|
document.getElementById('directory').style.display = "block";
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue