Utilisateur:Markadet/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.<!--
/*********************************************************
* OUTILS GÉNÉRAUX
*********************************************************/
/*
* addLoadEvent : appeler une fonction lorsque la page est chargée
*/
function addLoadEvent(func) {
if (window.addEventListener) {
window.addEventListener("load", func, false);
} else
if (window.attachEvent) {
window.attachEvent("onload", func);
}
}
/*
* insertAfter : insérer un élément dans une page
*/
function insertAfter(parent, node, referenceNode) {
parent.insertBefore(node, referenceNode.nextSibling);
}
/*********************************************************
* OUTILS À DESTINATION DE TOUS UTILISATEURS
*********************************************************/
/*
* NUPatrol : Patrouille nouveaux arrivants
*/
function NUPatrol(){
if ( window.location.href.indexOf( 'Special:Log/newusers') < 0 &&
window.location.href.indexOf( '&type=newusers' ) < 0 ) return;
var items, item, i, links, user, name, talk, contribs, insertLoc, link;
items = document.getElementById( 'bodyContent' ).getElementsByTagName( 'ul' )[ 0 ].getElementsByTagName( 'li' );
function NewLink( txt, url, plainlinks, linkColor )
{ var a = document.createElement( 'a' );
a.appendChild( document.createTextNode( txt ) );
a.href = url;
if ( plainlinks ) a.className = 'plainlinks';
if ( linkColor )
{ if ( typeof linkColor == "string" )
a.style.color = linkColor;
else a.style.color = '#FF0000'; // old default behavior
}
return a;
}
for ( i = 0; i < items.length; i++ )
{
item = items[ i ];
links = item.getElementsByTagName( 'a' );
user = links[ 0 ]; name = user.firstChild.nodeValue;
talk = links[ 2 ]; talk.firstChild.nodeValue = 'discussion'; // lowercase 'Talk' for consistency
contribs = links[ 3 ];
insertLoc = user.nextSibling; // ' newusers '
item.insertBefore( document.createTextNode( ' ( ' ), insertLoc );
item.insertBefore( talk, insertLoc );
item.insertBefore( document.createTextNode( ', ' ), insertLoc );
item.insertBefore( contribs, insertLoc );
item.insertBefore( document.createTextNode( ', ' ), insertLoc );
item.insertBefore( NewLink( 'actions', '/w/index.php?title=Special%3ALog&user=' + name, true, '#000088' ), insertLoc );
item.insertBefore( document.createTextNode( ', ' ), insertLoc );
item.insertBefore( NewLink( 'blocages', '/w/index.php?title=Special%3ALog&type=block&page=User%3A' + name, true, '#008800' ), insertLoc );
item.insertBefore( document.createTextNode( ', ' ), insertLoc );
item.insertBefore( NewLink( 'est bloqué ?', '/wiki/Special:Ipblocklist?action=search&ip=' + name, true, '#888800' ), insertLoc );
item.insertBefore( document.createTextNode( ', ' ), insertLoc );
item.insertBefore( NewLink( 'bloquer', '/w/index.php?title=Special:Blockip&ip=' + name, true, '#880000' ), insertLoc );
item.insertBefore( document.createTextNode( ' )' ), insertLoc );
item.removeChild( insertLoc.nextSibling ); // should remove the span
item.removeChild( insertLoc ); // should remove ' newusers ' text
}
}
addLoadEvent (NUPatrol);
/*
* DeluxeBar : meilleur champ d'édition
*/
function DeluxeBar() {
if (document.createTextNode) {
var toolbar = document.getElementById("toolbar");
if (!toolbar) return;
var messages = new Array()
messages[0] = "{{subst:" + "Bienvenue sur ta page" + "}}" + "~~" + "~~";
messages[1] = "{{subst:" + "Bienvenue" + "}}" + "~~" + "~~";
messages[2] = "{{subst:" + "Test 1" + "}}" + "~~" + "~~";
messages[3] = "{{subst:" + "Test 2" + "}}" + "~~" + "~~";
messages[4] = "{{subst:" + "Test 3" + "}}" + "~~" + "~~";
messages[5] = "{{subst:" + "Bienvenue spammeur" + "}}" + "~~" + "~~";
messages[6] = "{{subst:" + "VandaleBloqué|n" + "}}" + "~~" + "~~";
messages[7] = "{{" + "suppression" + "}}";
messages[8] = "<br />Bonjour,<br />Veuillez"+" adresser votre question à l'"+" [[Wikipédia:"+"Oracle|"+"Oracle]]. "+"~~"+"~~";
messages[9] = ":{{"+"fait"+"}}"+" c'est fait."+" ~~"+"~~";
var images = new Array()
images[0] = "http://upload.wikimedia.org/wikipedia/fr/1/12/Button_accueilA.png";
images[1] = "http://upload.wikimedia.org/wikipedia/fr/e/eb/Button_accueilB.png";
images[2] = "http://upload.wikimedia.org/wikipedia/fr/e/e5/Button_copyvio.png";
images[3] = "http://upload.wikimedia.org/wikipedia/fr/0/00/Button_vandale.png";
images[4] = "http://upload.wikimedia.org/wikipedia/fr/0/00/Button_vandale.png";
images[5] = "http://upload.wikimedia.org/wikipedia/fr/f/fb/Button_spam2.png";
images[6] = "http://upload.wikimedia.org/wikipedia/fr/0/00/Button_vandale.png";
images[7] = "http://upload.wikimedia.org/wikipedia/fr/f/f8/Button_suppr.png";
images[8] = "http://upload.wikimedia.org/wikipedia/fr/d/d9/Button_trait%C3%A9.png";
images[9] = "http://upload.wikimedia.org/wikipedia/fr/6/67/Button_%C3%A9clair.png";
var commentaires = new Array()
commentaires[0] = "Bienvenue sur ta page !";
commentaires[1] = "Bienvenue !";
commentaires[2] = "avertissement 1er niveau";
commentaires[3] = "avertissement 2e niveau";
commentaires[4] = "avertissement 3e niveau" ;
commentaires[5] = "avertissement spammeur";
commentaires[6] = "avis de blocage" ;
commentaires[7] = "Proposé à la suppression";
commentaires[8] = "Redirection vers Oracle";
commentaires[9] = "Fait";
////////////////////////////////
for (var i=0;i<messages.length;i++) {
var img = document.createElement("img");
img.setAttribute("src", images[i]);
img.setAttribute("alt", commentaires[i]);
var ref = document.createElement("a");
ref.setAttribute("href", "javascript:insertTags('', \"" + messages[i] + "\", '');" +
"javascript:changeSummary(\"" + commentaires[i] + "\");" );
ref.appendChild(img);
toolbar.appendChild(ref);
}
}
}
function changeSummary(sampleText) {
document.editform.wpSummary.value = sampleText;
}
addLoadEvent(DeluxeBar);
/*
* OptimizedShortPages : rajout de fonctionnalités dans [[Special:Shortpages]]
*/
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]);
}
}
addLoadEvent(OptimizedShortPages);
/*
* Bistro_Oracle, PaS_PaF_CSS_JS, Vandalisme : Ajout de liens dans la barre de navigation vers des pages souvent consultées
*/
function Bistro_Oracle() {
var a = document.getElementById("p-navigation");
if (a) {
b = a.getElementsByTagName("ul");
if(b.length > 0) {
b[0].innerHTML = b[0].innerHTML + '<li><a style="display: inline" id="n-bistro" title="Wikipédia:Le Bistro" href="/w/index.php?title=Wikip%C3%A9dia:Le_Bistro&action=purge">Bistro</a>, <a style="display: inline" id="n-bistro" title="Oracle" href="/wiki/Wikipédia:Oracle">Oracle</a></li>'
}
}
}
addLoadEvent(Bistro_Oracle);
function PaS_PaF_CSS_JS() {
var a = document.getElementById("p-navigation");
if (a) {
b = a.getElementsByTagName("ul");
if(b.length > 0) {
b[0].innerHTML = b[0].innerHTML + '<li><a style="display: inline" id="n-pas" title="Wikipédia:Pages à supprimer" href="/w/index.php?title=Wikip%E9dia:Pages%20%E0%20supprimer&action=purge">PàS</a>, <a style="display: inline" id="n-NewPages" title="Nouvelles pages" href="/wiki/Special:Newpages">Newpages</a></li>'
}
}
}
addLoadEvent(PaS_PaF_CSS_JS);
function Vandalisme() {
var a = document.getElementById("p-navigation");
if (a) {
b = a.getElementsByTagName("ul");
if(b.length > 0) {
b[0].innerHTML = b[0].innerHTML + '<li><a style="display: inline" id="n-vand" title="Wikipédia:Vandalisme en cours"href="/wiki/Wikipédia:Vandalisme_en_cours/Alertes_en_cours">Vandalisme</a>, <a style="display: inline" id="n-vand" title="Liste de blocage"href="/wiki/Special:ipblocklist">ListeB</a></li>' ;
}
}
}
addLoadEvent(Vandalisme);
/*
* CategoryTree : Arborescence de catégories
*/
function CategoryTree() {
// Auteur : Anakin, version du 11 décembre 2005
var element = document.getElementById('ca-nstab-category');
if (element) {
var categoryname = element.firstChild.href;
categoryname = categoryname.substring(7);
var wikiname = categoryname.substring(0, categoryname.indexOf('.'));
var indexofname = categoryname.indexOf(":") + 1;
categoryname = categoryname.substring(indexofname);
var indexofampercent = categoryname.indexOf("&");
if (indexofampercent != -1)
categoryname = categoryname.substring(0, indexofampercent);
var li = document.createElement('li');
li.id = 'ca-categorytree';
var a = document.createElement('a');
a.appendChild(document.createTextNode("Arborescence"));
a.href = 'http://tools.wikimedia.de/~daniel/WikiSense/CategoryTree.php?wiki=' + wikiname + '&art=on&cat=' + categoryname;
li.appendChild(a);
document.getElementById('ca-nstab-category').parentNode.appendChild(li);
}
}
addLoadEvent(CategoryTree);
/*
* OngletPurge : Onglet pour purger le cache
*/
function OngletPurge() {
var a = document.getElementById("p-cactions");
if (a) {
var pageName = document.title.replace(" - Wikipédia", "");
b = a.getElementsByTagName("ul");
if(b.length > 0) {
b[0].innerHTML = b[0].innerHTML + '<li id="ca-nstab-user">' + '<a href="/w/index.php?action=purge&title=' + pageName + '">purger</a>' + '</li>';
}
}
}
addLoadEvent(OngletPurge);
/*********************************************************
* OUTILS À DESTINATION DES ADMINISTRATEURS
*********************************************************/
/*
* SuppressionDeluxe : Rajout de boutons de motif de suppression
*/
function SuppressionDeluxe() {
if (document.title.indexOf("Confirmer la suppression - Wikipédia")!=0) return;
var mainNode = document.getElementsByTagName("form");
var firstForm = mainNode[0];
var messages = new Array()
messages[0] = "Non contextualisé, incompréhensible";
messages[1] = "Image sans licence";
messages[2] = "Violation de copyright";
messages[3] = "Publicité ou autopromotion";
messages[4] = "Vandalisme";
messages[5] = "Babil de débutant";
messages[6] = "Redirection vers une page inexistante";
messages[7] = "Supprimé à la demande de son auteur";
messages[8] = "Traduction automatique";
messages[9] = "Demande sur [[WP:SI]]";
messages[10] = "Suite à décision prise sur [[WP:PàS]]";
messages[11] = "Propos blessants ou insultes";
messages[12] = "Spam";
messages[13] = "Bac à sable";
messages[14] = "[[Wikipédia:Critères d'admissibilité des articles|Hors critères]]";
var table = document.createElement("table");
var tr = document.createElement("tr");
table.appendChild(tr);
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%3==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);
}
}
addLoadEvent(SuppressionDeluxe)
/*
* übergodmode Monobook skin
* codé par Sam Hocevar ; recopié ici pour désengorger son site
* http://sam.zoy.org/wikipedia
* Rajout d'un lien direct pour bloquer un utilisateur
*/
var blocklink = 'Block this user';
switch (document.getElementsByTagName('html')[0].lang) {
case 'fr':
blocklink = 'Bloquer cet utilisateur';
break;
}
function PerformBlock() {
var l, target = '';
// Look for '&faketarget=XXX' in URL
url = location.pathname;
l = location.search.substring(1).split('&');
for (i = 0; i < l.length; i++) {
var n = l[i].indexOf('=');
if (l[i].substring(0, n) == 'faketarget') {
target = l[i].substring(n + 1);
}
}
if (!target)
return;
form = document.getElementById('blockip');
if (!form)
return;
input = form.getElementsByTagName('input')[0];
input.value = target;
}
function AddBlockButtons() {
var l, article = '', vandal;
// Add 'block' links to a diff page
l = document.getElementById('t-emailuser');
if (l) {
clone = l.cloneNode(true);
l.id = 't-blockuser';
a = clone.getElementsByTagName('a')[0];
a.href = a.href.replace(/Special:Emailuser/, 'Special:Blockip');
a.href = a.href.replace(/target=/, 'faketarget=');
a.innerHTML = blocklink;
l.parentNode.insertBefore(clone, l.nextSibling);
}
}
if (window.addEventListener) {
window.addEventListener("load", PerformBlock, false);
window.addEventListener("load", AddBlockButtons, false);
} else if (window.attachEvent) {
window.attachEvent("onload", PerformBlock);
window.attachEvent("onload", AddBlockButtons);
}
/*
* BlocageDeluxe : Rajout de boutons prédéfinis pour justifier un blocage
*/
function BlocageDeluxe() {
if (document.title.indexOf("Bloquer le compte - Wikipédia")!=0) return;
var mainNode = document.getElementsByTagName("form");
var firstForm = mainNode[0];
var messages = new Array()
messages[0] = "Vandalismes divers";
messages[1] = "Suite à décision du comité d'arbitrage";
messages[2] = "Malgré plusieurs avertissements";
messages[3] = "Récidiviste";
messages[4] = "Identifiant à caractère injurieux";
messages[5] = "Robot fou";
messages[6] = "Spammeur";
var duree = new Array()
duree[0] = "6 hours";
duree[1] = "1 month";
duree[2] = "3 days";
duree[3] = "10 days";
duree[4] = "infinite";
duree[5] = "infinite";
duree[6] = "2 hours";
var table = document.createElement("table");
var tr = document.createElement("tr");
table.appendChild(tr);
if (firstForm.getAttribute("id")=="blockip") {
actionBlock = firstForm.getAttribute("action");
var inputs = firstForm.getElementsByTagName("input");
var token = inputs[4].getAttribute("value");
var lePauvre = inputs[0].getAttribute("value");
for (var i=0;i<messages.length;i++) {
// if (i%3==0) {
tr = document.createElement("tr");
table.appendChild(tr);
// }
var formElement = document.createElement("form");
formElement.setAttribute("id", "blockip");
formElement.setAttribute("method", "post");
formElement.setAttribute("action", actionBlock);
var inputReason = document.createElement("input");
inputReason.setAttribute("name", "wpBlockReason");
inputReason.setAttribute("value", messages[i]);
inputReason.setAttribute("type", "hidden");
var dureeC = document.createElement("input");
dureeC.setAttribute("name", "wpBlockExpiry");
dureeC.setAttribute("value", "other");
dureeC.setAttribute("type", "hidden");
var dureeC2 = document.createElement("input");
dureeC2.setAttribute("name", "wpBlockOther");
dureeC2.setAttribute("value", duree[i]);
dureeC2.setAttribute("type", "text");
var inputConfirm = document.createElement("input");
inputConfirm.setAttribute("name", "wpBlock");
inputConfirm.setAttribute("value", messages[i]);
inputConfirm.setAttribute("type", "submit");
var ident = document.createElement("input");
ident.setAttribute("name", "wpBlockAddress");
ident.setAttribute("value", lePauvre);
ident.setAttribute("type", "hidden");
var inputToken = document.createElement("input");
inputToken.setAttribute("name", "wpEditToken");
inputToken.setAttribute("value", token);
inputToken.setAttribute("type", "hidden");
formElement.appendChild(inputReason);
formElement.appendChild(dureeC);
formElement.appendChild(dureeC2);
formElement.appendChild(inputConfirm);
formElement.appendChild(inputToken);
formElement.appendChild(ident);
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);
}
}
addLoadEvent(BlocageDeluxe)
/*
* UndeleteSelectAll : Tout sélectionner ou déselectionner pour la restauration d'une page
*/
function UndeleteSelectAll()
{
if (getArticleName() == "Voir et restaurer la page effacée")
{
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
}
}
addLoadEvent(UndeleteSelectAll)
-->