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_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_3 { grid-template-columns: repeat(3, 1fr); }
|
||||||
.kf-trombi_trombi_4 { grid-template-columns: repeat(4, 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_7 { grid-template-columns: repeat(7, 1fr); }
|
||||||
.kf-trombi_trombi_8 { grid-template-columns: repeat(8, 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_card { align-content: end; }
|
||||||
|
|
||||||
.kf-trombi_enhanced { filter: contrast(150%) grayscale(100%); }
|
.kf-trombi_enhanced { filter: contrast(150%) grayscale(100%); }
|
||||||
|
|
||||||
|
.kf-button-container { margin: 5px; padding: 9px; }
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
.headerHeading, #idPageNavi {display: none;}
|
.headerHeading, #idPageNavi {display: none;}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
81
directory.js
81
directory.js
|
|
@ -7,23 +7,18 @@ const personalIDRegex = /.*pStPersonNr=([0-9]+).*/gm;
|
||||||
function appendLink(nonEmptyGroup) {
|
function appendLink(nonEmptyGroup) {
|
||||||
if ($G("kf-trombi_row")) return;
|
if ($G("kf-trombi_row")) return;
|
||||||
|
|
||||||
var row_header = $C("th");
|
const inputContainer = $C("span");
|
||||||
row_header.textContent = "Trombi";
|
|
||||||
row_header.classList.add("kf-trombi_row_header");
|
|
||||||
|
|
||||||
var row_links = $C("td");
|
|
||||||
|
|
||||||
if (nonEmptyGroup) {
|
if (nonEmptyGroup) {
|
||||||
|
|
||||||
var link = $C("a");
|
var link = $C("a");
|
||||||
link.id = "kf-trombi_link";
|
link.id = "kf-trombi_link";
|
||||||
link.textContent = "Show";
|
link.textContent = "Show trombi";
|
||||||
link.href="#";
|
link.href="#";
|
||||||
link.addEventListener("click", toggleTrombi);
|
link.addEventListener("click", toggleTrombi);
|
||||||
|
|
||||||
const inputContainer = $C("span");
|
|
||||||
inputContainer.id = "kf-trombi_input_container";
|
inputContainer.id = "kf-trombi_input_container";
|
||||||
inputContainer.classList.add("hidden");
|
inputContainer.classList.add("kf-hidden-important");
|
||||||
|
|
||||||
const sliderContainer = $C("span");
|
const sliderContainer = $C("span");
|
||||||
sliderContainer.id = "kf-trombi_slider_container";
|
sliderContainer.id = "kf-trombi_slider_container";
|
||||||
|
|
@ -64,18 +59,16 @@ function appendLink(nonEmptyGroup) {
|
||||||
trombi.classList.toggle('kf-trombi_enhanced');
|
trombi.classList.toggle('kf-trombi_enhanced');
|
||||||
})
|
})
|
||||||
inputContainer.append(sliderContainer, enhanced_checkbox, enhance_label);
|
inputContainer.append(sliderContainer, enhanced_checkbox, enhance_label);
|
||||||
row_links.append(link, inputContainer);
|
|
||||||
} else {
|
} else {
|
||||||
row_links.textContent = "empty group!"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var tr = $C("tr");
|
var tr = $C("div");
|
||||||
tr.classList.add("coNavGroup");
|
tr.classList.add("kf-button-container");
|
||||||
tr.append(row_header, row_links);
|
tr.append(link, inputContainer);
|
||||||
tr.id = "kf-trombi_row";
|
tr.id = "kf-trombi_row";
|
||||||
|
|
||||||
const nav = $G("idPageNavi");
|
const nav = $G("actions");
|
||||||
nav.tBodies[0].append(tr);
|
nav.append(tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractIDs(url) {
|
function extractIDs(url) {
|
||||||
|
|
@ -86,7 +79,7 @@ function extractIDs(url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateCard(student, col) {
|
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");
|
const d = $C("div");
|
||||||
d.classList.add("kf-trombi_card");
|
d.classList.add("kf-trombi_card");
|
||||||
|
|
@ -107,12 +100,12 @@ function toggleTrombi() {
|
||||||
const form = $G("idTNListe");
|
const form = $G("idTNListe");
|
||||||
const link = $G("kf-trombi_link");
|
const link = $G("kf-trombi_link");
|
||||||
const inputContainer = $G("kf-trombi_input_container");
|
const inputContainer = $G("kf-trombi_input_container");
|
||||||
trombi.classList.toggle("hidden");
|
trombi.classList.toggle("kf-hidden-important");
|
||||||
form.classList.toggle("hidden");
|
form.classList.toggle("kf-hidden-important");
|
||||||
if(inputContainer.classList.toggle("hidden")) {
|
if(inputContainer.classList.toggle("kf-hidden-important")) {
|
||||||
link.textContent = "Show";
|
link.textContent = "Show trombi";
|
||||||
} else {
|
} else {
|
||||||
link.textContent = "Hide";
|
link.textContent = "Hide trombi";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,7 +115,7 @@ function generateTrombi() {
|
||||||
const slider = $G("kf-trombi_columns_slider");
|
const slider = $G("kf-trombi_columns_slider");
|
||||||
trombi = $C("div");
|
trombi = $C("div");
|
||||||
trombi.id = "kf-trombi_trombi";
|
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_trombi_${slider.value}`);
|
||||||
trombi.classList.add("kf-trombi_enhanced");
|
trombi.classList.add("kf-trombi_enhanced");
|
||||||
const form = $G("idTNListe");
|
const form = $G("idTNListe");
|
||||||
|
|
@ -157,16 +150,40 @@ function generateTrombi() {
|
||||||
form.after(trombi);
|
form.after(trombi);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset
|
function injectButton() {
|
||||||
if ($G("kf-trombi_trombi")) {
|
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_trombi").remove();
|
||||||
$G("kf-trombi_row").remove();
|
$G("kf-trombi_row").remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
// only enable on non-empty groups
|
||||||
|
const nonEmptyGroup = (document.getElementsByClassName("cNoEntry").length == 0);
|
||||||
|
appendLink(nonEmptyGroup);
|
||||||
|
if (nonEmptyGroup) {
|
||||||
|
generateTrombi();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// only enable on non-empty groups
|
function setup() {
|
||||||
const nonEmptyGroup = (document.getElementsByClassName("cNoEntry").length == 0);
|
const observerOptions = {
|
||||||
appendLink(nonEmptyGroup);
|
childList: true,
|
||||||
if (nonEmptyGroup) {
|
subtree: true,
|
||||||
generateTrombi();
|
};
|
||||||
|
|
||||||
|
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": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
"matches": [
|
"matches": [
|
||||||
"https://online.uni-graz.at/kfu_online/pl/ui/$ctx*/wblvgrp.anmeldungen*"
|
"https://online.uni-graz.at/kfu_online/wblvgrp.anmeldungen*"
|
||||||
],
|
],
|
||||||
"js": [
|
"js": [
|
||||||
"directory.js"
|
"directory.js"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue