Aller au contenu

« MediaWiki:Common.js » : différence entre les versions

De WikiName
Aucun résumé des modifications
Aucun résumé des modifications
 
(13 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
$(function () {
$(function () {


Ligne 13 : Ligne 14 :


     header.prepend(container);
     header.prepend(container);
});
/* ============================= */
/* DÉTECTION AUTOMATIQUE DES VALEURS NUMÉRIQUES */
/* ============================= */
mw.hook('wikipage.content').add(function ($content) {
    $content.find('table.fandom-table td, table.wikitable td').each(function () {
        const cell = $(this);
        const text = cell.text().trim();
        // Nombre entier, décimal, positif/négatif, avec éventuellement %
        if (/^[+-]?\d+(?:[.,]\d+)?%?$/.test(text)) {
            cell.addClass('pne-number');
        }
    });


});
});

Dernière version du 10 août 2026 à 16:01


$(function () {

    const header = document.querySelector('.vector-header-end');
    if (!header) return;

    const container = document.createElement('div');
    container.className = "pne-header-links";

    container.innerHTML = `
<a href="/wiki/index.php/Spécial:Toutes_les_pages">Parcourir</a>
<a href="/wiki/index.php/Spécial:Catégories">Catégories</a>
    `;

    header.prepend(container);

});
/* ============================= */
/* DÉTECTION AUTOMATIQUE DES VALEURS NUMÉRIQUES */
/* ============================= */

mw.hook('wikipage.content').add(function ($content) {

    $content.find('table.fandom-table td, table.wikitable td').each(function () {

        const cell = $(this);
        const text = cell.text().trim();

        // Nombre entier, décimal, positif/négatif, avec éventuellement %
        if (/^[+-]?\d+(?:[.,]\d+)?%?$/.test(text)) {
            cell.addClass('pne-number');
        }

    });

});