|
|
| (6 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) |
| Zeile 2: |
Zeile 2: |
| /** Namensräume für die Seitenvorschau **/ | | /** Namensräume für die Seitenvorschau **/ |
| mw.config.set('wgContentNamespaces', [0, 100]); | | mw.config.set('wgContentNamespaces', [0, 100]); |
|
| |
| //
| |
| // Sidebar‑Manipulation (Werkzeugkasten erweitern)
| |
| //
| |
| function ModifySidebar(action, section, name, link) {
| |
| try {
| |
| var target = 'p-' + section;
| |
| if (section === 'languages') target = 'p-lang';
| |
| if (section === 'toolbox') target = 'p-tb';
| |
| if (section === 'navigation') target = 'p-navigation';
| |
|
| |
| var list = document.getElementById(target);
| |
| if (list) list = list.getElementsByTagName('div')[0];
| |
| if (list) list = list.getElementsByTagName('ul')[0];
| |
| if (!list) return;
| |
|
| |
|
| |
| if (action === 'add') {
| |
| var aNode = document.createElement('a');
| |
| var liNode = document.createElement('li');
| |
|
| |
| aNode.appendChild(document.createTextNode(name));
| |
| aNode.setAttribute('href', link);
| |
| liNode.appendChild(aNode);
| |
| liNode.className = 'plainlinks';
| |
| list.appendChild(liNode);
| |
| }
| |
|
| |
| if (action === 'remove') {
| |
| var items = list.getElementsByTagName('li');
| |
| for (var i = 0; i < items.length; i++) {
| |
| var a = items[i].getElementsByTagName('a')[0];
| |
| if (a && (a.innerHTML === name || a.href === link)) {
| |
| list.removeChild(items[i]);
| |
| }
| |
| }
| |
| }
| |
| } catch (e) {
| |
| return;
| |
| }
| |
| }
| |
|
| |
| function CustomizeModificationsOfSidebar() {
| |
| // Toolbox‑Einträge für BlueX
| |
| ModifySidebar('add', 'toolbox', 'Textbausteine', '/Wiki_BlueX/index.php/Kategorie:Textbausteine');
| |
| ModifySidebar('add', 'toolbox', 'Letzte Änderungen', '/Wiki_BlueX/index.php/Spezial:Letzte_Änderungen');
| |
| ModifySidebar('add', 'toolbox', 'Alle Seiten', '/Wiki_BlueX/index.php/Spezial:Alle_Seiten');
| |
| ModifySidebar('add', 'toolbox', 'Zufällige Seite', '/Wiki_BlueX/index.php/Spezial:Zufällige_Seite');
| |
| }
| |
|
| |
| jQuery(CustomizeModificationsOfSidebar);
| |
|
| |
|
| |
|
| // | | // |
| Zeile 90: |
Zeile 38: |
| // Klammern entfernen | | // Klammern entfernen |
| $content.find('.mw-editsection').css('font-size', '0'); | | $content.find('.mw-editsection').css('font-size', '0'); |
| });
| |
|
| |
| // === BlueX-Sidebar für Vector‑2022 (statisch) ===
| |
| mw.loader.using(['mediawiki.util'], function () {
| |
|
| |
| if (mw.config.get('skin') !== 'vector-2022') return;
| |
|
| |
| $(function () {
| |
|
| |
| // Prüfen, ob wir schon eine Sidebar gebaut haben
| |
| if (document.getElementById('bx-sidebar')) return;
| |
|
| |
| // Container für Inhalt finden (robust)
| |
| var $content = $('#content, #mw-content, #mw-content-text').first();
| |
| if (!$content.length) return;
| |
|
| |
| // Sidebar-Daten (entspricht deiner MediaWiki:Sidebar)
| |
| var data = [
| |
| {
| |
| title: 'Navigation',
| |
| items: [
| |
| { href: mw.util.getUrl('BlueX-Universum'), text: 'Hauptseite' },
| |
| { href: mw.util.getUrl('Hilfe:Handbuch'), text: 'Handbuch' },
| |
| { href: mw.util.getUrl('Hilfe:FAQ'), text: 'FAQ' }
| |
| ]
| |
| },
| |
| {
| |
| title: 'Kontakt',
| |
| items: [
| |
| { href: '#', text: 'Kontakt 1' },
| |
| { href: '#', text: 'Kontakt 2' }
| |
| ]
| |
| },
| |
| {
| |
| title: 'BlueX',
| |
| items: [
| |
| { href: mw.util.getUrl('Kategorie:Blue-X'), text: 'Blue-X' },
| |
| { href: mw.util.getUrl('Kategorie:Blue-X_Glossar'), text: 'Blue-X Glossar' }
| |
| ]
| |
| },
| |
| {
| |
| title: 'Perryversum',
| |
| items: [
| |
| { href: mw.util.getUrl('Kategorie:Perryversum'), text: 'Perryversum' }
| |
| ]
| |
| },
| |
| {
| |
| title: 'OutBack',
| |
| items: [
| |
| { href: mw.util.getUrl('Kategorie:OutBack'), text: 'OutBack' },
| |
| { href: mw.util.getUrl('Kategorie:OutBack_Glossar'), text: 'OutBack Glossar' }
| |
| ]
| |
| },
| |
| {
| |
| title: 'Terranian-Star',
| |
| items: [
| |
| { href: mw.util.getUrl('Kategorie:Terranian_Star'), text: 'Terranian-Star' },
| |
| { href: mw.util.getUrl('Kategorie:Terranian_Star_Glossar'), text: 'Terranian Star Glossar' }
| |
| ]
| |
| },
| |
| {
| |
| title: 'Drix',
| |
| items: [
| |
| { href: mw.util.getUrl('Kategorie:Drix'), text: 'Drix' },
| |
| { href: mw.util.getUrl('Kategorie:Drix_Glossar'), text: 'Drix Glossar' }
| |
| ]
| |
| },
| |
| {
| |
| title: 'Spezielles',
| |
| items: [
| |
| { href: mw.util.getUrl('Spezial:Letzte_Änderungen'), text: 'Letzte Änderungen' },
| |
| { href: mw.util.getUrl('Spezial:Spezialseiten'), text: 'Spezialseiten' }
| |
| ]
| |
| }
| |
| ];
| |
|
| |
| // Sidebar-Container
| |
| var $sidebar = $('<div id="bx-sidebar"></div>').css({
| |
| width: '230px',
| |
| padding: '10px',
| |
| 'box-sizing': 'border-box'
| |
| });
| |
|
| |
| // Inhalt nach rechts schieben
| |
| $content.parent().css('display', 'flex');
| |
| $content.css('margin-left', '20px');
| |
| $content.before($sidebar);
| |
|
| |
| // Blöcke bauen
| |
| data.forEach(function (block) {
| |
| var $portal = $('<div class="bx-portal"></div>').css({
| |
| 'margin-bottom': '15px',
| |
| 'border-bottom': '1px solid #ddd',
| |
| 'padding-bottom': '5px'
| |
| });
| |
|
| |
| var $header = $('<div class="bx-header"></div>').text(block.title).css({
| |
| 'font-weight': 'bold',
| |
| 'cursor': 'pointer',
| |
| 'padding': '4px 0'
| |
| });
| |
|
| |
| var $arrow = $('<span>▼</span>').css({
| |
| 'float': 'right',
| |
| 'transition': '0.2s',
| |
| 'font-weight': 'bold'
| |
| });
| |
|
| |
| var $contentList = $('<div class="bx-content"></div>');
| |
| var $ul = $('<ul></ul>').css('margin-left', '12px');
| |
|
| |
| block.items.forEach(function (item) {
| |
| var $li = $('<li></li>');
| |
| var $a = $('<a></a>').attr('href', item.href).text(item.text);
| |
| $li.append($a);
| |
| $ul.append($li);
| |
| });
| |
|
| |
| $contentList.append($ul);
| |
| $header.append($arrow);
| |
| $portal.append($header).append($contentList);
| |
| $sidebar.append($portal);
| |
|
| |
| // Klick zum Einklappen
| |
| $header.on('click', function () {
| |
| if ($contentList.is(':visible')) {
| |
| $contentList.slideUp(150);
| |
| $arrow.css('transform', 'rotate(-90deg)');
| |
| } else {
| |
| $contentList.slideDown(150);
| |
| $arrow.css('transform', 'rotate(0deg)');
| |
| }
| |
| });
| |
| });
| |
| });
| |
| }); | | }); |
/* Das folgende JavaScript wird für alle Benutzer geladen. */
/** Namensräume für die Seitenvorschau **/
mw.config.set('wgContentNamespaces', [0, 100]);
//
// Icons für Bearbeiten / Quelltext bearbeiten (Vector‑2022)
//
mw.hook('wikipage.content').add(function($content) {
$content.find('.mw-editsection a').each(function() {
var $a = $(this);
var text = $a.text().trim();
// Text ausblenden
$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'
});
// Normales Bearbeiten
if (text === 'Bearbeiten') {
$a.css('background-image', 'url("/Wiki_BlueX/images/e/e6/EditIcon.png")');
}
// Quelltext bearbeiten
if (text === 'Quelltext bearbeiten') {
$a.css('background-image', 'url("/Wiki_BlueX/images/f/f6/QEditIcon.png")');
}
});
// Klammern entfernen
$content.find('.mw-editsection').css('font-size', '0');
});