2023-03-30 18:06:41 +00:00

136 lines
4.5 KiB
JavaScript

(function module() {
const URL = "https://wiai.stuve-bamberg.de/vc-customization/"
const LOGO_URL = "img/logos/"
const quickLinks = [
/* {
name_german: "Virtuelle Karte",
name_english: "Virtual Map",
url_german: "https://wiai.stuve-bamberg.de/home",
url_english: "https://wiai.stuve-bamberg.de/home",
icon: "gamepad"
},*/
{
name_german: "Teams",
name_english: "Teams",
url_german: "https://teams.microsoft.com/l/team/19%3a1Kc6624X-s4TIqTV-Bv_joSmO6Bp9c_kreG9EHJKr2M1%40thread.tacv2/conversations?groupId=3d64ef9f-9243-4d6e-9fcc-8b838b2be31a&tenantId=4f18ddfc-c31f-4597-afda-fa5a760bf3cf",
url_english: "https://teams.microsoft.com/l/team/19%3a1Kc6624X-s4TIqTV-Bv_joSmO6Bp9c_kreG9EHJKr2M1%40thread.tacv2/conversations?groupId=3d64ef9f-9243-4d6e-9fcc-8b838b2be31a&tenantId=4f18ddfc-c31f-4597-afda-fa5a760bf3cf",
icon: "users"
},
{
name_german: "Zeitplan",
name_english: "Schedule",
url_german: "https://vc.uni-bamberg.de/course/view.php?id=45687#section-4",
url_english: "https://vc.uni-bamberg.de/course/view.php?id=45687#section-4",
icon: "calendar"
},
/* {
name_german: "Checkliste",
name_english: "Checklist",
url_german: "javascript:localStorage.removeItem('wiai-eet-howto-seen');window.location.reload()",
url_english: "javascript:localStorage.removeItem('wiai-eet-howto-seen');window.location.reload()",
icon: "list-ol"
},*/
{
name_german: "Hilfe & FAQ",
name_english: "Help & FAQ",
url_german: "https://vc.uni-bamberg.de/mod/page/view.php?id=1122808",
url_english: "https://vc.uni-bamberg.de/mod/page/view.php?id=1140084",
icon: "question-circle"
},
{
name_german: "Glossar",
name_english: "Glossary",
url_german: "https://vc.uni-bamberg.de/mod/glossary/view.php?id=1122803",
url_english: "https://vc.uni-bamberg.de/mod/glossary/view.php?id=1122803",
icon: "book"
}
]
window.addEventListener('load', init);
addStylesheetTags();
addScriptTags();
function init() {
addQuickLinks();
}
/**
* Add a link to all stylesheets.
*/
function addStylesheetTags() {
[
'eets-wiai.css',
// 'lib/fontawesome/css/fontawesome.min.css',
// 'lib/fontawesome/css/solid.min.css'
].forEach(function (link) {
let tag = document.createElement('link');
tag.rel = 'stylesheet';
tag.href = URL + link;
document.head.appendChild(tag);
});
}
/**
* Add a link to all scripts.
*/
function addScriptTags() {
[
'lib/fontawesome/attribution.js',
// 'howto.js'
].forEach(function (link) {
let tag = document.createElement('script');
tag.src = URL + link;
document.body.appendChild(tag);
});
}
/**
* Add quick link section.
*/
function addQuickLinks() {
const firstSection = document.querySelector('.course-content');
const quickLinkContainer = document.createElement('div');
quickLinkContainer.classList.add('wiai-quick-link-container');
firstSection.prepend(quickLinkContainer);
const bgColor = '#FFDC33', color = '#1A171B';
quickLinkContainer.style.setProperty('--bg-color', bgColor);
quickLinkContainer.style.setProperty('--color', color);
quickLinks.forEach(function(quickLink) {
const element = document.createElement('a');
element.href = quickLink.url_german
element.classList.add('wiai-quick-link');
element.classList.add('wiai-german');
if (quickLink.logo) {
element.style.setProperty('--bg-image', `url(${URL}${LOGO_URL}${quickLink.logo})`);
element.innerText = quickLink.name_german;
} else {
element.innerHTML = `<i class="fa fa-${quickLink.icon}"/>`
}
element.title = quickLink.name_german;
quickLinkContainer.appendChild(element);
const elementEnglish = document.createElement('a');
elementEnglish.href = quickLink.url_english
elementEnglish.classList.add('wiai-quick-link');
elementEnglish.classList.add('wiai-english');
if (quickLink.logo) {
elementEnglish.style.setProperty('--bg-image', `url(${URL}${LOGO_URL}${quickLink.logo})`);
elementEnglish.innerText = quickLink.name_english;
} else {
elementEnglish.innerHTML = `<i class="fa fa-${quickLink.icon}"/>`
}
elementEnglish.title = quickLink.name_english;
quickLinkContainer.appendChild(elementEnglish);
});
}
})();