Änderungen von Dokument Abkürzungsverzeichnis

Zuletzt geändert von Richard Kaden am 10.11.2025 14:47

Von Version 17.1
bearbeitet von Erik Hübner
am 24.10.2025 09:47
Änderungskommentar: Es gibt keinen Kommentar für diese Version
Auf Version 11.1
bearbeitet von admin
am 22.08.2025 12:08
Änderungskommentar: Es gibt keinen Kommentar für diese Version

Zusammenfassung

Details

Seiteneigenschaften
Dokument-Autor
... ... @@ -1,1 +1,1 @@
1 -XWiki.ErikHuebner
1 +XWiki.admin
XWiki.JavaScriptExtension[0]
cache
... ... @@ -1,1 +1,0 @@
1 -long
code
... ... @@ -1,117 +1,0 @@
1 -let currentFilter = 'Alle';
2 -
3 -function initTableFilter() {
4 - const table = document.querySelector('table');
5 - if (!table) return;
6 -
7 - const tbody = table.querySelector('tbody') || table;
8 - const rows = Array.from(table.querySelectorAll('tr')).slice(1);
9 - const availableLetters = new Set();
10 -
11 - // Sortieren
12 - rows.sort((a, b) => {
13 - const textA = a.querySelector('td:first-child').textContent.trim().toUpperCase();
14 - const textB = b.querySelector('td:first-child').textContent.trim().toUpperCase();
15 - return textA.localeCompare(textB, 'de', { sensitivity: 'base' });
16 - });
17 - rows.forEach(row => tbody.appendChild(row));
18 -
19 - // Klassen & IDs
20 - rows.forEach(row => {
21 - const firstCell = row.querySelector('td:first-child');
22 - if (firstCell && firstCell.textContent) {
23 - const text = firstCell.textContent.trim();
24 - let firstChar = text.charAt(0).toUpperCase();
25 - if (['Ä','Ö','Ü'].includes(firstChar)) firstChar = firstChar;
26 - row.classList.add('letter-' + firstChar);
27 - availableLetters.add(firstChar);
28 -
29 - const idMatch = firstCell.innerHTML.match(/id\s*=\s*["']([^"']+)["']/);
30 - if (idMatch) {
31 - const anchorId = idMatch[1];
32 - row.id = anchorId;
33 - firstCell.innerHTML = firstCell.innerHTML.replace(/id\s*=\s*["'][^"']+["']/, '');
34 - firstCell.classList.add('anchor-target');
35 - }
36 - }
37 - });
38 -
39 - // Ausgrauen
40 - const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜ'.split('');
41 - letters.forEach(letter => {
42 - const link = document.getElementById('letter-' + letter);
43 - if (link && !availableLetters.has(letter)) link.classList.add('disabled');
44 - });
45 -
46 - filterTable('Alle', document.getElementById('all-link'));
47 -
48 - // Anker-Links
49 - document.addEventListener('click', e => {
50 - if (e.target.tagName === 'A' && e.target.getAttribute('href')?.startsWith('#')) {
51 - const hash = e.target.getAttribute('href');
52 - if (hash === '#') return;
53 - e.preventDefault();
54 - handleAnchorClick(hash.substring(1));
55 - }
56 - });
57 -
58 - // Initialer Hash
59 - if (window.location.hash) {
60 - setTimeout(() => handleAnchorClick(window.location.hash.substring(1)), 300);
61 - }
62 -}
63 -
64 -function filterTable(letter, targetLink) {
65 - currentFilter = letter;
66 - const table = document.querySelector('table');
67 - if (!table) return;
68 - const rows = table.querySelectorAll('tr');
69 -
70 - rows.forEach((row, index) => {
71 - if (index === 0) { row.style.display = ''; return; }
72 - row.style.display = (letter === 'Alle' || row.classList.contains('letter-' + letter)) ? '' : 'none';
73 - });
74 -
75 - // Highlight Navigation
76 - document.querySelectorAll('#alpha-nav a').forEach(link => {
77 - link.style.fontWeight = 'normal';
78 - link.style.color = 'inherit';
79 - });
80 - if (targetLink) {
81 - targetLink.style.fontWeight = 'bold';
82 - targetLink.style.color = '#00597B';
83 - }
84 -}
85 -
86 -// --- Stabiler Anker-Sprung ---
87 -function handleAnchorClick(targetId) {
88 - const targetRow = document.getElementById(targetId);
89 - if (!targetRow) return;
90 -
91 - const firstCell = targetRow.querySelector('td:first-child');
92 - const text = firstCell.textContent.trim();
93 - let firstChar = text.charAt(0).toUpperCase();
94 - if (['Ä','Ö','Ü'].includes(firstChar)) firstChar = firstChar;
95 -
96 - // Filter ggf. anpassen
97 - if (targetRow.style.display === 'none' || currentFilter !== firstChar) {
98 - const link = document.getElementById('letter-' + firstChar);
99 - if (link && !link.classList.contains('disabled')) {
100 - filterTable(firstChar, link);
101 - } else if (currentFilter !== 'Alle') {
102 - filterTable('Alle', document.getElementById('all-link'));
103 - }
104 - }
105 -
106 - // Scrollen + Hervorheben (ohne Sprung zurück)
107 - setTimeout(() => {
108 - history.replaceState(null, '', '#' + targetId); // Hash stabilisieren
109 - targetRow.scrollIntoView({ behavior: 'smooth', block: 'center' });
110 - targetRow.style.transition = 'background-color 0.6s';
111 - targetRow.style.backgroundColor = '#e6f3ff';
112 - setTimeout(() => { targetRow.style.backgroundColor = ''; }, 2000);
113 - }, 200);
114 -}
115 -
116 -// Init aufrufen
117 -document.addEventListener('DOMContentLoaded', initTableFilter);
name
... ... @@ -1,1 +1,0 @@
1 -Abkürzungsverzeichnis
use
... ... @@ -1,1 +1,0 @@
1 -currentPage