Merge branch 'modern'
This commit is contained in:
commit
e7e46c78a3
3 changed files with 57 additions and 36 deletions
|
|
@ -5,9 +5,11 @@
|
|||
|
||||
#kf-trombi_trombi { display: grid; grid-row-gap: 2em; font-size: 1.2em; text-align: center; }
|
||||
|
||||
#kf-trombi_link { line-height: 1.5em; }
|
||||
#kf-trombi_link { line-height: 1.5em; display: flex; margin-right: 0.5em; }
|
||||
|
||||
.kf-trombi_row_header { vertical-align: top; }
|
||||
#kf-trombi_input_container { display: flex; }
|
||||
|
||||
#kf-trombi_row { display: flex; }
|
||||
|
||||
.kf-trombi_trombi_3 { grid-template-columns: repeat(3, 1fr); }
|
||||
.kf-trombi_trombi_4 { grid-template-columns: repeat(4, 1fr); }
|
||||
|
|
@ -16,12 +18,14 @@
|
|||
.kf-trombi_trombi_7 { grid-template-columns: repeat(7, 1fr); }
|
||||
.kf-trombi_trombi_8 { grid-template-columns: repeat(8, 1fr); }
|
||||
|
||||
.hidden { display: none; }
|
||||
.kf-hidden-important { display: none!important; }
|
||||
|
||||
.kf-trombi_card { align-content: end; }
|
||||
|
||||
.kf-trombi_enhanced { filter: contrast(150%) grayscale(100%); }
|
||||
|
||||
.kf-button-container { margin: 5px; padding: 9px; }
|
||||
|
||||
@media print {
|
||||
.headerHeading, #idPageNavi {display: none;}
|
||||
}
|
||||
|
|
|
|||
65
directory.js
65
directory.js
|
|
@ -7,23 +7,18 @@ const personalIDRegex = /.*pStPersonNr=([0-9]+).*/gm;
|
|||
function appendLink(nonEmptyGroup) {
|
||||
if ($G("kf-trombi_row")) return;
|
||||
|
||||
var row_header = $C("th");
|
||||
row_header.textContent = "Trombi";
|
||||
row_header.classList.add("kf-trombi_row_header");
|
||||
|
||||
var row_links = $C("td");
|
||||
const inputContainer = $C("span");
|
||||
|
||||
if (nonEmptyGroup) {
|
||||
|
||||
var link = $C("a");
|
||||
link.id = "kf-trombi_link";
|
||||
link.textContent = "Show";
|
||||
link.textContent = "Show trombi";
|
||||
link.href="#";
|
||||
link.addEventListener("click", toggleTrombi);
|
||||
|
||||
const inputContainer = $C("span");
|
||||
inputContainer.id = "kf-trombi_input_container";
|
||||
inputContainer.classList.add("hidden");
|
||||
inputContainer.classList.add("kf-hidden-important");
|
||||
|
||||
const sliderContainer = $C("span");
|
||||
sliderContainer.id = "kf-trombi_slider_container";
|
||||
|
|
@ -64,18 +59,16 @@ function appendLink(nonEmptyGroup) {
|
|||
trombi.classList.toggle('kf-trombi_enhanced');
|
||||
})
|
||||
inputContainer.append(sliderContainer, enhanced_checkbox, enhance_label);
|
||||
row_links.append(link, inputContainer);
|
||||
} else {
|
||||
row_links.textContent = "empty group!"
|
||||
}
|
||||
|
||||
var tr = $C("tr");
|
||||
tr.classList.add("coNavGroup");
|
||||
tr.append(row_header, row_links);
|
||||
var tr = $C("div");
|
||||
tr.classList.add("kf-button-container");
|
||||
tr.append(link, inputContainer);
|
||||
tr.id = "kf-trombi_row";
|
||||
|
||||
const nav = $G("idPageNavi");
|
||||
nav.tBodies[0].append(tr);
|
||||
const nav = $G("actions");
|
||||
nav.append(tr);
|
||||
}
|
||||
|
||||
function extractIDs(url) {
|
||||
|
|
@ -86,7 +79,7 @@ function extractIDs(url) {
|
|||
}
|
||||
|
||||
function generateCard(student, col) {
|
||||
const url = `/kfu_online/pl/ui/$ctx/wbstudkart.wbShowImage?pOrgNr=${student.ids.org}&pStPersonNr=${student.ids.perso}&pType=U`
|
||||
const url = `/kfu_online/wbstudkart.wbShowImage?pOrgNr=${student.ids.org}&pStPersonNr=${student.ids.perso}&pType=U`
|
||||
|
||||
const d = $C("div");
|
||||
d.classList.add("kf-trombi_card");
|
||||
|
|
@ -107,12 +100,12 @@ function toggleTrombi() {
|
|||
const form = $G("idTNListe");
|
||||
const link = $G("kf-trombi_link");
|
||||
const inputContainer = $G("kf-trombi_input_container");
|
||||
trombi.classList.toggle("hidden");
|
||||
form.classList.toggle("hidden");
|
||||
if(inputContainer.classList.toggle("hidden")) {
|
||||
link.textContent = "Show";
|
||||
trombi.classList.toggle("kf-hidden-important");
|
||||
form.classList.toggle("kf-hidden-important");
|
||||
if(inputContainer.classList.toggle("kf-hidden-important")) {
|
||||
link.textContent = "Show trombi";
|
||||
} else {
|
||||
link.textContent = "Hide";
|
||||
link.textContent = "Hide trombi";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +115,7 @@ function generateTrombi() {
|
|||
const slider = $G("kf-trombi_columns_slider");
|
||||
trombi = $C("div");
|
||||
trombi.id = "kf-trombi_trombi";
|
||||
trombi.classList.add("hidden");
|
||||
trombi.classList.add("kf-hidden-important");
|
||||
trombi.classList.add(`kf-trombi_trombi_${slider.value}`);
|
||||
trombi.classList.add("kf-trombi_enhanced");
|
||||
const form = $G("idTNListe");
|
||||
|
|
@ -157,9 +150,9 @@ function generateTrombi() {
|
|||
form.after(trombi);
|
||||
}
|
||||
|
||||
// reset
|
||||
function injectButton() {
|
||||
if ($G("kf-trombi_trombi")) {
|
||||
$G("idTNListe").classList.remove("hidden");
|
||||
$G("idTNListe").classList.remove("kf-hidden-important");
|
||||
$G("kf-trombi_trombi").remove();
|
||||
$G("kf-trombi_row").remove();
|
||||
}
|
||||
|
|
@ -170,3 +163,27 @@ appendLink(nonEmptyGroup);
|
|||
if (nonEmptyGroup) {
|
||||
generateTrombi();
|
||||
}
|
||||
}
|
||||
|
||||
function setup() {
|
||||
const observerOptions = {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
};
|
||||
|
||||
const observer = new MutationObserver(logChanges)
|
||||
observer.observe(document.body, observerOptions);
|
||||
}
|
||||
|
||||
function logChanges(records, observer) {
|
||||
for (const record of records) {
|
||||
for (const addedNode of record.addedNodes) {
|
||||
if (addedNode.id == "actions") {
|
||||
observer.disconnect();
|
||||
injectButton();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setup();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
"content_scripts": [
|
||||
{
|
||||
"matches": [
|
||||
"https://online.uni-graz.at/kfu_online/pl/ui/$ctx*/wblvgrp.anmeldungen*"
|
||||
"https://online.uni-graz.at/kfu_online/wblvgrp.anmeldungen*"
|
||||
],
|
||||
"js": [
|
||||
"directory.js"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue