diff --git a/academyFIVE__HighlightStudyRow.user.js b/academyFIVE__HighlightStudyRow.user.js new file mode 100644 index 0000000..4b28d04 --- /dev/null +++ b/academyFIVE__HighlightStudyRow.user.js @@ -0,0 +1,61 @@ +// ==UserScript== +// @name academyFIVE::HighlightStudyRow +// @namespace dakp/academyfive +// @version 2026.10.003 +// @description Hebt beim Hovern einer Zelle die gesamte -Zeile der Studiensemester-Tabelle (profil_studenten_edit.php4) per CSS hervor +// @author Dims Akpan +// @match https://a5.fhdw-hannover.de/admin/* +// @match https://a5.fhdw.de/admin/* +// @match https://fhdw.academyfive-preview.net/admin/* +// @match https://fhdw-hannover.academyfive-preview.net/admin/* +// @grant none +// @icon https://www.academyfive.com/typo3conf/ext/sitepackage/Resources/Public/build/assets/images/favicon-academyfive.ico +// ==/UserScript== + +(function() { + 'use strict'; + + const STYLE_CLASS = 'a5-row-hl'; + const HOVER_COLOR = 'rgba(0, 120, 200, 0.12)'; + + // Reines CSS: Hover wird nativ vom Browser verfolgt + const style = document.createElement('style'); + style.textContent = ` + table.${STYLE_CLASS} tr:hover th, + table.${STYLE_CLASS} tr:hover td { + background-color: ${HOVER_COLOR} !important; + } + `; + (document.head || document.documentElement).appendChild(style); + + // Studiensemester-Tabelle anhand typischer Eingabefelder erkennen + function isStudyTable(table) { + return !!table.querySelector('input[name*="hochschulsemester"], input[name*="fachsemester"], input[name*="as_gesamt"]'); + } + + function markTable(table) { + if (table.dataset.a5RowHl || table.classList.contains(STYLE_CLASS)) return; + table.dataset.a5RowHl = 'true'; + table.classList.add(STYLE_CLASS); + } + + function scanTables() { + document.querySelectorAll('table').forEach(table => { + if (isStudyTable(table)) markTable(table); + }); + } + + function onDocReady() { + scanTables(); + // Für dynamisch nachgeladene Tabellen: Klassenzuweisung ist idempotent, + // daher dünner Observer mit kindList/childList. + new MutationObserver(scanTables) + .observe(document.documentElement, { childList: true, subtree: true }); + } + + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', onDocReady); + } else { + onDocReady(); + } +})(); \ No newline at end of file