Utilisateur:Ælfisc/vector.js
Apparence
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) ;
Firefox (sur GNU/Linux) / Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5.mw.loader.using('mediawiki.util', function () {
importScript('Utilisateur:Elfix/Image réimportée.js');
importScript('Utilisateur:Elfix/blanchir.js');
importScript('Utilisateur:Elfix/revertdiff.js');
importScript('Utilisateur:Elfix/resumedeluxe.js');
importScript("Utilisateur:Chphe/ContribColors.js");
importScript('Utilisateur:Phe/Clickodrome.js');
importScript('Utilisateur:Marin_M./inline.js'); // suite à http://fr.wikipedia.org/wiki/Wikip%C3%A9dia:Le_Bistro/29_janvier_2011#Encore_un_gadget_:_Inline
// ...
// POPUPS DE LUPIN, TRADUIT PAR LEAG.
// [[:en:User:Lupin/popups.js]]
// Traduction de [[Utilisateur:Leag|Leag]] : [[Utilisateur:Leag/Navigation popups|Navigation popups]]
popupQueriedRevertSummary="[[user:Leag/Navigation popups|Révocation]] jusqu'à la version du $2 de [[special:contributions/$3|$3]].";
popupAdminLinks=true;
// Onglet vers le Utilisateur:Elfix/Onglet
addOnloadHook(function() {
mw.util.addPortletLink('p-cactions', '/wiki/Special:CheckUser', 'Check User');
mw.util.addPortletLink('p-cactions', '/wiki/Special:CheckUser/log', 'CheckUser lastlog');
mw.util.addPortletLink('p-cactions', '/wiki/Spécial:Journal/newusers', 'Newusers lastlog');
});
// http://darkoneko.wordpress.com/2009/08/14/personnalisons-wikipedia-vous-avez-un-nouveau-message/
function youHaveANewFuckingMessage() {
div = document.body.getElementsByClassName("usermessage")[0]
if( !div) return
try {
div.getElementsByTagName("img")[0].nextSibling.nodeValue = " Vous avez fait "
} catch (e) {
return;
}
a = div.getElementsByTagName("a")
a[0].firstChild.nodeValue = "une nouvelle connerie"
a[1].firstChild.nodeValue = "clique si t'es un homme"
}
addOnloadHook(youHaveANewFuckingMessage)
// Barre d'édition (script trouvé chez gribeco).
function DeluxeBar() {
/* <nowiki> nowiki pour ne pas interprêter les caractères spéciaux de MediaWiki */
if (document.createTextNode) {
var toolbar = document.getElementById("toolbar");
if (!toolbar) return;
///// zone personnalisable ////
var messages = new Array()
var images = new Array()
var commentaires = new Array()
//messages.push("{{subst:Bienvenue sur ta page}}~~~~");
//commentaires.push("Bienvenue sur ta page !");
//images.push("/media/wikipedia/fr/e/eb/Button_accueilB.png");
messages.push("{{subst:Bienvenue}}[[Discussion Utilisateur:Elfix|Elfix]], ~~~~~.");
commentaires.push("Bienvenue sur Wikipédia !");
images.push("/media/wikipedia/commons/e/eb/Button_accueilB.png");
messages.push("");
commentaires.push("Correction d'une [[Projet:Restauration des ancres brisées|ancre brisée]].");
images.push("/media/wikipedia/commons/3/32/BTA-1.png");
messages.push("{{subst:Bienvenue débutant}}~~~~");
commentaires.push("Bienvenue débutant");
images.push("/media/wikipedia/commons/1/12/Button_accueilA.png");
messages.push("{{subst:test1}}~~~~");
commentaires.push("Avertissement");
images.push("/media/wikipedia/commons/1/1d/Bouton_Vandale1.png");
messages.push("{{subst:test2}}~~~~");
commentaires.push("Deuxième avertissement");
images.push("/media/wikipedia/commons/c/cc/Bouton_Vandale2.png");
messages.push("{{subst:test 3}}~~~~");
commentaires.push("Dernier avertissement.");
images.push("/media/wikipedia/commons/e/e4/Bouton_Vandale3.png");
messages.push("{{subst:Utilisateur:Elfix/Ir|Image:Nom de l'image|2=Raison (f)|3=date d'importation|site=adresse en http:// du site|OU : code du projet|Image=Nouvelle Image|et=(commentaire)}}");
commentaires.push("");
images.push("/media/wikipedia/commons/b/b0/Button_blocage.png");
messages.push("{{subst:Bienvenue spammeur}}~~~~");
commentaires.push("Avertissement spam");
images.push("/media/wikipedia/commons/f/fb/Button_spam2.png");
messages.push("{{Suppression}}");
commentaires.push("Proposition à la suppression selon la procédure des [[WP:PAS|pages à supprimer]].");
images.push("/media/wikipedia/commons/5/5f/Kcmsound_22px.png");
messages.push("{{subst:Utilisateur:Elfix/revvote}}");
commentaires.push("Vote invalide dans les pages à supprimer.");
images.push("/media/wikipedia/commons/f/f3/Button_broom2.png");
messages.push("[[Catégorie:Utilisateur bloqué indéfiniment|{{subst:PAGENAME}}]]");
commentaires.push("");
images.push("/media/wikipedia/commons/7/7e/Bouton_Vandale4.png");
messages.push("<br/>");
commentaires.push("");
images.push("/media/wikipedia/commons/c/c5/Button_br.png");
messages.push("# {{pour}} ~~~~");
commentaires.push("pour");
images.push("/media/wikipedia/commons/b/ba/Button_conserver.png");
messages.push("{{Utilisateur:Elfix/log/blocklog|date=|bloqueur=|bloqué=|exp=|params=|raison=}}");
commentaires.push("pour");
images.push("/media/wikipedia/commons/e/e8/Button_box_center_low_list.png");
////////////////////////////////
for (var i=0;i<messages.length;i++) {
var img = document.createElement("img");
img.setAttribute("src", images[i]);
var ref = document.createElement("a");
ref.setAttribute("href", "javascript:insertTags('', \"" + messages[i] + "\", '');" +
"javascript:changeSummary(\"" + commentaires[i] + "\");" );
ref.appendChild(img);
toolbar.appendChild(ref);
}
}
/* </nowiki> fin nowiki */
}
function changeSummary(sampleText) {
document.editform.wpSummary.value = sampleText;
}
$(DeluxeBar);
// ==================== ÉVALUATION
var alwaysEval = false; //mettez cette valeur à ''true'' si vous voulez que l'évaluation soit lancée automatiquement (à éviter en temps normal)
function initEvalProjectNames()
{
evalProjectNames=new Array(); //liste de vos projets
evalProjectNames.push("Fantasy") // Projet fantasy
}
// ==================== FIN ÉVAL
/// FIN
if(mw.config.get('wgAction')=='edit' || mw.config.get('wgAction')=='submit') {
/*Expressions régulières
*Auteur: ThomasV, Pathoschild
*Note : cet outil utilise la syntaxe javascript : on utilise $ (et pas \) pour appeler un groupe dans la chaîne de remplacement.
*Tutoriel : http://www.regular-expressions.info/tutorial.html
****/
/* create form */
function custom() {
/* if already open */
if(document.getElementById('regexform')) customremove()
else {
var editbox = document.getElementById('wpTextbox1');
/* container */
var regexform = document.createElement('div');
regexform.setAttribute('id','regexform');
editbox.parentNode.insertBefore(regexform,editbox.parentNode.firstChild);
/* form tag */
var formform = document.createElement('form');
formform.setAttribute('id','regexformform');
formform.setAttribute('onSubmit','customgo(); return false;');
regexform.appendChild(formform);
// add input boxes
var newinput = document.createElement('input');
newinput.setAttribute('id','formsearch');
var newlabel = document.createElement('label');
newlabel.setAttribute('for','formsearch');
newlabel.appendChild(document.createTextNode("Remplacer "));
formform.appendChild(newlabel);
formform.appendChild(newinput);
var newinput = document.createElement('input');
newinput.setAttribute('id','formreplace');
var newlabel = document.createElement('label');
newlabel.setAttribute('for','formreplace');
newlabel.appendChild(document.createTextNode(' par '));
formform.appendChild(newlabel);
formform.appendChild(newinput);
// go! link
var go_button = document.createElement('input');
go_button.setAttribute('type',"submit");
go_button.setAttribute('title',"go!");
go_button.setAttribute('value',"go!");
formform.appendChild(go_button);
}
}
/* run patterns */
function customgo() {
/* get search and replace strings */
search = document.getElementById('formsearch').value;
search = search.replace(/\\n/g, '\n');
replace = document.getElementById('formreplace').value;
replace = replace.replace(/\\n/g, '\n');
/* convert input to regex */
// without delimiters
if(!search.match(/^\s*\/[\s\S]*\/[a-z]*\s*$/i)) {
search = new RegExp(search,'g');
}
// with delimiters
else {
// break into parts
var regpattern = search.replace(/^\s*\/([\s\S]*)\/[a-z]*\s*$/i,'$1');
var regmodifiers = search.replace(/^\s*\/[\s\S]*\/([a-z]*)\s*$/,'$1');
// filter invalid flags
regmodifiers = regmodifiers.replace(/[^gim]/ig,'');
search = new RegExp(regpattern, regmodifiers);
}
/* perform */
var editbox = document.getElementById('wpTextbox1');
editbox.value = editbox.value.replace(search,replace);
}
/* remove form */
function customremove() {
var regexform = document.getElementById('regexform');
regexform.parentNode.removeChild(regexform);
patterncount = -1;
}
/*******************
*** create button
********************/
function add_regexp_button(){
var toolbar = document.getElementById("toolbar");
if(toolbar){
var image = document.createElement("img");
image.width = 23;
image.height = 22;
image.border = 0;
image.className = "mw-toolbar-editbutton";
image.style.cursor = "pointer";
image.alt = "regexp";
image.title = "Expression régulière";
image.src = "/media/wikipedia/commons/a/a0/Button_references_alt.png";
image.onclick = custom;
toolbar.appendChild(image);
}
}
addOnloadHook(add_regexp_button);
}
// FIN
//------------------------------------------------------------------
/* Special:Contributions Wildcard/CIDR lookup, version [0.1.4]
Originally from: http://en.wikipedia.org/wiki/User:Splarka/contribsrange.js
Notes:
* Uses the API (Requires http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=31312), which is faster than most CIDR contrib tools.
* Currently uses a GET json via <script src=""> to avoid ajax problems.
* Only currently works if submitted (or called by URL parameter, eg Special:Contributions/User).
** Checks namespace and date options in form.
* Uses: Submit any IP CIDR range /16 or from /24 to /32. Submit any string (at least 3 characters) with a suffixed asterisk.
** eg: [123.123.123.0/24 ] or [123.123.123.* ] or [Willy* ].
** NOTE: Currently seems broken with spaces in the search string. Possibly a fault of the API. %20,+,_ don't work
To do:
* Sortable by address? (not useful until pagination is available).
* More like normal Special:Recentchanges (hist)(diff) blah blah blah (except talk page existence for red/blue link) with BiDi characters?
* Option to refresh on page? (not really needed, but might be more handy than onload action only).
* Respect limit in user prefs? frm.limit.value ?
*/
if(mw.config.get('wgCanonicalSpecialPageName') == 'Contributions') {
addOnloadHook(prefixContribsInit);
var prefixlimit = 500;
var frm = ''; //global
}
function prefixContribsInit() {
var show = (document.getElementById('contentSub')) ? document.getElementById('contentSub') : document.getElementById('topbar')
show.appendChild(document.createTextNode(' \u2022 Javascript-enhanced contributions lookup enabled. You may enter a CIDR range or append an asterisk to do a prefix search.'))
frm = document.getElementsByTagName('form')[0];
if(!frm.target) return;
//general optionlets independant of type of search.
var opt_ns = (parseInt(frm.namespace[frm.namespace.selectedIndex].value) > -1) ? '&ucnamespace=' + frm.namespace[frm.namespace.selectedIndex].value : '';
var opt_ts = '';
if(queryString('ucstart')) {
opt_ts = '&ucstart=' + queryString('ucstart');
} else {
var m = '' + frm.month.selectedIndex;
var y = frm.year.value;
if(m.length == 1) m = '0' + m
if(y > 2000 && y < 2100) opt_ts = '&ucstart=' + y + '-' + m + '-01T00:00:00Z'
}
var options = opt_ns + opt_ts;
var patternCIDR = /(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/(2[4-9]|3[0-2]|16)/i ;
var patternWild = /^.{3,}\*$/i ;
if(frm.target.value.search(patternCIDR) == 0) {
prefixContribsStartbox(frm.parentNode);
var cidr = frm.target.value.match(patternCIDR)[0];
var range = cidr.match(/[^\/]\d{1,2}$/i)[0];
if(range == 24 || range == 16) {
//prefixable CIDR, lets do-er
if(range == 24) {
cidr = cidr.match(/\d{1,3}\.\d{1,3}\.\d{1,3}\./)[0];
} else {
cidr = cidr.match(/\d{1,3}\.\d{1,3}\./)[0];
}
var url = mw.config.get('wgScriptPath') + '/api.php?action=query&format=json&callback=prefixContribs&list=usercontribs' + options + '&uclimit=' + parseInt(prefixlimit) + '&ucuserprefix=' + cidr;
prefixContribsCall(url);
} else {
//complex CIDR, lets figure it out
var oct3 = cidr.match(/\.\d{1,3}\//i)[0].replace(/(\.|\/)/g,'');
cidr = cidr.match(/\d{1,3}\.\d{1,3}\.\d{1,3}\./)[0];
var num = Math.pow(2,32 - range);
var start = oct3 - oct3 % num;
var url = mw.config.get('wgScriptPath') + '/api.php?action=query&format=json&callback=prefixContribs&list=usercontribs' + options + '&uclimit=' + parseInt(prefixlimit) + '&ucuser=';
for(var i=start;i<=start + num;i++) {
url += '' + cidr + i;
if(i != start + num) url += '|'
}
prefixContribsCall(url);
}
} else if(frm.target.value.search(patternWild) == 0) {
//very simple wildcard, lets do-er
prefixContribsStartbox(frm.parentNode);
var prefix = frm.target.value.replace(/\*$/,'');
prefix = prefix.substr(0,1).toUpperCase() + prefix.substr(1);
var url = mw.config.get('wgScriptPath') + '/api.php?action=query&format=json&callback=prefixContribs&list=usercontribs' + options + '&uclimit=' + parseInt(prefixlimit) + '&ucuserprefix=' + prefix;
prefixContribsCall(url);
}
}
function prefixContribsStartbox(parent) {
var res = document.createElement('div');
res.setAttribute('id','results-from-CIDR');
res.style.border = '1px solid black';
res.style.padding = '.5em';
var prog = document.createElement('img');
prog.setAttribute('id','prefixcontribs-prog');
prog.setAttribute('src',stylepath + '/common/images/spinner.gif');
res.appendChild(prog);
parent.appendChild(res);
}
function prefixContribsCall(url) {
var scriptElem = document.createElement('script');
scriptElem.setAttribute('src',url);
scriptElem.setAttribute('type','text/javascript');
document.getElementsByTagName('head')[0].appendChild(scriptElem);
}
function compare_timestamp(a, b) {
if (a.timestamp < b.timestamp)
return 1;
if (a.timestamp > b.timestamp)
return -1;
return 0;
}
function prefixContribs(obj) {
if(!obj['query'] || !obj['query']['usercontribs']) return
var prog = document.getElementById('prefixcontribs-prog');
if(prog) prog.parentNode.removeChild(prog)
cidr = obj['query']['usercontribs'];
var res = document.getElementById('results-from-CIDR');
res.appendChild(document.createElement('hr'));
if(cidr.length == 0) {
res.appendChild(document.createTextNode('No changes were found for this wildcard/CIDR range.'));
res.appendChild(document.createElement('hr'));
return;
}
res.appendChild(document.createTextNode(cidr.length + ' matches in the wildcard/CIDR range specified (chronologically): '));
if(cidr.length == parseInt(prefixlimit)) {
res.appendChild(document.createElement('br'));
res.appendChild(document.createTextNode('Click '));
var ns = (parseInt(frm.namespace[frm.namespace.selectedIndex].value) > -1) ? '&namespace=' + frm.namespace[frm.namespace.selectedIndex].value : '';
var ts = (obj['query-continue']) ? obj['query-continue'].usercontribs.ucstart : cidr[cidr.length-1].timestamp;
addlinkchild(res, mw.config.get('wgScript') + '?title=Special:Contributions&target=' + encodeURIComponent(frm.target.value) + ns + '&ucstart=' + ts, 'here');
res.appendChild(document.createTextNode(' to see the next ' + prefixlimit + ' results.'));
}
cidr.sort(compare_timestamp);
res.appendChild(document.createElement('hr'));
for(var i=0;i<cidr.length;i++) {
res.appendChild(document.createTextNode('\u2022 ' + cidr[i].timestamp.replace(/T[\d:]*Z/,' ')));
addlinkchild(res, mw.config.get('wgScript') + '?title=Special:Contributions/' + cidr[i].user, cidr[i].user);
res.appendChild(document.createTextNode(' edited ('));
addlinkchild(res, mw.config.get('wgScript') + '?title=-&curid=' + cidr[i].pageid + '&diff=' + cidr[i].revid , 'diff');
res.appendChild(document.createTextNode(') '));
addlinkchild(res, mw.config.get('wgScript') + '?title=-&curid=' + cidr[i].pageid, cidr[i].title);
if(cidr[i].comment) res.appendChild(document.createTextNode(' (' + cidr[i].comment + ')'));
res.appendChild(document.createElement('br'));
}
}
function addlinkchild(obj,href,text,id,classes) {
if(!obj || !href || !text) return false;
var a = document.createElement('a');
a.setAttribute('href',href);
a.appendChild(document.createTextNode(text));
if(id) a.setAttribute('id',id);
if(classes) a.setAttribute('class',classes);
obj.appendChild(a);
}
function queryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches;
if (matches = re.exec(document.location)) {
try {
return decodeURI(matches[1]);
} catch (e) {
}
}
return null;
}
/*</source>*/
/* Fusion de contribs */
importScript('Utilisateur:Darkoneko/nekotb_fc_1.0.js')
});