« Draky/monobook.js » : différence entre les versions
De Wikimanche
(test avec du JS :)) |
Aucun résumé des modifications |
||
Ligne 1 : | Ligne 1 : | ||
// | /** | ||
* Facilite la maintenance des images ; notamment l'avertissement des utilisateurs. | |||
*/ | |||
function addCopyPasteImageWarningPanel() { | |||
source = document.getElementById('bandeau-source-inconnue') != null; | |||
licence = document.getElementById('bandeau-licence-inconnue') != null; | |||
permission = document.getElementById('bandeau-permission-inconnue') != null; | |||
if (!source && !licence && !permission) return; | |||
panel = document.createElement('DIV'); | |||
panel.setAttribute("style", "margin:0 auto 0 auto; background-color:#FFE5E5; border:1px solid #FF6060; padding:5px; text-align:left;"); | |||
if (source) { | |||
text = "{"+"{subst:Avertissement source inconnue|" + wgPageName + "}} ~~"+"~~" | |||
panel.appendChild(document.createTextNode(text)) | |||
} | |||
if (licence) { | |||
if (source) panel.appendChild(document.createElement('BR')) | |||
text = "{"+"{subst:Avertissement licence inconnue|" + wgPageName + "}} ~~"+"~~" | |||
panel.appendChild(document.createTextNode(text)) | |||
} | |||
if (permission) { | |||
if (source || licence) panel.appendChild(document.createElement('BR')) | |||
text = "{"+"{subst:Avertissement permission inconnue|" + wgPageName + "}} ~~"+"~~" | |||
panel.appendChild(document.createTextNode(text)) | |||
} | |||
prev = document.getElementById('filetoc') | |||
prev.parentNode.insertBefore(panel, prev); | |||
} | |||
if (wgNamespaceNumber == 6) { | |||
addOnloadHook(addCopyPasteImageWarningPanel); | |||
} | |||
// | /** | ||
/ | * '''Restauration Deluxe''' | ||
* | |||
* Cocher/Décocher rapidement les cases pour restaurer un article | |||
* | |||
* Auteur : GôTô | |||
* Dernière révision : 11 mai 2007 | |||
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]] | |||
*/ | |||
function UndeleteSelectAll() | |||
{ | |||
if(wgCanonicalSpecialPageName != 'Undelete') return; | |||
var title2 = document.getElementsByTagName('h2'); | |||
var all = document.createElement('input'); | |||
all.setAttribute('type', 'checkbox'); | |||
all.setAttribute('onclick', 'SelectAllInputs(this.checked)'); | |||
all.setAttribute('title', 'Sélectionner/Désélectionner tous'); | |||
title2[title2.length-1].appendChild(all); | |||
all.click(); | |||
} | |||
function SelectAllInputs(bool) | |||
{ | |||
var inputs = document.getElementById('undelete').getElementsByTagName('input'); | |||
for (var cpt = 0 ; cpt < inputs.length ; cpt++) | |||
{ | |||
inputs[cpt].checked = bool; | |||
} | |||
} | |||
addOnloadHook(UndeleteSelectAll); | |||
// [[ | /* | ||
* Protection à la création | |||
* | |||
* Permet aux administrateurs de protéger automatiquement la recréation d'une page | |||
* en l'ajoutant à [[Wikipédia:Pages protégées à la création|WP:PPC]] lors de la confirmation de suppression | |||
* | |||
* Auteur : Seb35 | |||
* Date de dernière révision : 6 septembre 2007 | |||
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]] | |||
*/ | |||
function protectCreation() { | |||
if (!document.getElementById('deleteconfirm')) return; | |||
var td = document.getElementById('wpWatch').parentNode; | |||
td.appendChild(document.createElement('br')); | |||
var label = document.createElement('label'); | |||
var input = document.createElement('input'); | |||
input.setAttribute('name', 'wpProtectCreation'); | |||
input.setAttribute('type', 'checkbox'); | |||
input.setAttribute('id', 'wpProtectCreation'); | |||
input.setAttribute('tabindex', '3'); | |||
label.appendChild(input); | |||
label.appendChild(document.createTextNode(' Protéger cette page de la recréation (')); | |||
var lien = document.createElement('a'); | |||
lien.setAttribute('href', 'http://fr.wikipedia.org/wiki/Wikipédia:Bulletin_des_administrateurs/2007/Semaine_52#Protection_.C3.A0_la_cr.C3.A9ation_activ.C3.A9e'); | |||
lien.appendChild(document.createTextNode('[1]')); | |||
label.appendChild(lien); | |||
label.appendChild(document.createTextNode(',')); | |||
lien = document.createElement('a'); | |||
lien.setAttribute('href', 'http://fr.wikipedia.org/wiki/Wikipédia:Bulletin_des_administrateurs/2008/Semaine_5#blocage_d.27utilisateur_.2F_WP:PPC'); | |||
lien.appendChild(document.createTextNode('[2]')); | |||
label.appendChild(lien); | |||
label.appendChild(document.createTextNode(')')); | |||
td.appendChild(label); | |||
document.getElementById('wpConfirmB').setAttribute('tabindex', '4'); | |||
document.getElementById('wpConfirmB').setAttribute('onclick', 'protectCreationExec();'); | |||
} | |||
if(wgAction == 'delete') addOnloadHook(protectCreation); | |||
if(document.URL.indexOf('protectcreation=') != -1) addOnloadHook(protectCreationWindow); | |||
function protectCreationExec() { | |||
if(!document.getElementById('wpProtectCreation').checked) return; | |||
var d = new Array('Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'); | |||
var hui = new Date(); | |||
var adresse = new String('http://fr.wikipedia.org/w/index.php?title=Wikipédia:Pages_protégées_à_la_création/'+d[hui.getMonth()]+'_'+hui.getFullYear()+'&action=edit&protectcreation='+wgPageName); | |||
var fenetre = window.open(encodeURI(adresse), 'fProtectCreation', 'menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=800,height=200'); | |||
fenetre.focus(); | |||
} | |||
function protectCreationWindow() { | |||
if(wgPageName.substr(0,40) != 'Wikipédia:Pages_protégées_à_la_création/') return; | |||
window.scrollTo(0,document.documentElement.clientHeight); | |||
if(document.URL.indexOf('protectcreation=') == -1) return; | |||
var page = decodeURI(document.URL.substr(document.URL.indexOf('protectcreation=')+16).replace(/_/g, ' ')); | |||
document.editform.wpSummary.value = '+' + page; | |||
if(page.indexOf(':')!=-1) page = page.substr(page.indexOf(':')+1) + '|ns=' + page.substr(0, page.indexOf(':')); | |||
document.editform.wpTextbox1.value += '* {' + '{Titre protégé|' + page + '}}'; | |||
document.editform.wpSave.click(); | |||
} | |||
/* | |||
* Pages courtes optimisées | |||
* | |||
* Quelques liens supplémentaires dans Special:Shortpages | |||
* | |||
* Auteur : Dake | |||
* Modifications : Seb35 | |||
* Denière révision : 30 novembre 2007 | |||
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]] | |||
*/ | |||
function OptimizedShortPages() { | |||
var mainNode = document.getElementsByTagName('ol'); | |||
var allArticles = mainNode[0].getElementsByTagName('li'); | |||
for(i=0; i<allArticles.length; i++) { | |||
var histElement = allArticles[i].getElementsByTagName('a')[0]; | |||
var articleName = histElement.getAttribute('href').match(/title\=(.*)&/)[1]; | |||
var diffElement = document.createElement('a'); | |||
diffElement.setAttribute('href', '/w/index.php?title=' + articleName + '&diff=0'); | |||
diffElement.appendChild(document.createTextNode('diff')); | |||
var relatedElement = document.createElement('a'); | |||
relatedElement.setAttribute('href', '/wiki/Special:Whatlinkshere/' + articleName); | |||
relatedElement.appendChild(document.createTextNode('liens')); | |||
insertAfter(histElement.parentNode, relatedElement, histElement); | |||
insertAfter(histElement.parentNode, document.createTextNode(') ('), histElement); | |||
insertAfter(histElement.parentNode, diffElement, histElement); | |||
insertAfter(histElement.parentNode, document.createTextNode(') ('), histElement); | |||
} | |||
} | |||
if(wgCanonicalSpecialPageName == 'Shortpages') addOnloadHook(OptimizedShortPages); | |||
/* | |||
* Suppression Deluxe | |||
* | |||
* Motifs de suppression prédéfinis | |||
* Il est possible de définir des messages comportant des liens internes | |||
* | |||
* Auteurs : Dake | |||
* Modifications : IAlex, Seb35 | |||
* Date de dernière révision : 10 mai 2007 | |||
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]] | |||
*/ | |||
//////////// Zone personnalisable ////////// | |||
var suppressiondeluxeMessages = new Array(); | |||
with (suppressiondeluxeMessages) { | |||
push("Vandalisme"); | |||
push("Violation de copyright"); | |||
push("Copie de site web sans autorisation explicite"); | |||
push("Bac à sable"); | |||
push("[[Wikipédia:Pages_à_supprimer/"+wgPageName+"|Décision PàS]]"); | |||
push("Déplacement vers Commons"); | |||
push("Licence inappropriée"); | |||
push("Purge ou renommage"); | |||
push("[[Wikipédia:Critères_d'admissibilité_des_articles|Contenu promotionnel]]"); | |||
push("Diffamation ou insulte"); | |||
push("Catégorie vide"); | |||
push("Redirection cassée"); | |||
push("Non encyclopédique en l'état"); | |||
push("[[Wikipédia:Critères_d'admissibilité_des_articles|Critères d'admissibilité non atteints]]"); | |||
push("Pas en français"); | |||
push("Page blanchie par son auteur"); | |||
} | |||
//////////// Fin de la zone personnalisable ////////// | |||
function SuppressionDeluxe() { | |||
var mainForm = document.getElementById('deleteconfirm'); | |||
if(!mainForm) return; | |||
var table = document.createElement('table'); | |||
for(var i=0; i<suppressiondeluxeMessages.length; i++) { | |||
if (i%4==0) { | |||
tr = document.createElement('tr'); | |||
table.appendChild(tr); | |||
} | |||
var inputConfirm = document.createElement('input'); | |||
inputConfirm.setAttribute('value',suppressiondeluxeMessages[i].replace(/^\[\[.*\|(.*)\]\]$/, '$1')); | |||
inputConfirm.setAttribute('onclick','SuppressionResume("'+suppressiondeluxeMessages[i]+'");'); | |||
inputConfirm.setAttribute('type', 'button'); | |||
var td = document.createElement('td'); | |||
td.appendChild(inputConfirm); | |||
tr.appendChild(td); | |||
} | |||
var separation = document.createElement('p'); | |||
separation.appendChild(document.createElement('hr')); | |||
insertAfter(mainForm.parentNode, separation, mainForm); | |||
insertAfter(mainForm.parentNode, table, separation); | |||
} | |||
function SuppressionResume(sampleText) { | |||
var mainForm = document.getElementById('deleteconfirm'); | |||
mainForm.wpReason.value = sampleText; | |||
mainForm.wpConfirmB.click(); | |||
} | |||
if(wgAction == 'delete') addOnloadHook(SuppressionDeluxe); | |||
/** | |||
* Outils pour réverter | |||
* | |||
* Fournit des liens dans les pages de diff | |||
* | |||
* Auteurs : Lorian (en), Chphe (fr) | |||
* Dernière révision : 3 novembre 2006 | |||
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]] | |||
*/ | |||
//<nowiki> | |||
// _GET code from NoGray JS Library http://www.nogray.com/new_site/ | |||
var _GET = new Array(); | |||
var _uri = location.href; | |||
var _temp_get_arr = _uri.substring(_uri.indexOf('?')+1, _uri.length).split("&"); | |||
var _temp_get_arr_1 = new Array(); | |||
for(_get_arr_i=0; _get_arr_i<_temp_get_arr.length; _get_arr_i++){ | |||
_temp_get_arr_1 = _temp_get_arr[_get_arr_i].split("="); | |||
_GET[decodeURI(_temp_get_arr_1[0])] = decodeURI(_temp_get_arr_1[1]); | |||
} | |||
delete _uri; delete _temp_get_arr; delete _temp_get_arr_1; | |||
function getMessage (chemin, where, user1, user2) { | |||
var message = prompt ('Quel message faut-il laisser ?', ''); | |||
if (message) { | |||
window.location = chemin + '&'+where+'=2&user1='+user1+'&user2='+user2+'&message='+message; | |||
} | |||
} | |||
addOnloadHook(function (){ | |||
if (location.href.match(/diff=/)) { | |||
// Get username of submitter | |||
var user1 = getElementsByClass('diff-otitle',null,'td'); | |||
if(user1.length == 0) return; | |||
// Récupération du chemin vers la version à rétablir | |||
var chemin = user1[0].getElementsByTagName('a')[1].href; | |||
user1 = user1[0].getElementsByTagName('a')[2].innerHTML; | |||
var user2 = getElementsByClass('diff-ntitle',null,'td'); user2 = user2[0].getElementsByTagName('a')[2].innerHTML; | |||
if (user2 == "défaire"){ | |||
user2 = getElementsByClass('diff-ntitle',null,'td'); user2 = user2[0].getElementsByTagName('a')[3].innerHTML; | |||
} | |||
document.getElementById('contentSub').innerHTML = '(<a href="'+chemin+'&revert=1&user1='+user1+'&user2='+user2+'">Annuler</a> / <a href="javascript:var message = getMessage(\''+chemin+'\', \'revert\', \''+user1+'\', \''+user2+'\');">Message</a>) (<a href="'+chemin+'&vandalism=1&user1='+user1+'&user2='+user2+'">Vandalisme</a> / <a href="javascript:var message = getMessage(\''+chemin+'\', \'vandalism\', \''+user1+'\', \''+user2+'\');">Message</a>) (Avertir : <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=1">Test0</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=2">Test1</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=3">Test2</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=4">Test3</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=5">Bienvenue spammeur</a>)'; | |||
} else if (location.href.match(/revert=1/)) { | |||
document.getElementById('wpSummary').value = 'Révocation des modifications par [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] ; retour à la version de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']]'; | |||
document.getElementById('editform').submit(); | |||
} else if (location.href.match(/revert=2/)) { | |||
document.getElementById('wpSummary').value = 'Révocation des modifications par [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] ; retour à la version de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']] ('+_GET['message']+')'; | |||
document.getElementById('editform').submit(); | |||
} else if (location.href.match(/vandalism=1/)) { | |||
document.getElementById('wpSummary').value = 'Révocation de vandalisme par [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] ; retour à la version de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']]'; | |||
document.getElementById('editform').submit(); | |||
} else if (location.href.match(/vandalism=2/)) { | |||
document.getElementById('wpSummary').value = 'Révocation de vandalisme par [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] ; retour à la version de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']] ('+_GET['message']+')'; | |||
document.getElementById('editform').submit(); | |||
} else if (location.href.match(/warn=1/)) { | |||
document.getElementById('wpSummary').value = 'Avertissement'; | |||
document.getElementById('wpTextbox1').value = '{{sub'+'st:test0}} ~~'+'~~'; | |||
document.getElementById('editform').submit(); | |||
} else if (location.href.match(/warn=2/)) { | |||
document.getElementById('wpSummary').value = 'Avertissement'; | |||
document.getElementById('wpTextbox1').value = '{{sub'+'st:test1}} ~~'+'~~'; | |||
document.getElementById('editform').submit(); | |||
} else if (location.href.match(/warn=3/)) { | |||
document.getElementById('wpSummary').value = 'Avertissement'; | |||
document.getElementById('wpTextbox1').value = '{{sub'+'st:test2}} ~~'+'~~'; | |||
document.getElementById('editform').submit(); | |||
} else if (location.href.match(/warn=4/)) { | |||
document.getElementById('wpSummary').value = 'Avertissement'; | |||
document.getElementById('wpTextbox1').value = '{{sub'+'st:test3}} ~~'+'~~'; | |||
document.getElementById('editform').submit(); | |||
} else if (location.href.match(/warn=5/)) { | |||
document.getElementById('wpSummary').value = 'Avertissement'; | |||
document.getElementById('wpTextbox1').value = '{{sub'+'st:Bienvenue spammeur}} ~~'+'~~'; | |||
document.getElementById('editform').submit(); | |||
} | |||
}); | |||
//</nowiki> | |||
//<nowiki> | |||
/** | |||
* Ajoute des liens après les catégories pour rapidement | |||
* supprimer / modifier / ajouter une catégorie sur un article. | |||
* Utilise Ajax et l'api MediaWiki pour rechercher une catégorie. | |||
* Version adaptée pour WP:fr de [[:commons:MediaWiki:HotCat.js]] | |||
* | |||
* Auteur original : Magnus Manske | |||
* Adaptation pour WP:fr : Zelda | |||
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]] | |||
*/ | |||
// VARIABLES PERSONNALISABLES | |||
// Suggestion delay in ms | |||
var hotcat_suggestion_delay = 200; | |||
// Taille de la liste déroulante (en items) | |||
var hotcat_list_size = 10; | |||
// Nombre de categories suggérées lors de la recherche | |||
var hotcat_list_items = 50; | |||
// Permet d'enregistrer automatiquement la modif sans repasser par la fenêtre d'édition | |||
// var hotcat_autocommit = false; | |||
// Permet d'afficher la liste de suggestion vers le bas | |||
// var hotcat_list_down = false; | |||
// FIN DE LA PERSONNALISATION DES VARIABLES | |||
var hotcat_running = 0 ; | |||
var hotcat_last_v = "" ; | |||
var hotcat_exists_yes = "http://upload.wikimedia.org/wikipedia/commons/thumb/b/be/P_yes.svg/20px-P_yes.svg.png" ; | |||
var hotcat_exists_no = "http://upload.wikimedia.org/wikipedia/commons/thumb/4/42/P_no.svg/20px-P_no.svg.png" ; | |||
addOnloadHook ( hotcat ) ; | |||
function hotcat () { | |||
if ( hotcat_check_action() ) return ; // Edited page, reloading anyway | |||
var catlinks = document.getElementById("catlinks"); | |||
if (! catlinks && wgNamespaceNumber %2 == 0) { // all except discussion | |||
// let's create a fake one | |||
var bodyC = document.getElementById("bodyContent"); | |||
catlinks = document.createElement("div"); | |||
catlinks.id = "catlinks"; | |||
catlinks.appendChild(document.createElement("div")); | |||
catlinks.firstChild.className = "catlinks"; | |||
catlinks.firstChild.appendChild(document.createElement("div")); | |||
catlinks.firstChild.firstChild.id = "mw-normal-catlinks"; | |||
bodyC.appendChild(catlinks); | |||
} | |||
var catline = document.getElementById ('mw-normal-catlinks'); // Since MW 1.13alpha | |||
if (catline == null) | |||
catline = getElementsByClassName ( document , "p" , "catlinks" ) [0] ; // Earlier versions | |||
if ( catline == null || typeof catline == 'undefined' ) return ; | |||
hotcat_modify_existing ( catline ) ; | |||
hotcat_append_add_span ( catline ) ; | |||
} | |||
function hotcat_append_add_span ( catline ) { | |||
var span_add = document.createElement ( "span" ) ; | |||
var span_sep = document.createTextNode ( " | " ) ; | |||
if ( catline.firstChild ) catline.appendChild ( span_sep ) ; | |||
catline.appendChild ( span_add ) ; | |||
hotcat_create_span ( span_add ) ; | |||
} | |||
String.prototype.ucFirst = function () { | |||
return this.substr(0,1).toUpperCase() + this.substr(1,this.length); | |||
} | |||
function hotcat_modify_span ( span , i ) { | |||
var cat_title = span.firstChild.getAttribute ( "title" ) ; | |||
// Removing leading Category: | |||
cat_title = cat_title.substr(cat_title.indexOf(":") + 1); | |||
var sep1 = document.createTextNode ( " " ) ; | |||
var a1 = document.createTextNode ( "(–)" ) ; | |||
var remove_link = document.createElement ( "a" ) ; | |||
remove_link.href = "javascript:hotcat_remove(\"" + cat_title + "\");" ; | |||
remove_link.appendChild ( a1 ) ; | |||
span.appendChild ( sep1 ) ; | |||
span.appendChild ( remove_link ) ; | |||
var mod_id = "hotcat_modify_" + i ; | |||
var sep2 = document.createTextNode ( " " ) ; | |||
var a2 = document.createTextNode ( "(±)" ) ; | |||
var modify_link = document.createElement ( "a" ) ; | |||
modify_link.id = mod_id ; | |||
modify_link.href = "javascript:hotcat_modify(\"" + mod_id + "\");" ; | |||
modify_link.appendChild ( a2 ) ; | |||
span.appendChild ( sep2 ) ; | |||
span.appendChild ( modify_link ) ; | |||
} | |||
function hotcat_modify_existing ( catline ) { | |||
var spans = catline.getElementsByTagName ( "span" ) ; | |||
for ( var i = 0 ; i < spans.length ; i++ ) { | |||
hotcat_modify_span ( spans[i] , i ) ; | |||
} | |||
} | |||
function hotcat_remove ( cat_title ) { | |||
var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href; | |||
if (window.confirm("Voulez-vous vraiment supprimer la catégorie '" + cat_title + "' ?")) { | |||
document.location = editlk + '&hotcat_removecat=' + encodeURIComponent(cat_title) ; | |||
} | |||
} | |||
function hotcatGetParamValue(paramName, h) { | |||
if (typeof h == 'undefined' ) { h = document.location.href; } | |||
var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)'); | |||
var m=cmdRe.exec(h); | |||
if (m) { | |||
try { | |||
return decodeURIComponent(m[1]); | |||
} catch (someError) {} | |||
} | |||
return null; | |||
} | |||
function hotcat_check_action () { | |||
var ret = 0 ; | |||
if ( wgAction != "edit" ) return ret ; // Not an edit page, so no business... | |||
var summary = new Array () ; | |||
var t = document.editform.wpTextbox1.value ; | |||
var prevent_autocommit = 1 ; | |||
if ( typeof hotcat_autocommit != 'undefined' && hotcat_autocommit ) prevent_autocommit = 0 ; | |||
// Remove existing category? | |||
var hrc = hotcatGetParamValue('hotcat_removecat') ; | |||
// Add new category? | |||
var hnc = hotcatGetParamValue('hotcat_newcat') ; | |||
if ( typeof hrc != "undefined" && hrc != null && hrc != "" ) { | |||
var hcre = new RegExp("(\\s*)\\[\\[ *(?:Catégorie|Category) *: *" + hrc.replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + " *(\\|[^\\]]*)?\\]\\]", "gi"); | |||
var matches = t.match(hcre); | |||
if (matches != null && matches.length == 1) { // Found one occurrence of the category - good! | |||
if ( typeof hnc != "undefined" && hnc != null && hnc != "" ) { | |||
t = t.replace(hcre, "$1[[Catégorie:" + hnc + "$2]]"); | |||
summary.push ( "Modification de la catégorie [[Catégorie:" + hrc + "]] → [[Catégorie:" + hnc + "]]" ) ; | |||
} else { | |||
t = t.replace(hcre, ""); | |||
summary.push ( "Retrait de la catégorie [[Catégorie:" + hrc + "]]" ) ; | |||
} | |||
ret = 1 ; | |||
} else { | |||
alert ( "Impossible de trouver une occurrence unique de \"" + hrc + "\" - elle est peut-être incluse via un modèle" ) ; | |||
prevent_autocommit = 1 ; | |||
} | |||
} else { | |||
// Only adding? | |||
if ( typeof hnc != "undefined" && hnc != null && hnc != "" ) { | |||
// Looking for last cat | |||
var re = /\[\[(?:Catégorie|Category):[^\]]+\]\]/ig | |||
var index = -1; | |||
while (re.exec(t) != null) index = re.lastIndex; | |||
var txt = "[[Catégorie:" + hnc + "]]" ; | |||
if (index < 0) { | |||
t = t + '\n' + txt ; | |||
} else { | |||
t = t.substring(0, index) + '\n' + txt + t.substring(index); | |||
} | |||
summary.push ( "Ajout rapide de la catégorie [[Catégorie:" + hnc + "]]" ) ; | |||
ret = 1 ; | |||
} | |||
} | |||
if ( ret ) { | |||
document.editform.wpTextbox1.value = t ; | |||
document.editform.wpSummary.value = summary.join( " ; " ) + " (avec [[MediaWiki:Gadget-HotCats.js|HotCats]])" ; | |||
document.editform.wpMinoredit.checked = true ; | |||
if ( !prevent_autocommit ) { | |||
document.getElementById("bodyContent").style.display = "none" ; // Hiding the entire edit section so as not to tempt the user into editing... | |||
document.editform.wpSave.click(); | |||
} | |||
} | |||
// This is the end, my friend, the end... | |||
return ret ; | |||
} | |||
function hotcat_clear_span ( span_add ) { | |||
while ( span_add.firstChild ) span_add.removeChild ( span_add.firstChild ) ; | |||
} | |||
function hotcat_create_span ( span_add ) { | |||
hotcat_clear_span ( span_add ) ; | |||
var a_add = document.createElement ( "a" ) ; | |||
var a_text = document.createTextNode ( "(+)" ) ; | |||
span_add.id = "hotcat_add" ; | |||
a_add.href = "javascript:hotcat_add_new()" ; | |||
a_add.appendChild ( a_text ) ; | |||
span_add.appendChild ( a_add ) ; | |||
} | |||
function hotcat_modify ( link_id ) { | |||
var link = document.getElementById ( link_id ) ; | |||
var span = link.parentNode ; | |||
var catname = span.firstChild.firstChild.data ; | |||
while ( span.firstChild.nextSibling ) span.removeChild ( span.firstChild.nextSibling ) ; | |||
span.firstChild.style.display = "none" ; | |||
hotcat_create_new_span ( span , catname ) ; | |||
hotcat_last_v = "" ; | |||
hotcat_text_changed () ; // Update icon | |||
} | |||
function hotcat_add_new () { | |||
var span_add = document.getElementById ( "hotcat_add" ) ; | |||
hotcat_clear_span ( span_add ) ; | |||
hotcat_last_v = "" ; | |||
hotcat_create_new_span ( span_add , "" ) ; | |||
} | |||
function hotcat_create_new_span ( thespan , init_text ) { | |||
var form = document.createElement ( "form" ) ; | |||
form.method = "post" ; | |||
form.onsubmit = function () { hotcat_ok(); return false; } ; | |||
form.id = "hotcat_form" ; | |||
form.style.display = "inline" ; | |||
var list = document.createElement ( "select" ) ; | |||
list.id = "hotcat_list" ; | |||
list.onclick = function () { document.getElementById("hotcat_text").value = document.getElementById("hotcat_list").value ; hotcat_text_changed() ; } ; | |||
list.ondblclick = function () { document.getElementById("hotcat_text").value = document.getElementById("hotcat_list").value ; hotcat_text_changed() ; hotcat_ok(); } ; | |||
list.style.display = "none" ; | |||
var text = document.createElement ( "input" ) ; | |||
text.size = 40 ; | |||
text.id = "hotcat_text" ; | |||
text.type = "text" ; | |||
text.value = init_text ; | |||
text.onkeyup = function () { window.setTimeout("hotcat_text_changed();", hotcat_suggestion_delay ); } ; | |||
var exists = document.createElement ( "img" ) ; | |||
exists.id = "hotcat_exists" ; | |||
exists.src = hotcat_exists_no ; | |||
var OK = document.createElement ( "input" ) ; | |||
OK.type = "button" ; | |||
OK.value = "OK" ; | |||
OK.onclick = hotcat_ok ; | |||
var cancel = document.createElement ( "input" ) ; | |||
cancel.type = "button" ; | |||
cancel.value = "Annuler" ; | |||
cancel.onclick = hotcat_cancel ; | |||
form.appendChild ( list ) ; | |||
form.appendChild ( text ) ; | |||
form.appendChild ( exists ) ; | |||
form.appendChild ( OK ) ; | |||
form.appendChild ( cancel ) ; | |||
thespan.appendChild ( form ) ; | |||
text.focus () ; | |||
} | |||
function hotcat_ok () { | |||
var text = document.getElementById ( "hotcat_text" ) ; | |||
var v = text.value ; | |||
// Empty category ? | |||
if ( v == "" ) { | |||
hotcat_cancel() ; | |||
return ; | |||
} | |||
var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href; | |||
var url = editlk + '&hotcat_newcat=' + encodeURIComponent( v ) ; | |||
// Editing existing? | |||
var span = text.parentNode.parentNode ; // span.form.text | |||
if ( span.id != "hotcat_add" ) { // Not plain "addition" | |||
var cat_title = span.firstChild.innerHTML ; | |||
// Removing leading Category: | |||
cat_title = cat_title.substr(cat_title.indexOf(":") + 1); | |||
url += '&hotcat_removecat=' + encodeURIComponent( cat_title ) ; | |||
} | |||
document.location = url ; | |||
} | |||
function hotcat_cancel () { | |||
var span = document.getElementById("hotcat_form").parentNode ; | |||
if ( span.id == "hotcat_add" ) { | |||
hotcat_create_span ( span ) ; | |||
} else { | |||
while ( span.firstChild.nextSibling ) span.removeChild ( span.firstChild.nextSibling ) ; | |||
span.firstChild.style.display = "" ; | |||
for ( var i = 0 ; i < span.parentNode.childNodes.length ; i++ ) { | |||
if ( span.parentNode.childNodes[i] != span ) continue ; | |||
hotcat_modify_span ( span , i ) ; | |||
break ; | |||
} | |||
} | |||
} | |||
function hotcat_text_changed () { | |||
if ( hotcat_running ) return ; | |||
var text = document.getElementById ( "hotcat_text" ) ; | |||
var v = text.value.ucFirst() ; | |||
if ( hotcat_last_v == v ) return ; // Nothing's changed... | |||
hotcat_running = 1 ; | |||
hotcat_last_v = v ; | |||
if ( v != "" ) { | |||
var url = wgServer + "/" + wgScriptPath + "/api.php?format=xml&action=query&list=allpages&apnamespace=14&apfrom=" + encodeURIComponent( v ) + "&aplimit=" + encodeURIComponent( hotcat_list_items ); | |||
if ( typeof ( hotcat_xmlhttp ) != "undefined" ) hotcat_xmlhttp.abort() ; // Just to make sure... | |||
hotcat_xmlhttp = new sajax_init_object() ; | |||
hotcat_xmlhttp.open('GET', url, true); | |||
hotcat_xmlhttp.onreadystatechange = function () { | |||
if ( typeof hotcat_xmlhttp == "undefined" ) return ; | |||
if (hotcat_xmlhttp.readyState == 4) { | |||
var xml = hotcat_xmlhttp.responseXML ; | |||
if ( xml == null ) return ; | |||
var pages = xml.getElementsByTagName( "p" ) ; | |||
var titles = new Array () ; | |||
for ( var i = 0 ; i < pages.length ; i++ ) { | |||
var s = pages[i].getAttribute("title"); | |||
// Removing leading "Category:" | |||
s = s.substr(s.indexOf(":") + 1); | |||
if ( s.substr ( 0 , hotcat_last_v.length ) != hotcat_last_v ) break ; | |||
titles.push ( s ) ; | |||
} | |||
hotcat_show_suggestions ( titles ) ; | |||
} | |||
}; | |||
hotcat_xmlhttp.send(null); | |||
} else { | |||
var titles = new Array () ; | |||
hotcat_show_suggestions ( titles ) ; | |||
} | |||
hotcat_running = 0 ; | |||
} | |||
function hotcat_show_suggestions ( titles ) { | |||
var text = document.getElementById ( "hotcat_text" ) ; | |||
var list = document.getElementById ( "hotcat_list" ) ; | |||
var icon = document.getElementById ( "hotcat_exists" ) ; | |||
if ( titles.length == 0 ) { | |||
list.style.display = "none" ; | |||
icon.src = hotcat_exists_no ; | |||
return ; | |||
} | |||
var listh = hotcat_list_size * 20 ; | |||
if (titles.length < hotcat_list_size) { | |||
listh = titles.length * 20 ; | |||
} | |||
var nl = parseInt ( text.parentNode.offsetLeft ) - 1 ; | |||
var nt = parseInt(text.offsetTop) - listh ; | |||
// Parameter to show suggestion list beneath categories instead of above | |||
if (typeof hotcat_list_down != "undefined" && hotcat_list_down) { | |||
nt = text.offsetTop + text.offsetHeight; | |||
} | |||
list.size = 5 ; | |||
list.style.align = "left" ; | |||
list.style.zIndex = 5 ; | |||
list.style.position = "absolute" ; | |||
list.style.top = nt + "px" ; | |||
list.style.width = text.offsetWidth + "px" ; | |||
list.style.height = listh + "px" ; | |||
list.style.left = nl + "px" ; | |||
while ( list.firstChild ) list.removeChild ( list.firstChild ) ; | |||
for ( var i = 0 ; i < titles.length ; i++ ) { | |||
var opt = document.createElement ( "option" ) ; | |||
var ot = document.createTextNode ( titles[i] ) ; | |||
opt.appendChild ( ot ) ; | |||
opt.setAttribute( "value", titles[i] ); | |||
list.appendChild ( opt ) ; | |||
} | |||
list.style.display = "block" ; | |||
icon.src = hotcat_exists_yes ; | |||
var first_title = titles.shift () ; | |||
if ( first_title == hotcat_last_v ) return ; | |||
var suggestion = first_title; | |||
text.value = suggestion ; | |||
if (text.createTextRange) { | |||
// IE | |||
var ra = text.createTextRange(); | |||
ra.moveStart("character", hotcat_last_v.length); | |||
ra.moveEnd("character", suggestion.length); | |||
ra.select(); | |||
} else if( is_khtml ) { | |||
text.setSelectionRange( hotcat_last_v.length, suggestion.length ); | |||
} else { | |||
text.selectionStart = hotcat_last_v.length ; | |||
text.selectionEnd = suggestion.length ; | |||
} | |||
} | |||
//</nowiki> | |||
// [[:en:User:Lupin/popups.js]] | |||
// Traduction de [[Utilisateur:Leag|Leag]] : [[Utilisateur:Leag/Navigation popups|Navigation popups]] | |||
document.write('<script type="text/javascript" src="' | document.write('<script type="text/javascript" src="' | ||
+ 'http://en.wikipedia.org/w/index.php?title=User:Lupin/ | + 'http://fr.wikipedia.org/w/index.php?title=User:Leag/popups-strings-fr.js' | ||
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); | |||
document.write('<script type="text/javascript" src="' | |||
+ 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popupsdev.js' | |||
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); | ||
/* | |||
* OngletPurge | |||
* | |||
* Onglet permettant de réaliser une purge du cache | |||
* | |||
* Auteur : ?? | |||
* Dernière révision : 7 juin 2007 | |||
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]] | |||
*/ | |||
function OngletPurge() { | |||
if (wgNamespaceNumber >= 0 && !document.getElementById('toolbar')) { | |||
addPortletLink('p-cactions', wgScriptPath + '/index.php?title=' + wgPageName + '&action=purge', 'purger', 'ca-purge', 'purger le cache de la page', 'p'); | |||
} | |||
} | |||
addOnloadHook(OngletPurge); | |||
/* | |||
* AddEditSection0 | |||
* | |||
* Permet d'éditer la première section d'une page (en-tête) | |||
* | |||
* Auteur : ?? | |||
* Contributeur : Pabix, Zelda | |||
* Dernière révision : 12 novembre 2006 | |||
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]] | |||
*/ | |||
function addEditSection0() { | |||
if (!document.getElementById) { | |||
return; | |||
} | |||
var x = document.getElementById('ca-edit'); | |||
if(!x) { | |||
return; | |||
} | |||
var y = document.createElement('LI'); | |||
y.id = 'ca-edit-0'; | |||
if (x.className == 'selected') { | |||
if (/&action=edit§ion=0$/.test(window.location.href)) { | |||
x.className = 'istalk'; | |||
y.className = 'selected'; | |||
} else { | |||
x.className = 'selected istalk'; | |||
} | |||
} else if (x.className == 'selected istalk') { | |||
if (/&action=edit§ion=0$/.test(window.location.href)) { | |||
x.className = 'istalk'; | |||
y.className = 'selected istalk'; | |||
} else { | |||
y.className = 'istalk'; | |||
} | |||
} else { | |||
y.className = x.className; | |||
x.className = 'istalk'; | |||
} | |||
var z = document.createElement('A'); | |||
if (x.children) { | |||
z.href = x.children[0].href + '§ion=0'; | |||
z.appendChild(document.createTextNode('en-tête')); | |||
y.appendChild(z); | |||
x.parentNode.insertBefore(y,x.nextSibling); | |||
} else { | |||
z.href = x.childNodes[0].href + '§ion=0'; | |||
z.appendChild(document.createTextNode('en-tête')); | |||
y.appendChild(z); | |||
x.parentNode.insertBefore(y,x.nextSibling); | |||
} | |||
} | |||
if ( wgAction != "edit" && wgAction != "submit" ) { | |||
addOnloadHook(addEditSection0); | |||
} | |||
//<source lang="javascript" line> | |||
/* | |||
* Deluxe Bar | |||
* | |||
* Barre d'outils d'édition étendue | |||
* | |||
* Auteur : Dake | |||
* Modifié par : Sanao | |||
* Dernière révision : 24 novembre 2007 | |||
*/ | |||
function DeluxeBar() | |||
{ | |||
var messages_debut = new Array(); | |||
var messages_fin = new Array(); | |||
var images = new Array(); | |||
var commentaires = new Array(); | |||
var id_images = new Array(); | |||
with (messages_debut) | |||
{ | |||
push(""); //Bienvenue sur ta page ! | |||
push(""); //Bienvenue ! | |||
push(""); //Blocage d'un vandale | |||
push(""); //Avertissement vandalisme | |||
push(""); //Avertissement copyvio | |||
push(""); //Avertissement spam | |||
push(""); //Fait | |||
} | |||
with (messages_fin) | |||
{ | |||
push("{{Bienvenu}} [[Utilisateur:Draky|Draky]] 12 juillet 2008 à 21:26 (UTC)"); | |||
push("{{Bienvenue nouveau}} [[Utilisateur:Draky|Draky]] 12 juillet 2008 à 21:26 (UTC)"); | |||
push("{{Vandale bloqué|1|jour}} [[Utilisateur:Draky|Draky]] 12 juillet 2008 à 21:26 (UTC)"); | |||
push("{{Vandalisme|article}} [[Utilisateur:Draky|Draky]] 12 juillet 2008 à 21:26 (UTC)"); | |||
push("{{Copieur|article|page copiée}} [[Utilisateur:Draky|Draky]] 12 juillet 2008 à 21:26 (UTC)"); | |||
push("{{Bienvenue spammeur|article}} [[Utilisateur:Draky|Draky]] 12 juillet 2008 à 21:26 (UTC)"); | |||
push("{{Fait}} [[Utilisateur:Draky|Draky]] 12 juillet 2008 à 21:26 (UTC)"); | |||
} | |||
with (images) | |||
{ | |||
push("http://upload.wikimedia.org/wikipedia/commons/1/12/Button_accueilA.png"); | |||
push("http://upload.wikimedia.org/wikipedia/commons/e/eb/Button_accueilB.png"); | |||
push("http://upload.wikimedia.org/wikipedia/commons/0/00/Button_vandale.png"); | |||
push("http://upload.wikimedia.org/wikipedia/commons/a/a7/Button_smiley3.png"); | |||
push("http://upload.wikimedia.org/wikipedia/commons/5/58/Button_black_copyright.png"); | |||
push("http://upload.wikimedia.org/wikipedia/commons/f/fb/Button_spam2.png"); | |||
push("http://upload.wikimedia.org/wikipedia/commons/d/d9/Button_trait%C3%A9.png"); | |||
} | |||
with (commentaires) | |||
{ | |||
push("Bienvenue sur ta page !"); | |||
push("Bienvenue !"); | |||
push("Blocage d'un vandale"); | |||
push("Avertissement vandalisme"); | |||
push("Avertissement copyvio"); | |||
push("Avertissement spam"); | |||
push("Fait"); | |||
} | |||
with (id_images) | |||
{ | |||
push("bienvenue_sur_ta_page"); | |||
push("bienvenue"); | |||
push("blocage_vandale"); | |||
push("avertissement_vandalisme"); | |||
push("avertissement_copyvio"); | |||
push("avertissement_spam"); | |||
push("fait"); | |||
} | |||
ajoutBoutonsToolbar(messages_debut, messages_fin, commentaires, images, id_images); | |||
} | |||
addOnloadHook(DeluxeBar); | |||
//</source> | |||
//<source lang="javascript" line> | |||
/* | |||
* Fonction | |||
* | |||
* Récupère la valeur d'une variable globale en gérant le cas lorsque cette variable n'existe pas | |||
* @param nom_variable Nom de la variable dont on veut connaître la valeur | |||
* @param val_defaut Valeur par défaut si la variable n'existe pas | |||
* @return La valeur de la variable, ou val_defaut si la variable n'existe pas | |||
* | |||
* Auteur : Sanao | |||
* Dernière révision : 22 novembre 2007 | |||
*/ | |||
function getVarValue(nom_variable, val_defaut) | |||
{ | |||
var result = null; | |||
try | |||
{ | |||
result = eval(nom_variable.toString()); | |||
} | |||
catch (e) | |||
{ | |||
result = val_defaut; | |||
} | |||
return(result); | |||
} | |||
//</source> | |||
/* | |||
* Résumé Deluxe | |||
* | |||
* Ajoute des commentaires de modification prédéfinis | |||
* | |||
* Auteur : Dake | |||
* Contributions : Pabix, Tieno | |||
* Date de dernière révision : 12 novembre 2006 | |||
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]] | |||
*/ | |||
//////////////////////ZONE PERSONNALISABLE////////////////////// | |||
var resumedeluxeTitles = new Array(); | |||
with (resumedeluxeTitles) { | |||
push("orthographe"); | |||
push("- typographie"); | |||
push("- catégorisation"); | |||
push("- interwiki"); | |||
push("- wikification"); | |||
push("- image"); | |||
push("- redirection"); | |||
push("- style"); | |||
push("- revert"); | |||
push("- réorganisation"); | |||
push("- réponse"); | |||
push("- maintenance"); | |||
push("- 1.0"); | |||
push("- homonymie"); | |||
push("- bandeau"); | |||
push("- infobox"); | |||
} | |||
var resumedeluxeInputs= new Array(); | |||
with (resumedeluxeInputs) { | |||
push("orthographe"); | |||
push("typographie"); | |||
push("catégorisation"); | |||
push("interwiki"); | |||
push("wikification"); | |||
push("image"); | |||
push("redirection"); | |||
push("style"); | |||
push("revert"); | |||
push("réorganisation"); | |||
push("réponse"); | |||
push("maintenance"); | |||
push("évaluation Wikipédia 1.0"); | |||
push("création homonymie"); | |||
push("ajout de bandeau"); | |||
push("infobox"); | |||
} | |||
/////////////////FIN DE LA ZONE PERSONNALISABLE///////////////// | |||
function setSummary(str) | |||
{ | |||
document.editform.wpSummary.value = str; | |||
} | |||
function addToSummary(str) | |||
{ | |||
var resum = document.editform.wpSummary.value; | |||
if(resum != 0 && resum.indexOf("*/") < resum.length - 3) { | |||
document.editform.wpSummary.value += " - "; | |||
} | |||
document.editform.wpSummary.value += str; | |||
} | |||
function DeluxeSummary() | |||
{ | |||
if (document.URL.indexOf("§ion=new") > 0) return; | |||
var sumLbl = document.getElementById("wpSummaryLabel"); | |||
if(sumLbl) { | |||
var sumInput = document.getElementById("wpSummary"); | |||
sumInput.style.width = "95%"; | |||
var str = "Messages prédéfinis : "; | |||
for(var cpt = 0; cpt < resumedeluxeTitles.length; cpt ++) { | |||
var tmp = resumedeluxeInputs[cpt]; | |||
str += "<a href=\"javascript:addToSummary('" + tmp.replace( /[']/g , "\\'") + "')\"" | |||
+ " class=\"sumLink\" title=\"Ajouter dans la boîte de résumé\">" | |||
+ resumedeluxeTitles[cpt] | |||
+ "</a> "; | |||
} | |||
sumLbl.innerHTML = str + "<br />" + sumLbl.innerHTML; | |||
} | |||
} | |||
addOnloadHook(DeluxeSummary); | |||
/* Fenêtres arrondies (pour les navigateurs moz/firefox/gecko) */ | |||
.pBody { | |||
padding: 0.3em 0.3em; | |||
-moz-border-radius-topright: 0.5em; | |||
} | |||
.portlet h5 { | |||
-moz-border-radius-topright: 0.5em; | |||
} | |||
#p-cactions ul li, #p-cactions ul li a { | |||
-moz-border-radius-topright: 0.5em; | |||
-moz-border-radius-topleft: 0.5em; | |||
} |
Dernière version du 12 juillet 2008 à 23:26
/**
* Facilite la maintenance des images ; notamment l'avertissement des utilisateurs.
*/
function addCopyPasteImageWarningPanel() {
source = document.getElementById('bandeau-source-inconnue') != null;
licence = document.getElementById('bandeau-licence-inconnue') != null;
permission = document.getElementById('bandeau-permission-inconnue') != null;
if (!source && !licence && !permission) return;
panel = document.createElement('DIV');
panel.setAttribute("style", "margin:0 auto 0 auto; background-color:#FFE5E5; border:1px solid #FF6060; padding:5px; text-align:left;");
if (source) {
text = "{"+"{subst:Avertissement source inconnue|" + wgPageName + "}} ~~"+"~~"
panel.appendChild(document.createTextNode(text))
}
if (licence) {
if (source) panel.appendChild(document.createElement('BR'))
text = "{"+"{subst:Avertissement licence inconnue|" + wgPageName + "}} ~~"+"~~"
panel.appendChild(document.createTextNode(text))
}
if (permission) {
if (source || licence) panel.appendChild(document.createElement('BR'))
text = "{"+"{subst:Avertissement permission inconnue|" + wgPageName + "}} ~~"+"~~"
panel.appendChild(document.createTextNode(text))
}
prev = document.getElementById('filetoc')
prev.parentNode.insertBefore(panel, prev);
}
if (wgNamespaceNumber == 6) {
addOnloadHook(addCopyPasteImageWarningPanel);
}
/**
* '''Restauration Deluxe'''
*
* Cocher/Décocher rapidement les cases pour restaurer un article
*
* Auteur : GôTô
* Dernière révision : 11 mai 2007
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]]
*/
function UndeleteSelectAll()
{
if(wgCanonicalSpecialPageName != 'Undelete') return;
var title2 = document.getElementsByTagName('h2');
var all = document.createElement('input');
all.setAttribute('type', 'checkbox');
all.setAttribute('onclick', 'SelectAllInputs(this.checked)');
all.setAttribute('title', 'Sélectionner/Désélectionner tous');
title2[title2.length-1].appendChild(all);
all.click();
}
function SelectAllInputs(bool)
{
var inputs = document.getElementById('undelete').getElementsByTagName('input');
for (var cpt = 0 ; cpt < inputs.length ; cpt++)
{
inputs[cpt].checked = bool;
}
}
addOnloadHook(UndeleteSelectAll);
/*
* Protection à la création
*
* Permet aux administrateurs de protéger automatiquement la recréation d'une page
* en l'ajoutant à [[Wikipédia:Pages protégées à la création|WP:PPC]] lors de la confirmation de suppression
*
* Auteur : Seb35
* Date de dernière révision : 6 septembre 2007
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]]
*/
function protectCreation() {
if (!document.getElementById('deleteconfirm')) return;
var td = document.getElementById('wpWatch').parentNode;
td.appendChild(document.createElement('br'));
var label = document.createElement('label');
var input = document.createElement('input');
input.setAttribute('name', 'wpProtectCreation');
input.setAttribute('type', 'checkbox');
input.setAttribute('id', 'wpProtectCreation');
input.setAttribute('tabindex', '3');
label.appendChild(input);
label.appendChild(document.createTextNode(' Protéger cette page de la recréation ('));
var lien = document.createElement('a');
lien.setAttribute('href', 'http://fr.wikipedia.org/wiki/Wikipédia:Bulletin_des_administrateurs/2007/Semaine_52#Protection_.C3.A0_la_cr.C3.A9ation_activ.C3.A9e');
lien.appendChild(document.createTextNode('[1]'));
label.appendChild(lien);
label.appendChild(document.createTextNode(','));
lien = document.createElement('a');
lien.setAttribute('href', 'http://fr.wikipedia.org/wiki/Wikipédia:Bulletin_des_administrateurs/2008/Semaine_5#blocage_d.27utilisateur_.2F_WP:PPC');
lien.appendChild(document.createTextNode('[2]'));
label.appendChild(lien);
label.appendChild(document.createTextNode(')'));
td.appendChild(label);
document.getElementById('wpConfirmB').setAttribute('tabindex', '4');
document.getElementById('wpConfirmB').setAttribute('onclick', 'protectCreationExec();');
}
if(wgAction == 'delete') addOnloadHook(protectCreation);
if(document.URL.indexOf('protectcreation=') != -1) addOnloadHook(protectCreationWindow);
function protectCreationExec() {
if(!document.getElementById('wpProtectCreation').checked) return;
var d = new Array('Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre');
var hui = new Date();
var adresse = new String('http://fr.wikipedia.org/w/index.php?title=Wikipédia:Pages_protégées_à_la_création/'+d[hui.getMonth()]+'_'+hui.getFullYear()+'&action=edit&protectcreation='+wgPageName);
var fenetre = window.open(encodeURI(adresse), 'fProtectCreation', 'menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=800,height=200');
fenetre.focus();
}
function protectCreationWindow() {
if(wgPageName.substr(0,40) != 'Wikipédia:Pages_protégées_à_la_création/') return;
window.scrollTo(0,document.documentElement.clientHeight);
if(document.URL.indexOf('protectcreation=') == -1) return;
var page = decodeURI(document.URL.substr(document.URL.indexOf('protectcreation=')+16).replace(/_/g, ' '));
document.editform.wpSummary.value = '+' + page;
if(page.indexOf(':')!=-1) page = page.substr(page.indexOf(':')+1) + '|ns=' + page.substr(0, page.indexOf(':'));
document.editform.wpTextbox1.value += '* {' + '{Titre protégé|' + page + '}}';
document.editform.wpSave.click();
}
/*
* Pages courtes optimisées
*
* Quelques liens supplémentaires dans Special:Shortpages
*
* Auteur : Dake
* Modifications : Seb35
* Denière révision : 30 novembre 2007
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]]
*/
function OptimizedShortPages() {
var mainNode = document.getElementsByTagName('ol');
var allArticles = mainNode[0].getElementsByTagName('li');
for(i=0; i<allArticles.length; i++) {
var histElement = allArticles[i].getElementsByTagName('a')[0];
var articleName = histElement.getAttribute('href').match(/title\=(.*)&/)[1];
var diffElement = document.createElement('a');
diffElement.setAttribute('href', '/w/index.php?title=' + articleName + '&diff=0');
diffElement.appendChild(document.createTextNode('diff'));
var relatedElement = document.createElement('a');
relatedElement.setAttribute('href', '/wiki/Special:Whatlinkshere/' + articleName);
relatedElement.appendChild(document.createTextNode('liens'));
insertAfter(histElement.parentNode, relatedElement, histElement);
insertAfter(histElement.parentNode, document.createTextNode(') ('), histElement);
insertAfter(histElement.parentNode, diffElement, histElement);
insertAfter(histElement.parentNode, document.createTextNode(') ('), histElement);
}
}
if(wgCanonicalSpecialPageName == 'Shortpages') addOnloadHook(OptimizedShortPages);
/*
* Suppression Deluxe
*
* Motifs de suppression prédéfinis
* Il est possible de définir des messages comportant des liens internes
*
* Auteurs : Dake
* Modifications : IAlex, Seb35
* Date de dernière révision : 10 mai 2007
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]]
*/
//////////// Zone personnalisable //////////
var suppressiondeluxeMessages = new Array();
with (suppressiondeluxeMessages) {
push("Vandalisme");
push("Violation de copyright");
push("Copie de site web sans autorisation explicite");
push("Bac à sable");
push("[[Wikipédia:Pages_à_supprimer/"+wgPageName+"|Décision PàS]]");
push("Déplacement vers Commons");
push("Licence inappropriée");
push("Purge ou renommage");
push("[[Wikipédia:Critères_d'admissibilité_des_articles|Contenu promotionnel]]");
push("Diffamation ou insulte");
push("Catégorie vide");
push("Redirection cassée");
push("Non encyclopédique en l'état");
push("[[Wikipédia:Critères_d'admissibilité_des_articles|Critères d'admissibilité non atteints]]");
push("Pas en français");
push("Page blanchie par son auteur");
}
//////////// Fin de la zone personnalisable //////////
function SuppressionDeluxe() {
var mainForm = document.getElementById('deleteconfirm');
if(!mainForm) return;
var table = document.createElement('table');
for(var i=0; i<suppressiondeluxeMessages.length; i++) {
if (i%4==0) {
tr = document.createElement('tr');
table.appendChild(tr);
}
var inputConfirm = document.createElement('input');
inputConfirm.setAttribute('value',suppressiondeluxeMessages[i].replace(/^\[\[.*\|(.*)\]\]$/, '$1'));
inputConfirm.setAttribute('onclick','SuppressionResume("'+suppressiondeluxeMessages[i]+'");');
inputConfirm.setAttribute('type', 'button');
var td = document.createElement('td');
td.appendChild(inputConfirm);
tr.appendChild(td);
}
var separation = document.createElement('p');
separation.appendChild(document.createElement('hr'));
insertAfter(mainForm.parentNode, separation, mainForm);
insertAfter(mainForm.parentNode, table, separation);
}
function SuppressionResume(sampleText) {
var mainForm = document.getElementById('deleteconfirm');
mainForm.wpReason.value = sampleText;
mainForm.wpConfirmB.click();
}
if(wgAction == 'delete') addOnloadHook(SuppressionDeluxe);
/**
* Outils pour réverter
*
* Fournit des liens dans les pages de diff
*
* Auteurs : Lorian (en), Chphe (fr)
* Dernière révision : 3 novembre 2006
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]]
*/
//<nowiki>
// _GET code from NoGray JS Library http://www.nogray.com/new_site/
var _GET = new Array();
var _uri = location.href;
var _temp_get_arr = _uri.substring(_uri.indexOf('?')+1, _uri.length).split("&");
var _temp_get_arr_1 = new Array();
for(_get_arr_i=0; _get_arr_i<_temp_get_arr.length; _get_arr_i++){
_temp_get_arr_1 = _temp_get_arr[_get_arr_i].split("=");
_GET[decodeURI(_temp_get_arr_1[0])] = decodeURI(_temp_get_arr_1[1]);
}
delete _uri; delete _temp_get_arr; delete _temp_get_arr_1;
function getMessage (chemin, where, user1, user2) {
var message = prompt ('Quel message faut-il laisser ?', '');
if (message) {
window.location = chemin + '&'+where+'=2&user1='+user1+'&user2='+user2+'&message='+message;
}
}
addOnloadHook(function (){
if (location.href.match(/diff=/)) {
// Get username of submitter
var user1 = getElementsByClass('diff-otitle',null,'td');
if(user1.length == 0) return;
// Récupération du chemin vers la version à rétablir
var chemin = user1[0].getElementsByTagName('a')[1].href;
user1 = user1[0].getElementsByTagName('a')[2].innerHTML;
var user2 = getElementsByClass('diff-ntitle',null,'td'); user2 = user2[0].getElementsByTagName('a')[2].innerHTML;
if (user2 == "défaire"){
user2 = getElementsByClass('diff-ntitle',null,'td'); user2 = user2[0].getElementsByTagName('a')[3].innerHTML;
}
document.getElementById('contentSub').innerHTML = '(<a href="'+chemin+'&revert=1&user1='+user1+'&user2='+user2+'">Annuler</a> / <a href="javascript:var message = getMessage(\''+chemin+'\', \'revert\', \''+user1+'\', \''+user2+'\');">Message</a>) (<a href="'+chemin+'&vandalism=1&user1='+user1+'&user2='+user2+'">Vandalisme</a> / <a href="javascript:var message = getMessage(\''+chemin+'\', \'vandalism\', \''+user1+'\', \''+user2+'\');">Message</a>) (Avertir : <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=1">Test0</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=2">Test1</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=3">Test2</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=4">Test3</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=5">Bienvenue spammeur</a>)';
} else if (location.href.match(/revert=1/)) {
document.getElementById('wpSummary').value = 'Révocation des modifications par [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] ; retour à la version de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']]';
document.getElementById('editform').submit();
} else if (location.href.match(/revert=2/)) {
document.getElementById('wpSummary').value = 'Révocation des modifications par [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] ; retour à la version de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']] ('+_GET['message']+')';
document.getElementById('editform').submit();
} else if (location.href.match(/vandalism=1/)) {
document.getElementById('wpSummary').value = 'Révocation de vandalisme par [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] ; retour à la version de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']]';
document.getElementById('editform').submit();
} else if (location.href.match(/vandalism=2/)) {
document.getElementById('wpSummary').value = 'Révocation de vandalisme par [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] ; retour à la version de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']] ('+_GET['message']+')';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=1/)) {
document.getElementById('wpSummary').value = 'Avertissement';
document.getElementById('wpTextbox1').value = '{{sub'+'st:test0}} ~~'+'~~';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=2/)) {
document.getElementById('wpSummary').value = 'Avertissement';
document.getElementById('wpTextbox1').value = '{{sub'+'st:test1}} ~~'+'~~';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=3/)) {
document.getElementById('wpSummary').value = 'Avertissement';
document.getElementById('wpTextbox1').value = '{{sub'+'st:test2}} ~~'+'~~';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=4/)) {
document.getElementById('wpSummary').value = 'Avertissement';
document.getElementById('wpTextbox1').value = '{{sub'+'st:test3}} ~~'+'~~';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=5/)) {
document.getElementById('wpSummary').value = 'Avertissement';
document.getElementById('wpTextbox1').value = '{{sub'+'st:Bienvenue spammeur}} ~~'+'~~';
document.getElementById('editform').submit();
}
});
//</nowiki>
//<nowiki>
/**
* Ajoute des liens après les catégories pour rapidement
* supprimer / modifier / ajouter une catégorie sur un article.
* Utilise Ajax et l'api MediaWiki pour rechercher une catégorie.
* Version adaptée pour WP:fr de [[:commons:MediaWiki:HotCat.js]]
*
* Auteur original : Magnus Manske
* Adaptation pour WP:fr : Zelda
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]]
*/
// VARIABLES PERSONNALISABLES
// Suggestion delay in ms
var hotcat_suggestion_delay = 200;
// Taille de la liste déroulante (en items)
var hotcat_list_size = 10;
// Nombre de categories suggérées lors de la recherche
var hotcat_list_items = 50;
// Permet d'enregistrer automatiquement la modif sans repasser par la fenêtre d'édition
// var hotcat_autocommit = false;
// Permet d'afficher la liste de suggestion vers le bas
// var hotcat_list_down = false;
// FIN DE LA PERSONNALISATION DES VARIABLES
var hotcat_running = 0 ;
var hotcat_last_v = "" ;
var hotcat_exists_yes = "http://upload.wikimedia.org/wikipedia/commons/thumb/b/be/P_yes.svg/20px-P_yes.svg.png" ;
var hotcat_exists_no = "http://upload.wikimedia.org/wikipedia/commons/thumb/4/42/P_no.svg/20px-P_no.svg.png" ;
addOnloadHook ( hotcat ) ;
function hotcat () {
if ( hotcat_check_action() ) return ; // Edited page, reloading anyway
var catlinks = document.getElementById("catlinks");
if (! catlinks && wgNamespaceNumber %2 == 0) { // all except discussion
// let's create a fake one
var bodyC = document.getElementById("bodyContent");
catlinks = document.createElement("div");
catlinks.id = "catlinks";
catlinks.appendChild(document.createElement("div"));
catlinks.firstChild.className = "catlinks";
catlinks.firstChild.appendChild(document.createElement("div"));
catlinks.firstChild.firstChild.id = "mw-normal-catlinks";
bodyC.appendChild(catlinks);
}
var catline = document.getElementById ('mw-normal-catlinks'); // Since MW 1.13alpha
if (catline == null)
catline = getElementsByClassName ( document , "p" , "catlinks" ) [0] ; // Earlier versions
if ( catline == null || typeof catline == 'undefined' ) return ;
hotcat_modify_existing ( catline ) ;
hotcat_append_add_span ( catline ) ;
}
function hotcat_append_add_span ( catline ) {
var span_add = document.createElement ( "span" ) ;
var span_sep = document.createTextNode ( " | " ) ;
if ( catline.firstChild ) catline.appendChild ( span_sep ) ;
catline.appendChild ( span_add ) ;
hotcat_create_span ( span_add ) ;
}
String.prototype.ucFirst = function () {
return this.substr(0,1).toUpperCase() + this.substr(1,this.length);
}
function hotcat_modify_span ( span , i ) {
var cat_title = span.firstChild.getAttribute ( "title" ) ;
// Removing leading Category:
cat_title = cat_title.substr(cat_title.indexOf(":") + 1);
var sep1 = document.createTextNode ( " " ) ;
var a1 = document.createTextNode ( "(–)" ) ;
var remove_link = document.createElement ( "a" ) ;
remove_link.href = "javascript:hotcat_remove(\"" + cat_title + "\");" ;
remove_link.appendChild ( a1 ) ;
span.appendChild ( sep1 ) ;
span.appendChild ( remove_link ) ;
var mod_id = "hotcat_modify_" + i ;
var sep2 = document.createTextNode ( " " ) ;
var a2 = document.createTextNode ( "(±)" ) ;
var modify_link = document.createElement ( "a" ) ;
modify_link.id = mod_id ;
modify_link.href = "javascript:hotcat_modify(\"" + mod_id + "\");" ;
modify_link.appendChild ( a2 ) ;
span.appendChild ( sep2 ) ;
span.appendChild ( modify_link ) ;
}
function hotcat_modify_existing ( catline ) {
var spans = catline.getElementsByTagName ( "span" ) ;
for ( var i = 0 ; i < spans.length ; i++ ) {
hotcat_modify_span ( spans[i] , i ) ;
}
}
function hotcat_remove ( cat_title ) {
var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
if (window.confirm("Voulez-vous vraiment supprimer la catégorie '" + cat_title + "' ?")) {
document.location = editlk + '&hotcat_removecat=' + encodeURIComponent(cat_title) ;
}
}
function hotcatGetParamValue(paramName, h) {
if (typeof h == 'undefined' ) { h = document.location.href; }
var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
var m=cmdRe.exec(h);
if (m) {
try {
return decodeURIComponent(m[1]);
} catch (someError) {}
}
return null;
}
function hotcat_check_action () {
var ret = 0 ;
if ( wgAction != "edit" ) return ret ; // Not an edit page, so no business...
var summary = new Array () ;
var t = document.editform.wpTextbox1.value ;
var prevent_autocommit = 1 ;
if ( typeof hotcat_autocommit != 'undefined' && hotcat_autocommit ) prevent_autocommit = 0 ;
// Remove existing category?
var hrc = hotcatGetParamValue('hotcat_removecat') ;
// Add new category?
var hnc = hotcatGetParamValue('hotcat_newcat') ;
if ( typeof hrc != "undefined" && hrc != null && hrc != "" ) {
var hcre = new RegExp("(\\s*)\\[\\[ *(?:Catégorie|Category) *: *" + hrc.replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + " *(\\|[^\\]]*)?\\]\\]", "gi");
var matches = t.match(hcre);
if (matches != null && matches.length == 1) { // Found one occurrence of the category - good!
if ( typeof hnc != "undefined" && hnc != null && hnc != "" ) {
t = t.replace(hcre, "$1[[Catégorie:" + hnc + "$2]]");
summary.push ( "Modification de la catégorie [[Catégorie:" + hrc + "]] → [[Catégorie:" + hnc + "]]" ) ;
} else {
t = t.replace(hcre, "");
summary.push ( "Retrait de la catégorie [[Catégorie:" + hrc + "]]" ) ;
}
ret = 1 ;
} else {
alert ( "Impossible de trouver une occurrence unique de \"" + hrc + "\" - elle est peut-être incluse via un modèle" ) ;
prevent_autocommit = 1 ;
}
} else {
// Only adding?
if ( typeof hnc != "undefined" && hnc != null && hnc != "" ) {
// Looking for last cat
var re = /\[\[(?:Catégorie|Category):[^\]]+\]\]/ig
var index = -1;
while (re.exec(t) != null) index = re.lastIndex;
var txt = "[[Catégorie:" + hnc + "]]" ;
if (index < 0) {
t = t + '\n' + txt ;
} else {
t = t.substring(0, index) + '\n' + txt + t.substring(index);
}
summary.push ( "Ajout rapide de la catégorie [[Catégorie:" + hnc + "]]" ) ;
ret = 1 ;
}
}
if ( ret ) {
document.editform.wpTextbox1.value = t ;
document.editform.wpSummary.value = summary.join( " ; " ) + " (avec [[MediaWiki:Gadget-HotCats.js|HotCats]])" ;
document.editform.wpMinoredit.checked = true ;
if ( !prevent_autocommit ) {
document.getElementById("bodyContent").style.display = "none" ; // Hiding the entire edit section so as not to tempt the user into editing...
document.editform.wpSave.click();
}
}
// This is the end, my friend, the end...
return ret ;
}
function hotcat_clear_span ( span_add ) {
while ( span_add.firstChild ) span_add.removeChild ( span_add.firstChild ) ;
}
function hotcat_create_span ( span_add ) {
hotcat_clear_span ( span_add ) ;
var a_add = document.createElement ( "a" ) ;
var a_text = document.createTextNode ( "(+)" ) ;
span_add.id = "hotcat_add" ;
a_add.href = "javascript:hotcat_add_new()" ;
a_add.appendChild ( a_text ) ;
span_add.appendChild ( a_add ) ;
}
function hotcat_modify ( link_id ) {
var link = document.getElementById ( link_id ) ;
var span = link.parentNode ;
var catname = span.firstChild.firstChild.data ;
while ( span.firstChild.nextSibling ) span.removeChild ( span.firstChild.nextSibling ) ;
span.firstChild.style.display = "none" ;
hotcat_create_new_span ( span , catname ) ;
hotcat_last_v = "" ;
hotcat_text_changed () ; // Update icon
}
function hotcat_add_new () {
var span_add = document.getElementById ( "hotcat_add" ) ;
hotcat_clear_span ( span_add ) ;
hotcat_last_v = "" ;
hotcat_create_new_span ( span_add , "" ) ;
}
function hotcat_create_new_span ( thespan , init_text ) {
var form = document.createElement ( "form" ) ;
form.method = "post" ;
form.onsubmit = function () { hotcat_ok(); return false; } ;
form.id = "hotcat_form" ;
form.style.display = "inline" ;
var list = document.createElement ( "select" ) ;
list.id = "hotcat_list" ;
list.onclick = function () { document.getElementById("hotcat_text").value = document.getElementById("hotcat_list").value ; hotcat_text_changed() ; } ;
list.ondblclick = function () { document.getElementById("hotcat_text").value = document.getElementById("hotcat_list").value ; hotcat_text_changed() ; hotcat_ok(); } ;
list.style.display = "none" ;
var text = document.createElement ( "input" ) ;
text.size = 40 ;
text.id = "hotcat_text" ;
text.type = "text" ;
text.value = init_text ;
text.onkeyup = function () { window.setTimeout("hotcat_text_changed();", hotcat_suggestion_delay ); } ;
var exists = document.createElement ( "img" ) ;
exists.id = "hotcat_exists" ;
exists.src = hotcat_exists_no ;
var OK = document.createElement ( "input" ) ;
OK.type = "button" ;
OK.value = "OK" ;
OK.onclick = hotcat_ok ;
var cancel = document.createElement ( "input" ) ;
cancel.type = "button" ;
cancel.value = "Annuler" ;
cancel.onclick = hotcat_cancel ;
form.appendChild ( list ) ;
form.appendChild ( text ) ;
form.appendChild ( exists ) ;
form.appendChild ( OK ) ;
form.appendChild ( cancel ) ;
thespan.appendChild ( form ) ;
text.focus () ;
}
function hotcat_ok () {
var text = document.getElementById ( "hotcat_text" ) ;
var v = text.value ;
// Empty category ?
if ( v == "" ) {
hotcat_cancel() ;
return ;
}
var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
var url = editlk + '&hotcat_newcat=' + encodeURIComponent( v ) ;
// Editing existing?
var span = text.parentNode.parentNode ; // span.form.text
if ( span.id != "hotcat_add" ) { // Not plain "addition"
var cat_title = span.firstChild.innerHTML ;
// Removing leading Category:
cat_title = cat_title.substr(cat_title.indexOf(":") + 1);
url += '&hotcat_removecat=' + encodeURIComponent( cat_title ) ;
}
document.location = url ;
}
function hotcat_cancel () {
var span = document.getElementById("hotcat_form").parentNode ;
if ( span.id == "hotcat_add" ) {
hotcat_create_span ( span ) ;
} else {
while ( span.firstChild.nextSibling ) span.removeChild ( span.firstChild.nextSibling ) ;
span.firstChild.style.display = "" ;
for ( var i = 0 ; i < span.parentNode.childNodes.length ; i++ ) {
if ( span.parentNode.childNodes[i] != span ) continue ;
hotcat_modify_span ( span , i ) ;
break ;
}
}
}
function hotcat_text_changed () {
if ( hotcat_running ) return ;
var text = document.getElementById ( "hotcat_text" ) ;
var v = text.value.ucFirst() ;
if ( hotcat_last_v == v ) return ; // Nothing's changed...
hotcat_running = 1 ;
hotcat_last_v = v ;
if ( v != "" ) {
var url = wgServer + "/" + wgScriptPath + "/api.php?format=xml&action=query&list=allpages&apnamespace=14&apfrom=" + encodeURIComponent( v ) + "&aplimit=" + encodeURIComponent( hotcat_list_items );
if ( typeof ( hotcat_xmlhttp ) != "undefined" ) hotcat_xmlhttp.abort() ; // Just to make sure...
hotcat_xmlhttp = new sajax_init_object() ;
hotcat_xmlhttp.open('GET', url, true);
hotcat_xmlhttp.onreadystatechange = function () {
if ( typeof hotcat_xmlhttp == "undefined" ) return ;
if (hotcat_xmlhttp.readyState == 4) {
var xml = hotcat_xmlhttp.responseXML ;
if ( xml == null ) return ;
var pages = xml.getElementsByTagName( "p" ) ;
var titles = new Array () ;
for ( var i = 0 ; i < pages.length ; i++ ) {
var s = pages[i].getAttribute("title");
// Removing leading "Category:"
s = s.substr(s.indexOf(":") + 1);
if ( s.substr ( 0 , hotcat_last_v.length ) != hotcat_last_v ) break ;
titles.push ( s ) ;
}
hotcat_show_suggestions ( titles ) ;
}
};
hotcat_xmlhttp.send(null);
} else {
var titles = new Array () ;
hotcat_show_suggestions ( titles ) ;
}
hotcat_running = 0 ;
}
function hotcat_show_suggestions ( titles ) {
var text = document.getElementById ( "hotcat_text" ) ;
var list = document.getElementById ( "hotcat_list" ) ;
var icon = document.getElementById ( "hotcat_exists" ) ;
if ( titles.length == 0 ) {
list.style.display = "none" ;
icon.src = hotcat_exists_no ;
return ;
}
var listh = hotcat_list_size * 20 ;
if (titles.length < hotcat_list_size) {
listh = titles.length * 20 ;
}
var nl = parseInt ( text.parentNode.offsetLeft ) - 1 ;
var nt = parseInt(text.offsetTop) - listh ;
// Parameter to show suggestion list beneath categories instead of above
if (typeof hotcat_list_down != "undefined" && hotcat_list_down) {
nt = text.offsetTop + text.offsetHeight;
}
list.size = 5 ;
list.style.align = "left" ;
list.style.zIndex = 5 ;
list.style.position = "absolute" ;
list.style.top = nt + "px" ;
list.style.width = text.offsetWidth + "px" ;
list.style.height = listh + "px" ;
list.style.left = nl + "px" ;
while ( list.firstChild ) list.removeChild ( list.firstChild ) ;
for ( var i = 0 ; i < titles.length ; i++ ) {
var opt = document.createElement ( "option" ) ;
var ot = document.createTextNode ( titles[i] ) ;
opt.appendChild ( ot ) ;
opt.setAttribute( "value", titles[i] );
list.appendChild ( opt ) ;
}
list.style.display = "block" ;
icon.src = hotcat_exists_yes ;
var first_title = titles.shift () ;
if ( first_title == hotcat_last_v ) return ;
var suggestion = first_title;
text.value = suggestion ;
if (text.createTextRange) {
// IE
var ra = text.createTextRange();
ra.moveStart("character", hotcat_last_v.length);
ra.moveEnd("character", suggestion.length);
ra.select();
} else if( is_khtml ) {
text.setSelectionRange( hotcat_last_v.length, suggestion.length );
} else {
text.selectionStart = hotcat_last_v.length ;
text.selectionEnd = suggestion.length ;
}
}
//</nowiki>
// [[:en:User:Lupin/popups.js]]
// Traduction de [[Utilisateur:Leag|Leag]] : [[Utilisateur:Leag/Navigation popups|Navigation popups]]
document.write('<script type="text/javascript" src="'
+ 'http://fr.wikipedia.org/w/index.php?title=User:Leag/popups-strings-fr.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popupsdev.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
/*
* OngletPurge
*
* Onglet permettant de réaliser une purge du cache
*
* Auteur : ??
* Dernière révision : 7 juin 2007
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]]
*/
function OngletPurge() {
if (wgNamespaceNumber >= 0 && !document.getElementById('toolbar')) {
addPortletLink('p-cactions', wgScriptPath + '/index.php?title=' + wgPageName + '&action=purge', 'purger', 'ca-purge', 'purger le cache de la page', 'p');
}
}
addOnloadHook(OngletPurge);
/*
* AddEditSection0
*
* Permet d'éditer la première section d'une page (en-tête)
*
* Auteur : ??
* Contributeur : Pabix, Zelda
* Dernière révision : 12 novembre 2006
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]]
*/
function addEditSection0() {
if (!document.getElementById) {
return;
}
var x = document.getElementById('ca-edit');
if(!x) {
return;
}
var y = document.createElement('LI');
y.id = 'ca-edit-0';
if (x.className == 'selected') {
if (/&action=edit§ion=0$/.test(window.location.href)) {
x.className = 'istalk';
y.className = 'selected';
} else {
x.className = 'selected istalk';
}
} else if (x.className == 'selected istalk') {
if (/&action=edit§ion=0$/.test(window.location.href)) {
x.className = 'istalk';
y.className = 'selected istalk';
} else {
y.className = 'istalk';
}
} else {
y.className = x.className;
x.className = 'istalk';
}
var z = document.createElement('A');
if (x.children) {
z.href = x.children[0].href + '§ion=0';
z.appendChild(document.createTextNode('en-tête'));
y.appendChild(z);
x.parentNode.insertBefore(y,x.nextSibling);
} else {
z.href = x.childNodes[0].href + '§ion=0';
z.appendChild(document.createTextNode('en-tête'));
y.appendChild(z);
x.parentNode.insertBefore(y,x.nextSibling);
}
}
if ( wgAction != "edit" && wgAction != "submit" ) {
addOnloadHook(addEditSection0);
}
//<source lang="javascript" line>
/*
* Deluxe Bar
*
* Barre d'outils d'édition étendue
*
* Auteur : Dake
* Modifié par : Sanao
* Dernière révision : 24 novembre 2007
*/
function DeluxeBar()
{
var messages_debut = new Array();
var messages_fin = new Array();
var images = new Array();
var commentaires = new Array();
var id_images = new Array();
with (messages_debut)
{
push(""); //Bienvenue sur ta page !
push(""); //Bienvenue !
push(""); //Blocage d'un vandale
push(""); //Avertissement vandalisme
push(""); //Avertissement copyvio
push(""); //Avertissement spam
push(""); //Fait
}
with (messages_fin)
{
push("{{Bienvenu}} [[Utilisateur:Draky|Draky]] 12 juillet 2008 à 21:26 (UTC)");
push("{{Bienvenue nouveau}} [[Utilisateur:Draky|Draky]] 12 juillet 2008 à 21:26 (UTC)");
push("{{Vandale bloqué|1|jour}} [[Utilisateur:Draky|Draky]] 12 juillet 2008 à 21:26 (UTC)");
push("{{Vandalisme|article}} [[Utilisateur:Draky|Draky]] 12 juillet 2008 à 21:26 (UTC)");
push("{{Copieur|article|page copiée}} [[Utilisateur:Draky|Draky]] 12 juillet 2008 à 21:26 (UTC)");
push("{{Bienvenue spammeur|article}} [[Utilisateur:Draky|Draky]] 12 juillet 2008 à 21:26 (UTC)");
push("{{Fait}} [[Utilisateur:Draky|Draky]] 12 juillet 2008 à 21:26 (UTC)");
}
with (images)
{
push("http://upload.wikimedia.org/wikipedia/commons/1/12/Button_accueilA.png");
push("http://upload.wikimedia.org/wikipedia/commons/e/eb/Button_accueilB.png");
push("http://upload.wikimedia.org/wikipedia/commons/0/00/Button_vandale.png");
push("http://upload.wikimedia.org/wikipedia/commons/a/a7/Button_smiley3.png");
push("http://upload.wikimedia.org/wikipedia/commons/5/58/Button_black_copyright.png");
push("http://upload.wikimedia.org/wikipedia/commons/f/fb/Button_spam2.png");
push("http://upload.wikimedia.org/wikipedia/commons/d/d9/Button_trait%C3%A9.png");
}
with (commentaires)
{
push("Bienvenue sur ta page !");
push("Bienvenue !");
push("Blocage d'un vandale");
push("Avertissement vandalisme");
push("Avertissement copyvio");
push("Avertissement spam");
push("Fait");
}
with (id_images)
{
push("bienvenue_sur_ta_page");
push("bienvenue");
push("blocage_vandale");
push("avertissement_vandalisme");
push("avertissement_copyvio");
push("avertissement_spam");
push("fait");
}
ajoutBoutonsToolbar(messages_debut, messages_fin, commentaires, images, id_images);
}
addOnloadHook(DeluxeBar);
//</source>
//<source lang="javascript" line>
/*
* Fonction
*
* Récupère la valeur d'une variable globale en gérant le cas lorsque cette variable n'existe pas
* @param nom_variable Nom de la variable dont on veut connaître la valeur
* @param val_defaut Valeur par défaut si la variable n'existe pas
* @return La valeur de la variable, ou val_defaut si la variable n'existe pas
*
* Auteur : Sanao
* Dernière révision : 22 novembre 2007
*/
function getVarValue(nom_variable, val_defaut)
{
var result = null;
try
{
result = eval(nom_variable.toString());
}
catch (e)
{
result = val_defaut;
}
return(result);
}
//</source>
/*
* Résumé Deluxe
*
* Ajoute des commentaires de modification prédéfinis
*
* Auteur : Dake
* Contributions : Pabix, Tieno
* Date de dernière révision : 12 novembre 2006
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]]
*/
//////////////////////ZONE PERSONNALISABLE//////////////////////
var resumedeluxeTitles = new Array();
with (resumedeluxeTitles) {
push("orthographe");
push("- typographie");
push("- catégorisation");
push("- interwiki");
push("- wikification");
push("- image");
push("- redirection");
push("- style");
push("- revert");
push("- réorganisation");
push("- réponse");
push("- maintenance");
push("- 1.0");
push("- homonymie");
push("- bandeau");
push("- infobox");
}
var resumedeluxeInputs= new Array();
with (resumedeluxeInputs) {
push("orthographe");
push("typographie");
push("catégorisation");
push("interwiki");
push("wikification");
push("image");
push("redirection");
push("style");
push("revert");
push("réorganisation");
push("réponse");
push("maintenance");
push("évaluation Wikipédia 1.0");
push("création homonymie");
push("ajout de bandeau");
push("infobox");
}
/////////////////FIN DE LA ZONE PERSONNALISABLE/////////////////
function setSummary(str)
{
document.editform.wpSummary.value = str;
}
function addToSummary(str)
{
var resum = document.editform.wpSummary.value;
if(resum != 0 && resum.indexOf("*/") < resum.length - 3) {
document.editform.wpSummary.value += " - ";
}
document.editform.wpSummary.value += str;
}
function DeluxeSummary()
{
if (document.URL.indexOf("§ion=new") > 0) return;
var sumLbl = document.getElementById("wpSummaryLabel");
if(sumLbl) {
var sumInput = document.getElementById("wpSummary");
sumInput.style.width = "95%";
var str = "Messages prédéfinis : ";
for(var cpt = 0; cpt < resumedeluxeTitles.length; cpt ++) {
var tmp = resumedeluxeInputs[cpt];
str += "<a href=\"javascript:addToSummary('" + tmp.replace( /[']/g , "\\'") + "')\""
+ " class=\"sumLink\" title=\"Ajouter dans la boîte de résumé\">"
+ resumedeluxeTitles[cpt]
+ "</a> ";
}
sumLbl.innerHTML = str + "<br />" + sumLbl.innerHTML;
}
}
addOnloadHook(DeluxeSummary);
/* Fenêtres arrondies (pour les navigateurs moz/firefox/gecko) */
.pBody {
padding: 0.3em 0.3em;
-moz-border-radius-topright: 0.5em;
}
.portlet h5 {
-moz-border-radius-topright: 0.5em;
}
#p-cactions ul li, #p-cactions ul li a {
-moz-border-radius-topright: 0.5em;
-moz-border-radius-topleft: 0.5em;
}