Compare commits
4 Commits
44f3be9b1f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 0fd4ab6b6b | |||
| 2e0eda71df | |||
| 1f9e559434 | |||
| f8f9441e67 |
@@ -1,36 +1,47 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name academyFIVE::AddSelectBox
|
// @name academyFIVE::AddSelectBox
|
||||||
// @namespace dakp/academyfive
|
// @namespace dakp/academyfive
|
||||||
// @version 2025-11-24
|
// @version 2025.11.003
|
||||||
// @description Füge Selectbox für Kohorten hinzu
|
// @description Füge Selectbox für Kohorten hinzu
|
||||||
// @author Dims Akpan
|
// @author Dims Akpan
|
||||||
// @match https://a5.fhdw-hannover.de/course/planning-group/list*
|
// @match https://a5.fhdw-hannover.de/*
|
||||||
// @match https://a5.fhdw.de/course/planning-group/list*
|
// @match https://a5.fhdw.de/*
|
||||||
// @match https://fhdw.academyfive-preview.net/course/planning-group/list*
|
// @match https://fhdw.academyfive-preview.net/*
|
||||||
// @match https://fhdw-hannover.academyfive-preview.net/course/planning-group/list*
|
// @match https://fhdw-hannover.academyfive-preview.net/*
|
||||||
// @grant none
|
// @grant none
|
||||||
// @icon https://www.academyfive.com/typo3conf/ext/sitepackage/Resources/Public/build/assets/images/favicon-academyfive.ico
|
// @icon https://www.academyfive.com/typo3conf/ext/sitepackage/Resources/Public/build/assets/images/favicon-academyfive.ico
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
window.addEventListener('load', function() {
|
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[]"]');
|
const cohortsDropdown = document.querySelector('select[name="cohort-ids[]"]');
|
||||||
|
|
||||||
if (!cohortsDropdown) {
|
if (!cohortsDropdown) {
|
||||||
console.log('Kohorten-Dropdown nicht gefunden');
|
console.log('Kohorten-Dropdown nicht gefunden');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dropdownContainer = cohortsDropdown.closest('.btn-group.bootstrap-select');
|
const dropdownContainer = cohortsDropdown.closest('.btn-group.bootstrap-select');
|
||||||
const searchBox = dropdownContainer.querySelector('.bs-searchbox');
|
const searchBox = dropdownContainer?.querySelector('.bs-searchbox');
|
||||||
|
|
||||||
if (!searchBox) {
|
if (!searchBox) {
|
||||||
console.log('Searchbox nicht gefunden');
|
console.log('Searchbox nicht gefunden');
|
||||||
return;
|
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');
|
const actionsBox = document.createElement('div');
|
||||||
actionsBox.className = 'bs-actionsbox';
|
actionsBox.className = 'bs-actionsbox';
|
||||||
actionsBox.innerHTML = `
|
actionsBox.innerHTML = `
|
||||||
@@ -39,9 +50,17 @@
|
|||||||
<button type="button" class="actions-btn bs-deselect-all btn btn-default">Nichts auswählen</button>
|
<button type="button" class="actions-btn bs-deselect-all btn btn-default">Nichts auswählen</button>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
searchBox.insertAdjacentElement('afterend', actionsBox);
|
searchBox.insertAdjacentElement('afterend', actionsBox);
|
||||||
|
|
||||||
console.log('Select/Deselect Buttons erfolgreich eingefügt');
|
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);
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
Reference in New Issue
Block a user