Dernière modification le il y a une semaine
par Cyrilhubeau

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

Aucun résumé des modifications
Aucun résumé des modifications
Ligne 25 : Ligne 25 :
document.getElementById("mw-pages").innerHTML = "";  
document.getElementById("mw-pages").innerHTML = "";  
}
}
// Gestion des commentaires
/*mw.loader.using(['mediawiki.api', 'mediawiki.util'], function () {
    $(function () {
        var title = mw.config.get('wgPageName');
        var namespace = mw.config.get('wgNamespaceNumber');
        var articleId = mw.config.get('wgArticleId');
        // Exclusions
        if (
            namespace === -1 || // Special
            namespace === 8 ||  // MediaWiki
            namespace === 14 || // Category
            title === 'Accueil' ||
            title === 'Modèle:CommentairesDynamiques'
        ) {
            return; // N’ajoute rien sur ces pages
        }
        // Créer un conteneur à la fin du contenu
        var $commentContainer = $('<div id="zone-commentaires"><h3>Commentaires</h3><p>Chargement…</p></div>');
        $('#mw-content-text').append($commentContainer);
        // Appel direct à l’API commentlist
        new mw.Api().get({
            action: 'commentlist',
            format: 'json',
            pageID: articleId,
            order: 1,
            pagerPage: 1,
            showForm: 1
        }).done(function (data) {
            if (data && data.commentlist && data.commentlist.html) {
                $commentContainer.html('<h3>Commentaires</h3>' + data.commentlist.html);
            }
        }).fail(function () {
            $commentContainer.html('<p>Erreur lors du chargement des commentaires.</p>');
        });
    });
});*/

Version du 13 mai 2025 à 11:07

/* Tout JavaScript présent ici sera exécuté par tous les utilisateurs à chaque chargement de page. */
var userID = mw.config.get("wgUserId");
if(userID == null){
	// Suppression du bouton "Nouveau"
	var xpathExpression = "/html/body/div[2]/nav/div/div[3]/ul/li[2]/div";
	// Use document.evaluate to find the element
	var result = document.evaluate(xpathExpression, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
	// Check if an element was found
	if (result.singleNodeValue) {
	    // Remove the element from the DOM
	    result.singleNodeValue.remove();
	}
	// Suppression du bouton "Roue dentée"
	var xpathExpression2 = "/html/body/div[2]/nav/div/div[3]/ul/li[3]";
	var result = document.evaluate(xpathExpression2, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
	if (result.singleNodeValue) {
	    // Remove the element from the DOM
	    result.singleNodeValue.remove();
	}
}
if(window.location.href.includes("Contact")){
	document.getElementById("ooui-php-5").rows = 6; 
}
if(window.location.href.includes("Cat%C3%A9gorie:19") || window.location.href.includes("Cat%C3%A9gorie:20")){
	document.getElementById("mw-pages").innerHTML = ""; 
}