MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus The Alchenomicon Wiki
Die Seite wurde neu angelegt: „Strip namespace prefixes from category listings: document.querySelectorAll('.mw-category a').forEach(function(a) { var text = a.textContent; var colon = text.indexOf(':'); if (colon !== -1) { a.textContent = text.substring(colon + 1); } });“
 
Keine Bearbeitungszusammenfassung
 
Zeile 1: Zeile 1:
/* Strip namespace prefixes from category listings */
mw.hook('wikipage.content').add(function() {
document.querySelectorAll('.mw-category a').forEach(function(a) {
    document.querySelectorAll('.mw-category a').forEach(function(a) {
    var text = a.textContent;
        var text = a.textContent;
    var colon = text.indexOf(':');
        var colon = text.indexOf(':');
    if (colon !== -1) {
        if (colon !== -1) {
        a.textContent = text.substring(colon + 1);
            a.textContent = text.substring(colon + 1);
     }
        }
     });
});
});

Aktuelle Version vom 27. April 2026, 19:21 Uhr

mw.hook('wikipage.content').add(function() {
    document.querySelectorAll('.mw-category a').forEach(function(a) {
        var text = a.textContent;
        var colon = text.indexOf(':');
        if (colon !== -1) {
            a.textContent = text.substring(colon + 1);
        }
    });
});