changes or whatever

master
Matthew 2021-07-06 14:19:07 -04:00
parent 57096602e6
commit a5a732e8fd
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
3 changed files with 214 additions and 200 deletions

30
getabb.js Normal file
View File

@ -0,0 +1,30 @@
function getAbbreviations() {
const map = new Map();
map.set('FSEN', 'Fellow of Engineering & Software Development [Board Certified]');
map.set('FSM', 'Fellow of Moderation [Board Certified]');
map.set('FSCE', 'Fellow of Community Engagement [Board Certified]');
map.set('FSCR', 'Fellow of Community Relations & Member Support [Board Certified]');
map.set('FSO', 'Fellow of Operations [Board Certified]');
map.set('ENP', 'Engineering Practitioner [Board Certified]');
map.set('MDP', 'Moderation Practitioner [Board Certified]');
map.set('CEP', 'Community Engagement Practitioner [Board Certified]')
map.set('CRP', 'Community Relations & Member Support Practitioner [Board Certified]');
map.set('OAP', 'Operations Practitioner [Board Certified]');
map.set('CE-I', 'Community Relations Intern');
map.set('ENG-I', 'Engineering Intern');
map.set('MOD-I', 'Moderation Intern');
map.set('CRS-I', 'Community Relations & Member Support Intern');
map.set('OA-I', 'Operations Intern');
map.set('AD', 'Administrator');
map.set('SP', 'Supervisor');
map.set('ST', 'Staff Team/Core Team [Board Certified]');
map.set('AS-BC', 'Associate - Board Certified');
map.set('AS', 'Associate - Intern')
return map;
}
function visible() {
document.getElementById('roles').style.display = "table";
}
function invisible() {
document.getElementById('roles').style.display = "none";
}

View File

