66 lines
2.5 KiB
JavaScript
66 lines
2.5 KiB
JavaScript
// ==UserScript==
|
|
// @name academyFIVE::AddSelectBox
|
|
// @namespace dakp/academyfive
|
|
// @version 2025-11-24
|
|
// @description Füge Selectbox für Kohorten hinzu
|
|
// @author Dims Akpan
|
|
// @match https://a5.fhdw-hannover.de/course/planning-group/list*
|
|
// @match https://a5.fhdw.de/course/planning-group/list*
|
|
// @match https://fhdw.academyfive-preview.net/course/planning-group/list*
|
|
// @match https://fhdw-hannover.academyfive-preview.net/course/planning-group/list*
|
|
// @grant none
|
|
// @icon https://www.academyfive.com/typo3conf/ext/sitepackage/Resources/Public/build/assets/images/favicon-academyfive.ico
|
|
// ==/UserScript==
|
|
|
|
(function() {
|
|
'use strict';
|
|
|
|
function addSelectButtons() {
|
|
// Prüfe ob wir auf der richtigen Seite sind
|
|
if (!window.location.href.includes('/course/planning-group/list')) {
|
|
return;
|
|
}
|
|
|
|
const cohortsDropdown = document.querySelector('select[name="cohort-ids[]"]');
|
|
|
|
if (!cohortsDropdown) {
|
|
console.log('Kohorten-Dropdown nicht gefunden');
|
|
return;
|
|
}
|
|
|
|
const dropdownContainer = cohortsDropdown.closest('.btn-group.bootstrap-select');
|
|
const searchBox = dropdownContainer?.querySelector('.bs-searchbox');
|
|
|
|
if (!searchBox) {
|
|
console.log('Searchbox nicht gefunden');
|
|
return;
|
|
}
|
|
|
|
// Prüfe ob schon vorhanden
|
|
if (searchBox.nextElementSibling?.classList.contains('bs-actionsbox')) {
|
|
console.log('Select/Deselect Buttons bereits vorhanden');
|
|
return;
|
|
}
|
|
|
|
const actionsBox = document.createElement('div');
|
|
actionsBox.className = 'bs-actionsbox';
|
|
actionsBox.innerHTML = `
|
|
<div class="btn-group btn-group-sm btn-block">
|
|
<button type="button" class="actions-btn bs-select-all btn btn-default">Alles auswählen</button>
|
|
<button type="button" class="actions-btn bs-deselect-all btn btn-default">Nichts auswählen</button>
|
|
</div>
|
|
`;
|
|
|
|
searchBox.insertAdjacentElement('afterend', actionsBox);
|
|
|
|
console.log('Select/Deselect Buttons erfolgreich eingefügt');
|
|
}
|
|
|
|
// Versuche es direkt
|
|
addSelectButtons();
|
|
|
|
// Falls das Element noch nicht da ist, warte auf DOMContentLoaded
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', addSelectButtons);
|
|
}
|
|
})(); |