Aller au contenu

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

De AECFC
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 28 : Ligne 28 :
     }
     }
})();
})();
mw.loader.using( 'mediawiki.util' ).then( function () {
    var pageName = mw.config.get( 'wgPageName' );
    var slashPosition = pageName.lastIndexOf( '/' );
    // L'onglet n'apparaît que si la page possède un parent
    if ( slashPosition > 0 ) {
        var parentPage = pageName.substring( 0, slashPosition );
        mw.util.addPortletLink(
            'p-views',
            mw.util.getUrl( parentPage ),
            'Page parente',
            'ca-parent-page',
            'Revenir à la page parente',
            null,
            '#ca-history'
        );
    }
} );

Version du 2 juillet 2026 à 23:45

/* Tout JavaScript présent ici sera exécuté par tous les utilisateurs à chaque chargement de page.

$(function () {
    $('a.mw-wiki-logo, a.mw-logo')
        .attr('href', 'https://aecfc.org')
        .attr('title', 'Retour au site d'AECFC');
});
*/

(function () {
    'use strict';

    function restoreAecfcLink() {
        document.querySelectorAll('a.mw-logo').forEach(function (link) {
            link.href = 'https://aecfc.org/';
            link.title = 'Site de l’AECFC';
        });
    }

    if (document.readyState === 'loading') {
        document.addEventListener(
            'DOMContentLoaded',
            restoreAecfcLink,
            { once: true }
        );
    } else {
        restoreAecfcLink();
    }
})();

mw.loader.using( 'mediawiki.util' ).then( function () {
    var pageName = mw.config.get( 'wgPageName' );
    var slashPosition = pageName.lastIndexOf( '/' );

    // L'onglet n'apparaît que si la page possède un parent
    if ( slashPosition > 0 ) {
        var parentPage = pageName.substring( 0, slashPosition );

        mw.util.addPortletLink(
            'p-views',
            mw.util.getUrl( parentPage ),
            'Page parente',
            'ca-parent-page',
            'Revenir à la page parente',
            null,
            '#ca-history'
        );
    }
} );