This commit is contained in:
Gaspard Jankowiak 2026-10-28 12:26:31 +01:00
commit 3daa151896
7 changed files with 212 additions and 0 deletions

8
Makefile Normal file
View file

@ -0,0 +1,8 @@
VERSION = $(shell sed -n '/"version"/s/.*\"\([0-9.]\+\)\",/\1/p' manifest.json)
SET_VERSION = $(eval CURRENT_VERSION=$(VERSION))
default: v2
v2:
$(SET_VERSION)
zip -r releases/kf-better-ugo-$(CURRENT_VERSION).xpi content.css content.js icons manifest.json common.js

39
common.js Normal file
View file

@ -0,0 +1,39 @@
const Common = {};
const HTTPP = document.location.protocol + "//" + document.location.host;
var currentGroupName = "";
// helpers
const $C = (e, opts = {}) => {
const elem = document.createElement(e);
for (const key in opts) {
if (key == "classList") {
const cl = opts[key];
if (typeof (cl) == "string") {
elem.classList.add(cl);
} else {
elem.classList.add(...cl);
}
continue;
} else if (key == "children") {
elem.append(...opts[key]);
continue;
} else if (key == "title") {
elem.setAttribute(key, opts[key]);
continue;
}
elem[key] = opts[key];
}
return elem;
}
const $G = (e) => document.getElementById(e);
const $S = (s) => document.querySelector(s);
Common.$G = $G;
Common.$C = $C;
Common.initializeModal = initializeModal;
// vim: ts=2 sts=2 sw=2

4
content.css Normal file
View file

@ -0,0 +1,4 @@
.kf-groups-quick-link {
margin-left: 0.2em;
font-size: 1.3em;
}

45
content.js Normal file
View file

@ -0,0 +1,45 @@
const UGOpp = {};
const __kf_course_id_regex = /[0-9]+$/;
function _injectQuickLinks() {
const table = Common.$G("idLVOfferTab")
if (table?.querySelector(".kf-groups-quick-link")) return;
const rows = table.querySelectorAll("tr.hi");
rows.forEach((row) => {
const tds = row.querySelectorAll("td")
const mainLink = tds[3].querySelector("a");
const courseId = mainLink.href.match(__kf_course_id_regex)[0];
const link = Common.$C("a", {classList: "kf-groups-quick-link", href:`https://online.uni-graz.at/kfu_online/sa.gruppen_einteilung?cLvNr=${courseId}`, children:["👥"]})
tds[2].append(link)
})
}
function injectQuickLinks() {
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();
_injectQuickLinks();
}
}
}
}
UGOpp.injectQuickLinks = injectQuickLinks;
injectQuickLinks();
// vim: ts=2 sts=2 sw=2

BIN
icons/icon-128-padded.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

85
icons/icon.svg Normal file
View file

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="128mm"
height="128mm"
viewBox="0 0 128 128"
version="1.1"
id="svg1"
inkscape:version="1.4.4 (dcaf3e7d9e, 2026-05-05)"
sodipodi:docname="icon.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="0.70710678"
inkscape:cx="101.82338"
inkscape:cy="292.74221"
inkscape:window-width="1920"
inkscape:window-height="975"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs1">
<rect
x="47.376154"
y="72.124892"
width="357.08892"
height="327.39045"
id="rect1" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#eaeaea;fill-opacity:1;stroke:none;stroke-width:0.2"
id="rect2"
width="100"
height="100"
x="14"
y="14"
ry="10.851143" />
<g
id="g2"
transform="translate(0,-10.921379)">
<text
xml:space="preserve"
transform="matrix(0.26458333,0,0,0.26458333,10.340336,26.904074)"
id="text1"
style="font-weight:500;font-size:120px;font-family:QTMerryScript;-inkscape-font-specification:'QTMerryScript Medium';text-align:center;writing-mode:lr-tb;direction:ltr;white-space:pre;shape-inside:url(#rect1);fill:#ffffff;stroke:#1a1a1a;stroke-width:0.755906"
x="218.14244"
y="0"><tspan
x="63.267166"
y="183.125"
id="tspan4"><tspan
style="font-weight:normal;font-family:'Open Sans';-inkscape-font-specification:'Open Sans';fill:#000000;stroke:none"
id="tspan3">UGO
</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:31.75px;font-family:'Open Sans';-inkscape-font-specification:'Open Sans';writing-mode:lr-tb;direction:ltr;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.2"
x="45.861572"
y="101.02788"
id="text2"><tspan
sodipodi:role="line"
id="tspan2"
style="stroke-width:0.2"
x="45.861572"
y="101.02788">++</tspan></text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

31
manifest.json Normal file
View file

@ -0,0 +1,31 @@
{
"manifest_version": 2,
"name": "KF-UGO++",
"version": "0.0.1",
"browser_specific_settings": {
"gecko": {
"id": "kf-ugopp@math.janko.fr",
"data_collection_permissions": {
"required": ["none"]
}
}
},
"description": "Collection of small improvements for online.uni-graz.at",
"icons": {
"128": "icons/icon-128-padded.png"
},
"content_scripts": [
{
"matches": [
"https://online.uni-graz.at/kfu_online/wblvangebot.wbshowlvoffer"
],
"js": [
"common.js",
"content.js"
],
"css": [
"content.css"
]
}
]
}