@ -15,33 +15,7 @@
<meta property="og:type" content="website"> <meta property="og:type" content="website">
<meta property="og:description" content="Staff Directory for Library of Code sp-us and list of titles and explanations."> <meta property="og:description" content="Staff Directory for Library of Code sp-us and list of titles and explanations.">
<script> <script src="getabb.js"></script>
function getAbbreviations() {
const map = new Map();
map.set('FSEN', 'Fellow of Engineering & Software Development [Board Certified]');
map.set('FSM', 'Fellow of Moderation [Board Certified]');
map.set('FSCE', 'Fellow of Community Engagement [Board Certified]');
map.set('FSCR', 'Fellow of Community Relations & Member Support [Board Certified]');
map.set('FSO', 'Fellow of Operations [Board Certified]');
map.set('CE-I', 'Community Relations Intern');
map.set('ENG-I', 'Engineering Intern');
map.set('MOD-I', 'Moderation Intern');
map.set('CRS-I', 'Community Relations & Member Support Intern');
map.set('OA-I', 'Operations Intern');
map.set('AD', 'Administrator');
map.set('SP', 'Supervisor');
map.set('ST', 'Staff Team/Core Team [Board Certified]');
map.set('AS-BC', 'Associate - Board Certified');
map.set('AS', 'Associate - Intern')
return map;
}
function visible() {
document.getElementById('roles').style.display = "table";
}
function invisible() {
document.getElementById('roles').style.display = "none";
}
</script>
</head> </head>
<body> <body>
<div class="container-fluid"> <div class="container-fluid">
@ -57,6 +31,7 @@
<th scope="col"><strong>Email</strong></th> <th scope="col"><strong>Email</strong></th>
<th scope="col"><strong>Pager Number</strong></th> <th scope="col"><strong>Pager Number</strong></th>
<th scope="col"><strong>Extension</strong></th> <th scope="col"><strong>Extension</strong></th>
<th scope="col"><strong>Keys</strong></th>
</tr> </tr>
</thead> </thead>
<tbody></tbody> <tbody></tbody>
@ -80,88 +55,41 @@
<div id="loading" class="alert alert-info" role="alert" style="display: block;"> <div id="loading" class="alert alert-info" role="alert" style="display: block;">
Loading... | Loading... |
</div> </div>
<script> <script src="script.js"></script>
(async function() {
const fetched = await fetch('https://loc.sh/int/directory');
//const fetched = await fetch('http://localhost:3890/int/directory');
const data = await fetched.json();
const table = document.getElementById('directory');
const table2 = document.getElementById('roles');
// users.sort((a, b) => a.firstname.localeCompare(b.firstname))
let completed = 0;
document.getElementById('loading').innerText += ` ${completed}/${data.length - 1}`
for (const info of data.sort((a, b) => a.name.localeCompare(b.name))) {
completed++;
document.getElementById('loading').innerText = `Loading... | ${completed}/${data.length}`;
// console.log(info);
const fetched2 = await fetch(`https://loc.sh/int/directory?id=${info.userID}`);
//const fetched2 = await fetch(`http://localhost:3890/int/directory?id=${info.userID}`);
const user = await fetched2.json();
// console.log(user);
if (!user.staff) continue;
const row = table.insertRow();
const row2 = table2.insertRow();
let name = `<strong>${user.username}</strong>`;
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().innerText = `${info.userID} | #${user.discriminator}`;
let departmentAndTitle = '';
if (info.title && info.dept) {
departmentAndTitle += `${info.title}, ${info.dept}`;
} else if (info.dept) {
departmentAndTitle += info.dept;
}
row.insertCell().innerText = departmentAndTitle;
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}`;
let rankings = '<ul>';
if (info.additionalRoles && info.additionalRoles.length > 0) {
for (const rank of info.additionalRoles) {
rankings += `<li>${rank}</li>`
}
rankings += '</ul>';
} else {
rankings = '';
}
row2.insertCell().innerHTML = rankings;
}
document.getElementById('loading').style.display = "none";
document.getElementById('directory').style.display = "block";
})();
</script>
<h2>Speciality Titles</h2> <h2>Speciality Titles</h2>
<p><i>Below are a list of specialty titles. Board Certification is awarded to those who complete internship in a specialty.</i></p> <p><i>Below are a list of specialty titles. Board Certification is awarded to those who complete internship in a specialty.</i></p>
<dl style="padding: 8px; display: block; border: 1px solid black;"> <dl style="padding: 8px; display: block; border: 1px solid black;">
<dt>FSCE</dt> <dt>FSCE</dt>
<dd>Fellow of Community Engagement - Community Engagement/Events | Board Certified</dd> <dd>Fellow of Community Engagement - Community Engagement/Events | Board Certified</dd>
<dt>CEP</dt>
<dd>Community Engagement Practitioner - Community Engagement/Events | Board Certified</dd>
<dt>CE-I</dt> <dt>CE-I</dt>
<dd>Community Engagement/Events | Intern</dd><br> <dd>Community Engagement/Events | Intern</dd><br>
<dt>FSEN</dt> <dt>FSEN</dt>
<dd>Fellow of Engineering - Engineering & Software Development | Board Certified</dd> <dd>Fellow of Engineering - Engineering & Software Development | Board Certified</dd>
<dt>ENP</dt>
<dd>Engineering Practitioner - Engineering & Software Development | Board Certified</dd>
<dt>ENG-I</dt> <dt>ENG-I</dt>
<dd>Engineering & Software Development | Intern</dd><br> <dd>Engineering & Software Development | Intern</dd><br>
<dt>FSM</dt> <dt>FSM</dt>
<dd>Fellow of Moderation - Moderation | Board Certified</dd> <dd>Fellow of Moderation - Moderation | Board Certified</dd>
<dt>MDP</dt>
<dd>Moderation Practitioner - Moderation | Board Certified</dd>
<dt>MOD-I</dt> <dt>MOD-I</dt>
<dd>Moderation | Intern</dd><br> <dd>Moderation | Intern</dd><br>
<dt>FSO</dt> <dt>FSO</dt>
<dd>Fellow of Operations - Operations & Administration | Board Certified</dd> <dd>Fellow of Operations - Operations & Administration | Board Certified</dd>
<dt>OAP</dt>
<dd>Operations Practitioner - Operations & Administration | Board Certified</dd>
<dt>OA-I</dt> <dt>OA-I</dt>
<dd>Operations & Administration | Intern</dd><br> <dd>Operations & Administration | Intern</dd><br>
<dt>FSCR</dt> <dt>FSCR</dt>
<dd>Fellow of Community Relations - Community Relations & User Support | Board Certified</dd> <dd>Fellow of Community Relations - Community Relations & Member Support | Board Certified</dd>
<dt>CRP</dt>
<dd>Community Relations Practitioner - Community Relations & Member Support | Board Certified</dd>
<dt>CRS-I</dt> <dt>CRS-I</dt>
<dd>Community Relations & User Support | Intern</dd><br> <dd>Community Relations & Member Support | Intern</dd><br>
</dl> </dl>
<h4>Positional Titles</h4> <h4>Positional Titles</h4>

56
script.js Normal file
View File

@ -0,0 +1,56 @@
(async function() {
const fetched = await fetch('https://loc.sh/int/directory');
//const fetched = await fetch('http://localhost:3890/int/directory');
const data = await fetched.json();
const table = document.getElementById('directory');
const table2 = document.getElementById('roles');
// users.sort((a, b) => a.firstname.localeCompare(b.firstname))
let completed = 0;
document.getElementById('loading').innerText += ` ${completed}/${data.length - 1}`
for (const info of data.sort((a, b) => a.name.localeCompare(b.name))) {
completed++;
document.getElementById('loading').innerText = `Loading... | ${completed}/${data.length}`;
// console.log(info);
const fetched2 = await fetch(`https://loc.sh/int/directory?id=${info.userID}`);
//const fetched2 = await fetch(`http://localhost:3890/int/directory?id=${info.userID}`);
const user = await fetched2.json();
// console.log(user);
if (!user.staff) continue;
const row = table.insertRow();
const row2 = table2.insertRow();
let name = `<strong>${user.username}</strong>`;
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().innerText = `${info.userID} | #${user.discriminator}`;
let departmentAndTitle = '';
if (info.title && info.dept) {
departmentAndTitle += `${info.title}, ${info.dept}`;
} else if (info.dept) {
departmentAndTitle += info.dept;
}
row.insertCell().innerText = departmentAndTitle;
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}`;
let rankings = '<ul>';
if (info.additionalRoles && info.additionalRoles.length > 0) {
for (const rank of info.additionalRoles) {
rankings += `<li>${rank}</li>`
}
rankings += '</ul>';
} else {
rankings = '';
}
row2.insertCell().innerHTML = rankings;
}
document.getElementById('loading').style.display = "none";
document.getElementById('directory').style.display = "block";
})();