User:Leag/resume.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Leag/resume. |
// Résumé Deluxe
// Fonction ResumeDeluxeModif
// Code : Dake
function ResumeDeluxeModif(content) {
if (document.editform.wpSummary.value != 0) {
document.editform.wpSummary.value+=' - ';
}
document.editform.wpSummary.value+=content;
}
function ResumeDeluxe() {
// vous pouvez ajouter vos messages ci-dessous - attention aux apostrophes et aux
// guillemets qui peuvent casser le script
var messages = new Array()
var labelBoutons = new Array()
var ca = 0;
messages[ca] = "Orthographe";
labelBoutons[ca++] = "ortho";
messages[ca] = "Categories";
labelBoutons[ca++] = "cat";
messages[ca] = "Wikification";
labelBoutons[ca++] = "wiki";
messages[ca] = "Wiki Link";
labelBoutons[ca++] = "lien";
messages[ca] = "Interwiki";
labelBoutons[ca++] = "interwiki";
messages[ca] = "Add stub";
labelBoutons[ca++] = "+ ébauche";
messages[ca] = "Remove stub";
labelBoutons[ca++] = "- ébauche";
messages[ca] = "Add portal";
labelBoutons[ca++] = "+ portail";
messages[ca++] = "Ludobox";
labelBoutons[ca++] = "ludobox";
messages[ca] = "Add image";
labelBoutons[ca++] = "+ image";
messages[ca] = "Revert";
labelBoutons[ca++] = "revert";
var nombreBoutonsParLigne = 12;
// ne rien toucher ci-dessous
var mainNode = document.getElementById("wpSummaryLabel");
if (!mainNode) {
return;
}
var summaryNode = mainNode;
var formButtons = document.createElement("form");
for (var i=0;i<messages.length;i++) {
if (i%nombreBoutonsParLigne==0) {
formButtons.appendChild(document.createElement("p"));
}
var nodeInput = document.createElement("input");
nodeInput.setAttribute("type", "button");
nodeInput.setAttribute("value", labelBoutons[i]);
nodeInput.setAttribute("onClick", "ResumeDeluxeModif('" + messages[i] + "')");
formButtons.appendChild(nodeInput);
}
summaryNode.appendChild(formButtons);
}
$(ResumeDeluxe);