|
|
Zeile 1: |
Zeile 1: |
|
| |
|
| mw.loader.using(['jquery'], function () {
| |
| $(document).ready(function () {
| |
| $('.smw-column-header').each(function () {
| |
| // aktuellen HTML-Inhalt holen
| |
| var html = $(this).html();
| |
| // "Fortsetzung" entfernen, Leerzeichen ggf. bereinigen
| |
| var newHtml = html.replace(/Fortsetzung/g, '').trim();
| |
| // falls nach dem Entfernen gar kein Text übrig ist, komplette Header-Box ausblenden:
| |
| if (newHtml === '') {
| |
| $(this).hide();
| |
| } else {
| |
| // ansonsten nur den Text überschreiben, sodass z. B. "B Fortsetzung" → "B" wird
| |
| $(this).html(newHtml);
| |
| }
| |
| });
| |
| $(function () {
| |
| $('<style>')
| |
| .prop('type', 'text/css')
| |
| .html(
| |
| '.breadcrumb-item { font-size: 17px !important; }' +
| |
| '.breadcrumb-nav { border-bottom: 2px solid #85bc20!important; margin-bottom: 20px !important; }'
| |
| )
| |
| .appendTo('head');
| |
| });
| |
| });
| |
| });
| |
| $(function() {
| |
| // 1) Klick merken
| |
| $('body').on('click', 'a.mws-tree-item-label', function() {
| |
| try {
| |
| window.name = JSON.stringify({ lastNav: this.getAttribute('href') });
| |
| } catch (e) {}
| |
| });
| |
|
| |
| // 2) Polling & Aufklappen + Inline‐Styling
| |
| var attempts = 0,
| |
| interval = setInterval(function() {
| |
| attempts++;
| |
| var data = {};
| |
| try {
| |
| data = JSON.parse(window.name || '{}');
| |
| } catch (e) {}
| |
| var last = data.lastNav;
| |
| if (!last || attempts > 10) {
| |
| clearInterval(interval);
| |
| return;
| |
| }
| |
| var $link = $('a.mws-tree-item-label[href="' + last + '"]');
| |
| if ($link.length) {
| |
| clearInterval(interval);
| |
| // Zweige aufklappen
| |
| $link.parents('li.mws-tree-item').each(function() {
| |
| var $exp = $(this).children('div').children('a.mws-tree-expander.collapsed');
| |
| if ($exp.length) {
| |
| $exp.trigger('click');
| |
| }
| |
| });
| |
| // Inline‐Styles setzen
| |
| $link.css({
| |
| 'background-color': '#eef',
| |
| 'font-weight': 'bold',
| |
| 'color': '#000',
| |
| 'border-left': '3px solid #98A7C4',
| |
| 'padding-left': '0.5em'
| |
| });
| |
| // optional scrollen
| |
| $('html, body').scrollTop($link.offset().top - 80);
| |
| }
| |
| }, 300);
| |
| });
| |
| $(function(){
| |
| // In allen Category-Ausgaben: jede LI, die einen <a class="new"> enthält, entfernen
| |
| $('.smw-columnlist-container a.new').each(function(){
| |
| $(this).closest('li').remove();
| |
| });
| |
| });
| |
| $(function(){
| |
| // 1. Rote Links raus (wie gehabt)
| |
| $('.smw-columnlist-container a.new').each(function(){
| |
| $(this).closest('li').remove();
| |
| });
| |
|
| |
| // 2. Jetzt jede Buchstaben-Überschrift entfernen, deren Liste leer ist
| |
| $('.smw-column-header').each(function(){
| |
| var $header = $(this),
| |
| $ul = $header.next('ul');
| |
| if ($ul.length && $ul.children('li').length === 0) {
| |
| $ul.remove();
| |
| $header.remove();
| |
| }
| |
| });
| |
| });
| |
| (function(){
| |
| const maxTries = 6;
| |
| const interval = 1000; // 1 Sekunde
| |
| let tries = 0;
| |
|
| |
| function attempt() {
| |
| tries++;
| |
| console.log(`🔍 Versuch ${tries}/${maxTries}: suche Breadcrumb-Toggle …`);
| |
|
| |
| // 1) Finde das Toggle-Element
| |
| const navToggle = document.querySelector('a.breadcrumb-nav-subpages');
| |
| if (!navToggle) {
| |
| if (tries < maxTries) return setTimeout(attempt, interval);
| |
| return console.warn('❌ Kein Breadcrumb-Toggle gefunden, Abbruch.');
| |
| }
| |
| console.log('✅ Breadcrumb-Toggle gefunden');
| |
|
| |
| // 2) Hole das Menü via aria-controls
| |
| const menuId = navToggle.getAttribute('aria-controls');
| |
| if (!menuId) return console.error('❌ aria-controls fehlt am Toggle');
| |
| const menuEl = document.getElementById(menuId);
| |
| if (!menuEl) return console.error(`❌ Menü mit ID ${menuId} nicht gefunden`);
| |
|
| |
| // 3) Sammle alle Links im Menü
| |
| const links = Array.from(menuEl.querySelectorAll('ul li a'));
| |
| if (links.length === 0) {
| |
| return console.warn('⚠️ Keine Unterseiten-Links gefunden');
| |
| }
| |
| console.log(`✅ ${links.length} Link(s) gefunden`);
| |
|
| |
| // 4) Baue die Box mit UL
| |
| const box = document.createElement('div');
| |
| box.id = 'subpages-box'; // kannst Du in CSS stylen
| |
| const ul = document.createElement('ul');
| |
| ul.id = 'subpages-list';
| |
| links.forEach(a => {
| |
| const li = document.createElement('li');
| |
| li.appendChild(a.cloneNode(true));
| |
| ul.appendChild(li);
| |
| });
| |
| box.appendChild(ul);
| |
|
| |
| // 5) Füge die Box direkt unter den Breadcrumbs ein
| |
| const bc = document.getElementById('breadcrumbs');
| |
| bc.parentNode.insertBefore(box, bc.nextSibling);
| |
| console.log('🎉 Subpages-Box erfolgreich eingefügt');
| |
| }
| |
|
| |
| // Warte bis alle Ressourcen geladen sind
| |
| window.addEventListener('load', () => setTimeout(attempt, interval));
| |
| })();
| |