MediaWiki:Common.js
Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.
- Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
- Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
- Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
/* Das folgende JavaScript wird für alle Benutzer geladen. */
// STOPP-ALERT (manuell schließen)
document.addEventListener('DOMContentLoaded', function () {
const alertBox = document.createElement('div');
alertBox.textContent = "⚠ STOPP: Common.js wurde geladen!";
alertBox.style.position = "fixed";
alertBox.style.top = "20px";
alertBox.style.left = "20px";
alertBox.style.background = "red";
alertBox.style.color = "white";
alertBox.style.padding = "15px 20px";
alertBox.style.border = "3px solid black";
alertBox.style.fontSize = "18px";
alertBox.style.fontWeight = "bold";
alertBox.style.zIndex = "999999999";
alertBox.style.cursor = "pointer";
alertBox.style.boxShadow = "0 0 10px black";
alertBox.addEventListener('click', () => {
alertBox.remove();
});
document.body.appendChild(alertBox);
});
// Sidebar einklappbar
const portals = document.querySelectorAll('.vector-menu.mw-portlet');
portals.forEach(portal => {
const heading = portal.querySelector('.vector-menu-heading');
const content = portal.querySelector('.vector-menu-content');
if (!heading || !content) return;
if (heading.textContent.trim() === 'Navigation') return;
heading.style.cursor = 'pointer';
heading.addEventListener('click', () => {
content.classList.toggle('ts-collapsed');
});
});
}); // ← WICHTIG: Block sauber schließen
//
// Icons für Bearbeiten / Quelltext bearbeiten (Vector‑2022)
// (Dieser Hook MUSS außerhalb von DOMContentLoaded bleiben!)
//
mw.hook('wikipage.content').add(function($content) {
$content.find('.mw-editsection a').each(function() {
var $a = $(this);
var text = $a.text().trim();
$a.css({
'font-size': '0',
'display': 'inline-block',
'width': '22px',
'height': '22px',
'background-size': 'contain',
'background-repeat': 'no-repeat',
'background-position': 'center',
'vertical-align': 'middle',
'margin-left': '4px'
});
if (text === 'Bearbeiten') {
$a.css('background-image', 'url("/Wiki_BlueX/images/e/e6/EditIcon.png")');
}
if (text === 'Quelltext bearbeiten') {
$a.css('background-image', 'url("/Wiki_BlueX/images/f/f6/QEditIcon.png")');
}
});
$content.find('.mw-editsection').css('font-size', '0');
});