User:DodoMan/adminmenu.js: Difference between revisions
Jump to navigation
Jump to search
m Justarandomamerican moved page User:Rafdodo/adminmenu.js to User:DodoMan/adminmenu.js: Automatically moved page while renaming the user "Rafdodo" to "DodoMan" |
m FuzzyBot moved page User:DodoMan~usurped/adminmenu.js to User:DodoMan/adminmenu.js: Part of translatable page "User:DodoMan~usurped" |
(One intermediate revision by one other user not shown) | |
(No difference)
|
Latest revision as of 12:56, 2 April 2024
/**
*
* Fonction get
*
**/
function getHTTPObject() {
var xmlhttp = false;
/* on essaie de créer l'objet si ce n'est pas déjà fait */
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false;
}
}
return xmlhttp;
}
/**
*
* Affiche un nouveau Menu à gauche avec quelques liens pratiques
* Toutes modifications devraient se faire sur la page du menu
*
**/
function AddMenuAdmin() {
var contenu = 'Erreur d\'affichage';
var HTTPMenu = new getHTTPObject();
if (HTTPMenu) {// requête au serveur
HTTPMenu.open('GET', mw.config.get('wgServer')+'/wiki/MediaWiki:Gadget-MenuAdmin/Menu?action=render', true);
HTTPMenu.onreadystatechange = function () {
if (HTTPMenu.readyState == 4) {
var reponse = HTTPMenu.responseText;
var deb = '<div id="OuvreMenu"></div>';
var ideb = reponse.indexOf(deb)+deb.length;
var fin = '<div id="FermeMenu"></div>';
var ifin = reponse.indexOf(fin);
contenu = reponse.substring(ideb,ifin);
if (mw.config.get('skin') == "monobook"){
var l = document.getElementById("column-one");
if (l) {
l.innerHTML = '<div class="portlet" id="p-MenuAdmin">'
+ '<h3>Menu Admin</h3><div class="pBody">'
+ contenu
+ '</div></div>'
+ l.innerHTML;
}
var menu_class = "";
} else if (mw.config.get('skin') == "vector"){
var l= document.getElementById("p-Navigation");
if (l) {
l.insertAdjacentHTML('afterend', '<nav id="p-MenuAdmin" class="vector-menu mw-portlet mw-portlet-Aide vector-menu-portal portal" aria-labelledby="p-MenuAdmin-label" role="navigation">'
+ '<h3 id="p-MenuAdmin-label" class="vector-menu-heading"><span class="vector-menu-heading-label">Menu Admin</span></h3>'
+ '<div class="vector-menu-content">'
+ contenu
+ '</div></nav>');
}
} else if (mw.config.get('skin') == "vector-2022"){
var l= document.getElementById("p-Navigation");
if (l) {
l.insertAdjacentHTML('afterend', '<nav id="p-MenuAdmin" class="vector-menu mw-portlet mw-portlet-Aide vector-menu-portal portal" aria-labelledby="p-MenuAdmin-label" role="navigation">'
+ '<h3 id="p-MenuAdmin-label" class="vector-menu-heading"><span class="vector-menu-heading-label">Menu Admin</span></h3>'
+ '<div class="vector-menu-content">'
+ contenu
+ '</div></nav>');
}
} else if (mw.config.get('skin') == "timeless"){
var l= document.getElementById("p-userpagetools");
if (l) {
l.insertAdjacentHTML('afterend', '<div class="mw-portlet" role="navigation" id="p-MenuAdmin" aria-labelledby="p-MenuAdmin-label">'
+ '<h3 id="p-MenuAdmin-label" dir="ltr" lang="fr">Menu Admin</h3>'
+ '<div class="mw-portlet-body">'
+ contenu
+ '</div></div>');
}
}
}
}// fin gestion onreadystatechange
HTTPMenu.send(null);
}
}
$(AddMenuAdmin);