Utilisateur:Boréal/monobook.js
Note : après avoir enregistré la page, vous devrez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
Mozilla / Firefox / Konqueror / Safari : maintenez la touche Majuscule (Shift) en cliquant sur le bouton Actualiser (Reload) ou pressez Maj-Ctrl-R (Cmd-R sur Apple Mac) ;
Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5./* <pre><nowiki> */
//fonction pour historique en couleur (deux prochains blocs)
document.write('<script type="text/javascript" src="'
+ 'http://fr.wikipedia.org/w/index.php?title=Utilisateur:GôTô/objects.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
document.write('<script type="text/javascript" src="'
+ 'http://fr.wikipedia.org/w/index.php?title=Utilisateur:Dake/monobook.js/deluxehistory.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
function addArticleTrafficStatistics()
{
var histo = document.getElementById("ca-history");
if(histo)
{
var lien = document.createElement("a");
var today = new Date();
var annee = today.getYear() + 1900;
var mois = new String(today.getMonth() + 1);
if(mois.length < 2)
{
mois = "0" + mois;
}
lien.setAttribute("href", "http://stats.grok.se/fr/" + annee + mois + "/" + mw.config.get('wgPageName'));
lien.appendChild(document.createTextNode("Consultation"));
var stats = document.createElement("li");
stats.setAttribute("id", "ca-stats");
stats.appendChild(lien);
histo.parentNode.insertBefore(stats, histo.nextSibling);
}
}
$(addArticleTrafficStatistics);
obtenir("FusionContribs");
obtenir("GoogleSearch");
obtenir("EditZeroth");
obtenir("BlocageDeluxe");
function addToSummary(str)
{
document.editform.wpSummary.value += " " + str
}
function DeluxeSummary()
{
var sumLbl = document.getElementById("wpSummaryLabel")
if (sumLbl)
{
//élargissement boite de résumé
var sumInput = document.getElementById("wpSummary")
sumInput.style.width = "90%"
var titles = new Array()
titles.push("ébauche")
titles.push("cat")
titles.push("interwiki")
titles.push("Vote")
titles.push("image(s)")
titles.push("lien ext")
titles.push("lien int")
titles.push("bienvenue")
titles.push("MePage")
titles.push("ortho/gram")
titles.push("retouches")
titles.push("ajInfo")
titles.push("avert")
titles.push("vandale")
titles.push("PàS traitée")
titles.push("Discuss")
titles.push("Traité")
titles.push("Lien ext inadequat")
titles.push("Redir")
titles.push("Éval")
var inputs = new Array()
inputs.push("{{ébauche}}")
inputs.push("catégorie")
inputs.push("liens interwiki")
inputs.push("Vote/Avis")
inputs.push("image(s)")
inputs.push("lien externe")
inputs.push("lien interne")
inputs.push("Bienvenue!")
inputs.push("mise en page")
inputs.push("correction orthographe/grammaire")
inputs.push("Retouche(s)")
inputs.push("ajout d’infos")
inputs.push("Avertissement")
inputs.push("Vandalisme")
inputs.push("Page listée sur PàS - traitée")
inputs.push("Discussion")
inputs.push("Traité")
inputs.push("Lien externe inadéquat (voir [[WP:LE]])")
inputs.push("Redirect")
inputs.push("Évaluation des articles")
var str = ""
for (var cpt = 0; cpt < titles.length; cpt ++)
{
str += "<a href=\"javascript:addToSummary('" + inputs[cpt] + "')\""
+ " class=\"sumLink\" title=\"Ajouter '" + inputs[cpt] +"' dans la boîte de résumé\">"
+ titles[cpt]
+ " ·</a> "
}
sumLbl.innerHTML = str + "<br />" + sumLbl.innerHTML
}
}
$(DeluxeSummary);
function insertAfter(parent, node, referenceNode) {
parent.insertBefore(node, referenceNode.nextSibling);
}
function OptimizedSuivi()
{
if (document.URL.indexOf("http://fr.wikipedia.org/wiki/Special:Watchlist")==0 ||
document.URL.indexOf("http://fr.wikipedia.org/w/index.php?title=Special:Watchlist")==0 ){
var allDays = document.getElementsByTagName("ul");
for (i=0; i<allDays.length; i++) {
if (allDays[i].getAttribute("class") == "special") {
var artList = allDays[i].getElementsByTagName("li");
for (j=0; j<artList.length; j++) {
var elem = artList[j];
var aTag = elem.getElementsByTagName("a");
var articleName = aTag[0].getAttribute("title");
var stopWatch = "/w/index.php?title=" + articleName + "&action=unwatch"
var newElement = document.createElement("a");
newElement.setAttribute("href",stopWatch);
var newText = document.createTextNode("stop");
newElement.appendChild(newText);
var newPar = document.createTextNode(") (")
// séparation des cas (nouvel article, ou déjà existant)
if (aTag[0].childNodes[0].data == "diff") {
insertAfter(elem, newPar, aTag[1]);
} else {
insertAfter(elem, newPar, aTag[0]);
}
insertAfter(elem, newElement, newPar);
}
}
}
}
}
$(OptimizedSuivi);
// la fonction insertAfter n'est à copier que si elle n'est pas encore présente dans le monobook.js
function insertAfter(parent, node, referenceNode) {
parent.insertBefore(node, referenceNode.nextSibling);
}
function SuppressionDeluxe() {
if (document.title.indexOf("Confirmer la suppression")!=0) return;
var mainNode = document.getElementsByTagName("form");
var firstForm = mainNode[0];
// vous pouvez ajouter vos messages ci-dessous
var messages = new Array()
messages[0] = "Suite vote sur [[Wikipédia:Pages à supprimer]]";
messages[1] = "Image sans licence";
messages[2] = "Violation de copyright";
messages[3] = "Publicité ou autopromotion";
messages[4] = "Vandalisme";
messages[5] = "Essai de débutant";
messages[6] = "Redirect orphelin";
messages[7] = "Supprimé à la demande de son auteur";
messages[8] = "Traduction automatique";
messages[9] = "Contrevient aux règles de nommage";
var table = document.createElement("table");
var tr = document.createElement("tr");
table.appendChild(tr);
// normalement, pas besoin de toucher à partir d'ici
if (firstForm.getAttribute("id")=="deleteconfirm") {
actionDelete = firstForm.getAttribute("action");
var inputs = firstForm.getElementsByTagName("input");
var token = inputs[2].getAttribute("value");
for (var i=0;i<messages.length;i++) {
if (i%4==0) {
tr = document.createElement("tr");
table.appendChild(tr);
}
var formElement = document.createElement("form");
formElement.setAttribute("id", "deleteconfirm");
formElement.setAttribute("method", "post");
formElement.setAttribute("action", actionDelete);
var inputReason = document.createElement("input");
inputReason.setAttribute("name", "wpReason");
inputReason.setAttribute("value", messages[i]);
inputReason.setAttribute("type", "hidden");
var inputConfirm = document.createElement("input");
inputConfirm.setAttribute("name", "wpConfirmB");
inputConfirm.setAttribute("value", messages[i]);
inputConfirm.setAttribute("type", "submit");
var inputToken = document.createElement("input");
inputToken.setAttribute("name", "wpEditToken");
inputToken.setAttribute("value", token);
inputToken.setAttribute("type", "hidden");
formElement.appendChild(inputReason);
formElement.appendChild(inputConfirm);
formElement.appendChild(inputToken);
var td = document.createElement("td");
td.appendChild(formElement);
tr.appendChild(td);
}
var separation = document.createElement("p");
separation.appendChild(document.createElement("hr"));
insertAfter(firstForm.parentNode, separation, firstForm);
insertAfter(firstForm.parentNode, table, separation);
}
}
$(SuppressionDeluxe);
function OptimizedShortPages() {
if (document.URL.indexOf("http://fr.wikipedia.org/wiki/Special:Shortpages")!=0) return;
var mainNode = document.getElementsByTagName("ol");
var allArticles = mainNode[0].getElementsByTagName("li");
for (i=0; i<allArticles.length; i++) {
var articleName = allArticles[i].childNodes[0].getAttribute("title");
var historyElement = document.createElement("a");
var histUrl = "/w/index.php?title=" + articleName + "&action=history"
historyElement.setAttribute("href", histUrl);
var historyText = document.createTextNode("… (hist) ");
historyElement.appendChild(historyText);
insertAfter(allArticles[i], historyElement, allArticles[i].childNodes[1]);
var relatedElement = document.createElement("a");
var relatedUrl = "/wiki/Special:Whatlinkshere/" + articleName
relatedElement.setAttribute("href", relatedUrl);
var relatedText = document.createTextNode(" (liens) ");
relatedElement.appendChild(relatedText);
var diffElement = document.createElement("a");
var diffUrl = "/w/index.php?title=" + articleName + "&diff=0"
diffElement.setAttribute("href", diffUrl);
var diffText = document.createTextNode(" (diff) ");
diffElement.appendChild(diffText);
insertAfter(allArticles[i], relatedElement, historyElement);
insertAfter(allArticles[i], diffElement, relatedElement);
insertAfter(allArticles[i], document.createTextNode(allArticles[i].childNodes[1].data), diffElement);
allArticles[i].removeChild(allArticles[i].childNodes[1]);
}
}
$(OptimizedShortPages);
/*
* UndeleteSelectAll : Tout sélectionner ou déselectionner pour la restauration d'une page
*/
function UndeleteSelectAll()
{
if (document.title.indexOf("Voir et restaurer la page effacée - Wikipédia")!=0) return;
var title2 = document.getElementsByTagName("h2");
var all = document.createElement("input");
all.setAttribute("type", "checkbox");
all.setAttribute("onchange", "selectAll(this.checked)");
all.setAttribute("title", "Sélectionner/Désélectionner tous");
if (title2.length > 1)
title2[1].appendChild(all);
else
title2[0].appendChild(all);
all.click();
}
function selectAll(bool)
{
var inputs = document.getElementsByTagName("input");
for (var cpt = 0 ; cpt < inputs.length ; cpt++)
{
inputs[cpt].checked = bool;
}
}
$(UndeleteSelectAll);
/********* List de suivi: tri par espace de nom ******************************************/
function sortWatchlistByNamespace() {
if (unescape(window.location.href).indexOf("Spécial:Liste_de_suivi") > 0) {
var h4s = document.getElementsByTagName("h4");
for (var cpt1 = 0 ; cpt1 < h4s.length ; cpt1++) {
//h4s[cpt1].style.display = "none";
if (h4s[cpt1].nextSibling.nextSibling.nodeName.toLowerCase() == "ul") {
h4s[cpt1].nextSibling.nextSibling.style.display = "none";
var lis = h4s[cpt1].nextSibling.nextSibling.getElementsByTagName("li");
createSubSections(h4s[cpt1]);
for (var cpt2 = 0 ; cpt2 < lis.length ; cpt2++) {
//we don't know which link to check :(
var as = lis[cpt2].getElementsByTagName("a");
var link;
if (as[1].innerHTML == "hist" || as[1].innerHTML == "stop") {
if(as[2].innerHTML == "stop") {
link = as[3].innerHTML;
} else {
link = as[2].innerHTML;
}
} else {
link = as[1].innerHTML;
}
//get the namespace
var space = "Espace encyclopédique";
if (link.indexOf(":") > 0 && link.indexOf("Discuter:") < 0) {
switch(link.split(":")[0]) {
case "Utilisateur":
case "Discussion Utilisateur": space = "Espace utilisateur"; break;
case "Wikipédia":
case "Discussion Wikipédia": space = "Espace wikipédia"; break;
case "Aide":
case "Discussion Aide": space = "Espace aide"; break;
case "Modèle":
case "Discussion Modèle": space = "Espace modèle"; break;
case "Image":
case "Discussion Image": space = "Espace image"; break;
case "Catégorie":
case "Discussion Catégorie": space = "Espace catégorie"; break;
case "MediaWiki":
case "Discussion MediaWiki": space = "Espace mediawiki"; break;
case "Projet":
case "Discussion Projet": space = "Espace projet"; break;
case "Portail":
case "Discussion Portail": space = "Espace portail"; break;
case "Référence":
case "Discussion Référence": space = "Espace référence"; break;
}
}
var h5 = document.getElementById("h5" + encodeURI(h4s[cpt1].innerHTML) + encodeURI(space));
var ul = document.getElementById("ul" + encodeURI(h4s[cpt1].innerHTML) + encodeURI(space));
ul.appendChild(lis[cpt2].cloneNode(true));
ul.style.display = "block";
h5.style.display = "inline";
lis[cpt2].style.display = "none";
}
}
}
}
}
function createSubSections(h4) {
var arr = new Array("encyclopédique", "utilisateur", "wikipédia", "modèle", "aide", "mediawiki", "image", "catégorie", "projet", "portail", "référence");
var surDiv = document.createElement("div");
h4.parentNode.insertBefore(surDiv, h4.nextSibling.nextSibling);
for (var cpt = 0 ; cpt < arr.length ; cpt++) {
var h5 = document.createElement("h5");
h5.innerHTML = "Espace " + arr[cpt];
h5.id = "h5" + encodeURI(h4.innerHTML) + encodeURI(h5.innerHTML);
var div = document.createElement("div");
div.id = "div" + encodeURI(h4.innerHTML) + encodeURI(h5.innerHTML);
var ul = document.createElement("ul");
ul.className = "special";
ul.style.display = "none";
ul.id = "ul" + encodeURI(h4.innerHTML) + encodeURI(h5.innerHTML);
div.appendChild(ul);
h5.style.cursor = "pointer";
h5.style.display = "none";
h5.title = "Clique moi pour faire apparaître ou disparaître ce que je contiens";
h5.setAttribute("onclick", "javascript: var el = document.getElementById('" + ul.id + "'); el.style.display = (el.style.display == 'none' ? 'block' : 'none');");
surDiv.appendChild(h5);
surDiv.appendChild(div);
}
}
$(sortWatchlistByNamespace);
importScript('Utilisateur:Stef48/revocation.js');
// LiveRC
importScript('User:EDUCA33E/LiveRC.js');
/* </nowiki></pre> */