Markierungen: Mobile Bearbeitung Mobile Web-Bearbeitung Erweiterte mobile Bearbeitung |
Markierungen: Ersetzt Mobile Bearbeitung Mobile Web-Bearbeitung Erweiterte mobile Bearbeitung |
| Zeile 1: |
Zeile 1: |
| /* All JavaScript here will be loaded for users of the MinervaNeue skin */ | | /* All JavaScript here will be loaded for users of the MinervaNeue skin */ |
| console.log('Minerva.js: OK');
| |
|
| |
| mw.loader.using(['mediawiki.util']).then(function () {
| |
| var LINK_ID = 'ados-all-link';
| |
| var LINK_TEXT = 'Alle A Dream of Scotland Abfüllungen';
| |
| var LINK_URL = mw.util.getUrl('Alle A Dream of Scotland Abfüllungen');
| |
| // Alternativ harte URL:
| |
| // var LINK_URL = 'https://ados-wiki.bplaced.net/index.php?title=Alle_A_Dream_of_Scotland_Abf%C3%BCllungen';
| |
|
| |
| function findMenuList() {
| |
| // Mehrere mögliche Strukturen je nach Minerva/MobileFrontend-Version:
| |
| return document.querySelector(
| |
| // neuer Minerva-Drawer
| |
| '.minerva-drawer .minerva-drawer__list,' +
| |
| // ältere Drawer-Varianten
| |
| '#mw-mf-page-left .menu ul,' +
| |
| '.drawer .menu ul,' +
| |
| 'nav.drawer .menu ul'
| |
| );
| |
| }
| |
|
| |
| function addLink() {
| |
| if (document.getElementById(LINK_ID)) return; // schon da
| |
| var list = findMenuList();
| |
| if (!list) return;
| |
|
| |
| var li = document.createElement('li');
| |
| li.className = 'mw-list-item';
| |
| var a = document.createElement('a');
| |
| a.id = LINK_ID;
| |
| a.textContent = LINK_TEXT;
| |
| a.href = LINK_URL;
| |
| li.appendChild(a);
| |
|
| |
| // nach ganz oben
| |
| list.insertBefore(li, list.firstChild);
| |
| console.log('Minerva.js: Link eingefügt ✔');
| |
| }
| |
|
| |
| // 1) Beim Laden
| |
| if (document.readyState !== 'loading') addLink();
| |
| else document.addEventListener('DOMContentLoaded', addLink);
| |
|
| |
| // 2) Wenn der Drawer später gerendert wird → MutationObserver
| |
| var mo = new MutationObserver(function () { addLink(); });
| |
| mo.observe(document.body, { childList: true, subtree: true });
| |
|
| |
| // 3) Kleines Intervall als Fallback (läuft 5s)
| |
| var t = 0, i = setInterval(function () {
| |
| addLink();
| |
| if ((t += 500) >= 5000) clearInterval(i);
| |
| }, 500);
| |
| });
| |