Files
A5-Tampermonkey/academyFIVE__ChangeFont.user.js
2025-11-25 09:58:36 +01:00

69 lines
2.6 KiB
JavaScript

// ==UserScript==
// @name academyFIVE::ChangeFont
// @namespace tvog/academyfive
// @version 2025-05-14
// @description Ändert die Schriftart im Navigationsbaum zu Arial
// @author Dims Akpan
// @match https://a5.fhdw-hannover.de/nav.php4*
// @match https://a5.fhdw.de/nav.php4*
// @match https://fhdw.academyfive-preview.net/nav.php4*
// @match https://fhdw-hannover.academyfive-preview.net/nav.php4*
// @grant none
// @icon https://www.academyfive.com/typo3conf/ext/sitepackage/Resources/Public/build/assets/images/favicon-academyfive.ico
// ==/UserScript==
(function() {
'use strict';
// Füge einen eigenen CSS-Style mit höchster Priorität hinzu
function injectCustomFontStyle() {
const customStyle = document.createElement('style');
// Mit höherer Spezifität und !important für maximale Durchsetzungskraft
customStyle.textContent = `
/* Generelle Anwendung auf alle Links in der Navigation */
html body a,
html body a:link,
html body a:visited,
html body a:active,
html body a:hover,
html body A:link,
html body A:hover {
font-family: Inter, Arial, "Open Sans", Verdana, sans-serif !important;
}
/* Zusätzlich noch spezifische Elemente abdecken */
html body .tree-node,
html body .tree-node *,
html body div.tree *,
html body #content a,
html body #content_scroll a {
font-family: Inter, Arial, "Open Sans", Verdana, sans-serif !important;
}
`;
// Stelle sicher, dass unser Style als letztes eingefügt wird (höchste Priorität)
customStyle.setAttribute('id', 'academyfive-custom-font');
// Style einfügen
document.head.appendChild(customStyle);
console.log('Benutzerdefinierter Font-Style eingefügt');
}
// Beginne so früh wie möglich
if (document.head) {
injectCustomFontStyle();
} else {
// Falls document.head noch nicht verfügbar ist
document.addEventListener('DOMContentLoaded', injectCustomFontStyle);
}
// Zusätzliche Sicherheit: Reagiere auf zukünftige DOM-Änderungen
document.addEventListener('DOMContentLoaded', function() {
// Prüfe regelmäßig, ob unser Style noch vorhanden ist
setInterval(function() {
if (!document.getElementById('academyfive-custom-font')) {
injectCustomFontStyle();
}
}, 2000); // Alle 2 Sekunden prüfen
});
})();