/*
==LiveWP==
===Utilitaires===
<pre> */
var cwwpajax;
// From [[WP:US]] mainpage (wpajax renamed to cwwpajax)
cwwpajax={
download:function(bundle) {
// mandatory: bundle.url
// optional: bundle.onSuccess (xmlhttprequest, bundle)
// optional: bundle.onFailure (xmlhttprequest, bundle)
// optional: bundle.otherStuff OK too, passed to onSuccess and onFailure
var x = window.XMLHttpRequest ? new XMLHttpRequest()
: window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP")
: false;
if (x) {
x.onreadystatechange=function() {
x.readyState==4 && cwwpajax.downloadComplete(x,bundle);
};
x.open("GET",bundle.url,true);
x.send(null);
}
return x;
},
downloadComplete:function(x,bundle) {
x.status==200 && ( bundle.onSuccess && bundle.onSuccess(x,bundle) || true )
|| ( bundle.onFailure && bundle.onFailure(x,bundle) || alert(x.statusText));
}
};
// Parser
if (document.implementation.createDocument) {
var gml_xmlparser = new DOMParser();
}
function gml_XMLParse(string) {
if (document.implementation.createDocument) {
return gml_xmlparser.parseFromString(string, "text/xml");
} else if (window.ActiveXObject) {
var gml_xmldoc = new ActiveXObject("Microsoft.XMLDOM");
gml_xmldoc.async = "false";
ret = gml_xmldoc.loadXML(string);
if (!ret)
return null;
return gml_xmldoc.documentElement;
}
return null;
}
/* </pre>
=== LiveDiff ===
*Documentation : [[:fr:User:EDUCA33E/LiveRC/Documentation]]
*Author : [[:fr:User:EDUCA33E]]
*Version: 0.1.0 (beta)
<pre>*/
function liveDiff(page, id, oldid) {
var el = document.getElementById( 'livePreviewTitle' );
el.innerHTML="<b>Recherche du diff de : <span style='color:red'>"+page+"</span> en cours...</b>";
cwwpajax.download({url:wgServer + wgScriptPath + '/index.php?title='+encodeURI(page)+'&diff='+id+'&oldid='+oldid,
onSuccess: getDiff, mpage: page, mid: id, moldid:oldid});
}
function getDiff(xmlreq, data) {
var doc = gml_XMLParse(xmlreq.responseText);
var page=data.mpage;
var oldid=data.moldid;
var id=data.mid;
var bC = doc.getElementById('bodyContent');
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
var lD = getElementsByClass('diff',bC,null);
// Get username of submitter
var user1 = getElementsByClass('diff-otitle',doc,'td');
user1 = user1[0].getElementsByTagName('a')[2].innerHTML;
var user2 = getElementsByClass('diff-ntitle',doc,'td');
user2 = user2[0].getElementsByTagName('a')[2].innerHTML;
if (user2 == "défaire"){
user2 = getElementsByClass('diff-ntitle',doc,'td');
user2 = user2[0].getElementsByTagName('a')[3].innerHTML;
}
user1=user1.replace(new RegExp(/\'/g), "\\'");
user2=user2.replace(new RegExp(/\'/g), "\\'");
if(lD[0] == null)
LP.innerHTML = bC.innerHTML;
else
{
if(document.getElementById('showDiffR').checked) {
var avantEl = getElementsByClass('diff-deletedline',bC,null);
var apresEl = getElementsByClass('diff-addedline',bC,null);
var avant = "";
var apres = "";
var lav = avantEl.length;
var lap = apresEl.length;
for(var n=0; n < lav ; n++)
avant = avant + avantEl[n].innerHTML + "<br />";
for(var n=0; n < lap ; n++)
apres = apres + apresEl[n].innerHTML + "<br />";
LP.innerHTML = "<table width='100%'><tr><td width='50%' class='diff-deletedline'>"+avant+"</td><td class='diff-addedline'>"+apres+"</td></tr></table>";
}
else {
LP.innerHTML = "<table border='0' width='98%' cellpadding='0' cellspacing='4' class='diff'>"+lD[0].innerHTML+"</table>";
}
}
if(dLP.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
dLP.style.display = "inline";
}
var entete = document.getElementById( 'livePreviewTitle' );
entete.innerHTML='<b>Dernier diff de : <a href="'+wgServer+'/wiki/'+encodeURI(page)+'">'+page+'</a></b>';
entete.innerHTML = '<table width="100%" class="creator"><tr><td>'+entete.innerHTML +'</td><td align="right"><small>'+
'[<a href="javascript:var message=getLiveMessage(\'liverevert\',\''+user1+'\',\''+user2+'\',\''+page+'\',\''+oldid+'\');">Annuler</a>] • ' +
'[<a href="javascript:var message=getLiveMessage(\'livevandalism\',\''+user1+'\',\''+user2+'\',\''+page+'\',\''+oldid+'\');">Vandalism</a>] • ' +
'Raison : <input id="LiveRevertMessage" /> ••• ' +
'[<a href="javascript:var message=getLiveAverto(\''+user2+'\');">Avertir</a>] : ' +
'<select id="averto">' +
'<option value="Test 0">Test 0</option>' +
'<option value="Test 1">Test 1</option>' +
'<option value="Test 2">Test 2</option>' +
'<option value="Test 3">Test 3</option>' +
'<option value="Vandalisme|'+page+'">Vandal</option>' +
'<option value="Spammeur|'+page+'">Spam</option>' +
'<option value="Coucou">Coucou</option>' +
'<option value="Motivation_modif|'+page+'">Résumé</option>' +
'<option value="Signature">Signature</option>' +
'<option value="Bienvenue_copyright|'+page+'">Copyright</option>' +
'</select>' +
'</td></tr></table>';
}
function getLiveAverto(user) {
var averto = document.getElementById('averto').value;
averto=averto.replace(new RegExp(/\'/g), "\\'");
user=user.replace(new RegExp(/\'/g), "\\'");
window.open(wgServer+'/w/index.php?title=User_talk:'+user+'&action=edit&lwarn='+encodeURI(averto));
}
function getLiveMessage (where, user1, user2, page, oldid) {
var message = document.getElementById('LiveRevertMessage');
window.open(wgServer + '/w/index.php?title=' + page + '&action=edit&oldid=' + oldid + '&'+where+'=1&user1='+user1+'&user2='+user2+'&message='+encodeURI(message.value));
}
function queryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches;
if (matches = re.exec(document.___location)) {
try {
return decodeURI(matches[1]);
} catch (e) {
}
}
return null;
};
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;
addOnloadHook(function () {
if(___location.href.match(/liverevert=1/)) {
var message = "";
if(_GET['message'] != null && _GET['message'] !="" ) message=" ("+_GET['message']+")";
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']+']]) via LiveRC' + message;
document.getElementById('editform').submit();
}
});
addOnloadHook(function () {
if(___location.href.match(/livevandalism=1/)) {
var message = "";
if(_GET['message'] != null && _GET['message'] !="" ) message=" (_GET['message'])";
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']+']] via LiveRC)' + message;
document.getElementById('editform').submit();
}
});
addOnloadHook(function () {
if(___location.href.match(/lwarn=/)) {
var what = _GET['lwarn'];
Textbox1 = '{{subst:'+_GET['modele']+'}} ~~~~';
document.getElementById('wpSummary').value = 'Avertissement : '+what+' (via LiveRC)';
document.getElementById('wpTextbox1').value = '{{'+what+'}} ~~'+'~~\n' + document.getElementById('wpTextbox1').value;
document.getElementById('editform').submit();
}
});
//
/* </pre>
=== LiveHist ===
*Documentation : [[:fr:User:EDUCA33E/LiveRC/Documentation]]
*Author : [[:fr:User:EDUCA33E]]
*Version: 0.1.0 (beta)
<pre>*/
function liveHist(page) {
var el = document.getElementById( 'livePreviewTitle' );
el.innerHTML="<b>Recherche de l'historique de : <span style='color:red'>"+page+"</span> en cours...</b>";
cwwpajax.download({url:wgServer + wgScriptPath + '/index.php?title='+encodeURI(page)+'&action=history',
onSuccess: getHist, message: page });
}
function getHist(xmlreq, data) {
doc = gml_XMLParse(xmlreq.responseText);
bC = doc.getElementById('bodyContent')
var c=data.message;
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
LP.innerHTML = bC.innerHTML;
if(dLP.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
dLP.style.display = "inline";
}
var elt = document.getElementById( 'livePreviewTitle' );
elt.innerHTML='<b>Historique de : <a href="'+wgServer+'/wiki/'+encodeURI(c)+'">'+c+'</a></b>';
}
/* </pre>
=== LiveContrib ===
*Documentation : [[:fr:User:EDUCA33E/LiveRC/Documentation]]
*Author : [[:fr:User:EDUCA33E]]
*Version: 0.1.0 (beta)
<pre>*/
function liveContrib(user) {
var el = document.getElementById( 'livePreviewTitle' );
el.innerHTML="<b>Recherche des contributions de : <span style='color:red'>"+user+"</span> en cours...</b>";
cwwpajax.download({url:wgServer + wgScriptPath + 'iki/Special:Contributions/'+encodeURI(user),
onSuccess: getContrib, message: user });
}
function getContrib(xmlreq, data) {
doc = gml_XMLParse(xmlreq.responseText);
bC = doc.getElementById('bodyContent')
var c=data.message;
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
LP.innerHTML = bC.innerHTML;
if(dLP.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
dLP.style.display = "inline";
}
var elt = document.getElementById( 'livePreviewTitle' );
elt.innerHTML='<b>Contributions de : <a href="'+wgServer+'/wiki/User:'+encodeURI(c)+'">'+c+'</a></b>';
}
/* </pre>
=== LiveSuivi ===
*Documentation : [[:fr:User:EDUCA33E/LiveRC/Documentation]]
*Author : [[:fr:User:EDUCA33E]]
*Version: 0.1.0 (beta)
<pre>*/
var lstSysop = new Array();
function liveSysop() {
cwwpajax.download({url:wgServer + wgScriptPath + '/index.php?title=Special:Listusers&limit=500&group=sysop',
onSuccess: getSysop, message: "Récup sysoplist" });
}
function getSysop(xmlreq, data) {
var doc = gml_XMLParse(xmlreq.responseText);
var bC = doc.getElementById('bodyContent');
var lstSys = bC.getElementsByTagName( 'ul' )[ 0 ].getElementsByTagName( 'li' );
var info="";
var len = lstSys.length
for(var i=0; i < len ; i++)
{
info=lstSys[i].getElementsByTagName( 'a' )[ 0 ].innerHTML;
lstSysop.push(info);
}
}
var lstSuivi = new Array();
var lstSuiviHH = new Array();
function liveWatch() {
cwwpajax.download({url:wgServer + wgScriptPath + '/api.php?action=query&list=watchlist&wllimit=500&format=xml',
onSuccess: getWatch, message: "Récup watchlist" });
}
function getWatch(xmlreq, data) {
var a=xmlreq.responseText;
var c=data.message;
var i;
if(a.indexOf("<error>")!=-1) return; //cat is empty, nothing to do here
a=a.split("title=\"");
var info="";
for(i=a.length-1; i >= 0 ; i--)
{
info=a[i].substr(0,a[i].indexOf("\" pageid"));
if (info == "") continue;
lstSuivi.push(info);
lstSuiviHH.push("--:--");
}
}
var menu = '<input id="stopLive" type="checkbox" value="true" />' +
'<label for="stopLive">Pause</label>' +
'<input id="shidPrev" type="checkbox" onclick="showHideObj(this, \'divLivePreview\');" />' +
'<label for="shidPrev">Prévisualiser</label>' +
'<input id="shidList" type="checkbox" onclick="showHideObj(this, \'liveFollow\');" />' +
'<label for="shidList">Listes</label>' +
'<input id="showDiffR" type="checkbox" />' +
'<label for="showDiffR">Diff réduit</label>' +
'<input id="shidRC" type="checkbox" checked onclick="showHideObj(this, \'divTabRC\');" />' +
'<label for="shidRC">RC</label>' +
'<input id="showBot" type="checkbox" checked />' +
'<label for="showBot">Sans Bots</label>' +
'<input id="showIP" type="checkbox" />' +
'<label for="showIP">IP seules • </label>' +
'<span id="selectNS" />';
function liveNS() {
cwwpajax.download({url:wgServer + wgScriptPath + '/api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml',
onSuccess: getNS, message: "Récup NS" });
}
function getNS(xmlreq, data) {
var a=xmlreq.responseText;
var c=data.message;
var i;
if(a.indexOf("<error>")!=-1) return; //cat is empty, nothing to do here
//a = a.replace(new RegExp(/.ns id=.(.*)..(.*)...../g), "<ns>$1</ns><lib>$1</lib>");
//a = a.replace(new RegExp(/.ns id=.0. ../g), "<ns>0</ns><lib>Articles</lib>");
var nsid=a.split("<ns id=\"");
//var nslb=a.split("<lib>");
var info="";
var info2="";
var lstNS = '<option value="*">Tout</option>';
var len=nsid.length;
for(var i=1; i < len ; i++)
{
info =nsid[i].substr(0,nsid[i].indexOf("\""));
if (info == "") continue;
if(info==0)
info2 = "Articles";
else
info2=info +": "+nsid[i].substr(nsid[i].indexOf("\">")+2,nsid[i].indexOf("</ns>")-1);
lstNS = lstNS + '<option value="'+info+'">'+ info2 +'</option>';
}
var slcNS = document.getElementById( 'selectNS' );
slcNS.innerHTML = '<label for="showNS0">Espace </label><select id="showNS0">' + lstNS +'</select>';
}
function liveBlock() {
cwwpajax.download({url:wgServer + wgScriptPath + '/api.php?action=query&list=logevents&letype=block&format=xml',
onSuccess: getBlock, message: "Récup des blocages" });
}
function getBlock(xmlreq, data) {
var a=xmlreq.responseText;
var c=data.message;
var i;
var dbug = document.getElementById( 'debug' );
var xx=a.split("title=\"");
dbug.innerHTML = "Debug: <br />"+xx+"YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY<br />";
if(a.indexOf("<error>")!=-1) return; //cat is empty, nothing to do here
a = a.replace(new RegExp(/[.]*title="[.]*:(.*)"[.]*[/s][.]*<param>(.*)<\/param><param>[.]*<\/param>/g), "<user>$1</user><param>$2</param>");
dbug.innerHTML = dbug.innerHTML+"<br />XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br />"+a;
a = a.replace(new RegExp(/[^<][^u][.*](\s)/g), "$1");
dbug.innerHTML = dbug.innerHTML+"<br />XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br />"+a;
a = a.replace(new RegExp(/(\s)*/g), "$1");
dbug.innerHTML = dbug.innerHTML+"<br />XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br />"+a;
var us=a.split("<user");
var ti=a.split("<param>");
var user="";
var time="";
var len=us.length;
for(var i=1; i < len ; i++) {
user =us[i].substr(0,us[i].indexOf("</user>"));
if (user == "") continue;
time =ti[i].substr(0,ti[i].indexOf("</param>"));
var isRevoq = followRevoc.indexOf(user);
if(isRevoq != -1) {
followRevocHH[isrevoq] = "<span style='color:red'>lock/"+time+"</span>";
}
}
updateFollowRevoc();
}
/* </pre>
=== LiveRCparam ===
*Documentation : [[:fr:User:EDUCA33E/LiveRC/Documentation]]
*Author : [[:fr:User:EDUCA33E]]
*Version: 0.1.0 (beta)
<pre>*/
var rclimit = 30;
var lstContact = new Array();
document.write('<script type="text/javascript" src="'
+ wgServer + wgScriptPath + '/index.php?title=User:'+wgUserName+'/LiveRCparam.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
/* </pre>
=== LiveRC ===
*Documentation : [[:fr:User:EDUCA33E/LiveRC/Documentation]]
*Author : [[:fr:User:EDUCA33E]]
*Version: 0.1.0 (beta)
<pre> */
lstContact.push(wgUserName);
var dontShowThisRev = new Array();
function supprLigne(quelLigne) {
dontShowThisRev.push(quelLigne);
var tab = document.getElementById( 'tabRC' );
var el = document.getElementById( quelLigne );
if(el != null)
tab.removeChild(el);
}
function getElementsByClass(searchClass,node,tag) {
var classElements = new Array();
if ( node == null )
node = document;
if ( tag == null )
tag = '*';
var els = node.getElementsByTagName(tag);
var elsLen = els.length;
var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
for (i = 0, j = 0; i < elsLen; i++) {
if ( pattern.test(els[i].className) ) {
classElements[j] = els[i];
j++;
}
}
return classElements;
}
function updateFollowRevoc() {
var tempAr = new Array();
var len = followRevoc.length;
for (var n = 0; n < len; n++) {
var utilde = followRevoc[n].replace(new RegExp(/\'/g), "\\'");
var udiscut = '<a href="'+wgServer+'/wiki/User talk:'+encodeURI(followRevoc[n])+'" style="color:seagreen">D</a>';
var ucontrib = '<a href="javascript:;" onClick="liveContrib(\''+utilde+'\');" style="color:darkseagreen">C</a>';
var ueditor = '<a href="'+wgServer+'/wiki/User:'+encodeURI(followRevoc[n])+'">'+followRevoc[n]+'</a>';
var ligne = '<small>' + followRevocHH[n] +' • '+ udiscut +' • ' + ucontrib + ' • </small>' + ueditor + " (" + followRevocNb[n] + " fois)<br />";
tempAr.push(ligne);
}
tempAr.sort();
var lvRevoc = document.getElementById( 'liveRevoc' );
lvRevoc.innerHTML = "";
for (var n=len-1; n >= 0; n--) {
lvRevoc.innerHTML = lvRevoc.innerHTML + tempAr[n];
}
}
//var page_debug = document.getElementById( 'debug' );
//page_debug.innerHTML = "lstContact = " + lstContact;
var lstContactActif = new Array();
var lstContactActifHH = new Array();
var followRevoc=new Array();
var followRevocNb=new Array();
var followRevocHH=new Array();
function getRevision(xmlreq, data) {
if(document.getElementById('stopLive').checked) return;
var a=xmlreq.responseText;
var c=data.message;
var avant=data.avant;
var i;
if(a.indexOf("<error>")!=-1) return; //cat is empty, nothing to do here
a = a.replace(new RegExp(/(timestamp|revid|pageid|oldid|user|comment)=\"([^\"]*)?\"/g), "<$1>$2</$1>");
var us=a.split("<user>");
var co=a.split("<comment>");
var re=a.split("<revid>");
var pi=a.split("<pageid>");
var ol=a.split("<oldid>");
var ts=a.split("<timestamp>");
var user="";
var comment="";
var revid="";
var pageid="";
var oldid="";
var timestamp="";
var tab = document.getElementById( 'tabRC' );
for(i in us)
{
user =us[i].substr(0,us[i].indexOf("</user>"));
if (user == "") continue;
if(co[i] != null) comment=co[i].substr(0,co[i].indexOf("</comment>"));
revid =re[i].substr(0,re[i].indexOf("</revid>"));
pageid =pi[i].substr(0,pi[i].indexOf("</pageid>"));
oldid=avant; //oldid =ol[i].substr(0,ol[i].indexOf("</oldid>"));
timestamp =ts[i].substr(0,ts[i].indexOf("</timestamp>"));
timestamp = timestamp.replace(new RegExp(/.*T(.*):..Z/g), "$1");
var el = document.getElementById( pageid+"_"+revid );
var elold = document.getElementById( pageid+"_"+oldid );
if(dontShowThisRev.indexOf(pageid+"_"+revid) != -1) continue;
var ctilde = c.replace(new RegExp(/\'/g), "\\'");
var th0 = document.createElement( 'th' );
var th1 = document.createElement( 'th' );
var diff = '<a href="javascript:;" onClick="liveDiff(\''+ctilde+'\','+revid+','+oldid+');" style="color:orange">Diff</a>';
var hist = '<a href="javascript:;" onClick="liveHist(\''+ctilde+'\');" style="color:darkorange">Hist</a>';
var arti = '<a href="'+wgServer+'/wiki/'+encodeURI(c)+'">'+c+'</a>';
th0.innerHTML='<a href="javascript:;" onClick="supprLigne(\''+pageid+'_'+revid+'\');" style="color:red">X</a>';
th1.innerHTML='<small>' + timestamp + ' • ' + diff + ' • ' + hist + ' • </small>' + arti;
th1.className="creator-title";
th1.style.border="1px";
th1.style.width="40%";
var usertilde = user.replace(new RegExp(/\'/g), "\\'");
var td2 = document.createElement( 'td' );
var discut = '<a href="'+wgServer+'/wiki/User talk:'+encodeURI(user)+'" style="color:seagreen">D</a>';
var contrib = '<a href="javascript:;" onClick="liveContrib(\''+usertilde+'\');" style="color:darkseagreen">C</a>';
var editor = '<a href="'+wgServer+'/wiki/User:'+encodeURI(user)+'">'+user+'</a>';
if(lstSysop.indexOf(user) != -1)
editor = '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Broom_icon.svg/400px-Broom_icon.svg.png" width="16px" /> '+editor;
td2.innerHTML='<small>'+ discut +' • ' + contrib + ' • </small>' + editor;
td2.className="creator-name";
td2.style.border="1px";
td2.style.width="20%";
var td3 = document.createElement( 'td' );
td3.innerHTML="<small>"+comment+"</small>";
td3.style.border="1px";
td3.style.width="40%";
var tr1 = document.createElement( 'tr' );
if (comment.indexOf("Révocation") != -1
|| comment.indexOf("Annulation des modifications") != -1
|| comment.indexOf("Revert to revision") != -1
|| comment.indexOf("Revert to the revision") != -1) {
th0.style.backgroundColor = "#FFE4E1";
th1.style.backgroundColor = "#FFE4E1";
td2.style.backgroundColor = "#FFE4E1";
td3.style.backgroundColor = "#FFE4E1";
tr1.style.border = "1px solid crimson";
}
if (comment.indexOf("Résumé automatique : blanchiment") != -1) {
th0.style.backgroundColor = "white";
th1.style.backgroundColor = "white";
td2.style.backgroundColor = "white";
td3.style.backgroundColor = "white";
tr1.style.border = "2px double crimson";
}
if (comment.indexOf("Nouvelle page :") != -1) {
th0.style.backgroundColor = "#e2f2d2";
th1.style.backgroundColor = "#e2f2d2";
td2.style.backgroundColor = "#e2f2d2";
td3.style.backgroundColor = "#e2f2d2";
tr1.style.border = "1px solid green";
}
tr1.appendChild( th0 );
tr1.appendChild( th1 );
var isIP = new RegExp(/[\d]*\.[\d]*\.[\d]*\.[\d]*/);
if(isIP.test(user)) {
td2.style.backgroundColor = "white";
td3.style.backgroundColor = "white";
}
var isTOR = new RegExp(/172\.[\d]*\.[\d]*\.[\d]*/);
if(isTOR.test(user))
td2.style.backgroundColor = "pink";
if(lstContact.indexOf(user) != -1) {
td2.style.border = "2px solid gold";
td2.style.backgroundColor = "yellow";
var isActif = lstContactActif.indexOf(user);
if(isActif == -1) {
lstContactActif.push(user);
lstContactActifHH.push(timestamp);
}
else {
lstContactActifHH[isActif] = timestamp;
}
var lstActif = new Array();
var len = lstContactActif.length;
for (var n = 0; n < len; n++) {
var utilde = lstContactActif[n].replace(new RegExp(/\'/g), "\\'");
var udiscut = '<a href="'+wgServer+'/wiki/User talk:'+encodeURI(lstContactActif[n])+'" style="color:seagreen">D</a>';
var ucontrib = '<a href="javascript:;" onClick="liveContrib(\''+utilde+'\');" style="color:darkseagreen">C</a>';
var ueditor = '<a href="'+wgServer+'/wiki/User:'+encodeURI(lstContactActif[n])+'">'+lstContactActif[n]+'</a>';
var ligne = '<small>'+ lstContactActifHH[n] +' • ' + udiscut +' • ' + ucontrib + ' • </small>' + ueditor + "<br />"
lstActif.push(ligne)
}
lstActif.sort();
var lvContact = document.getElementById( 'liveContact' );
lvContact.innerHTML = "";
len = lstActif.length;
for (var n=len-1; n >= 0; n--) {
lvContact.innerHTML = lvContact.innerHTML + lstActif[n];
}
}
if(followRevoc.indexOf(user) != -1) {
td2.style.border = "2px solid red";
td2.innerHTML = td2.innerHTML + '<sup style="color:red">(' + followRevocNb[followRevoc.indexOf(user)] + ' révoc)</sup>'
}
tr1.appendChild( td2 );
tr1.appendChild( td3 );
if(el == null) {
tr1.id = pageid+"_"+revid;
if(tab.firstChild != null)
tab.insertBefore(tr1, tab.firstChild );
else
tab.appendChild(tr1);
if(elold == null) {
if (tab.childNodes.length > rclimit) {
// tab.removeChild(tab.lastChild);
var idt = tab.lastChild.id;
supprLigne(idt);
}
} else {
supprLigne(pageid+"_"+oldid);
}
var spos = lstSuivi.indexOf(c);
if(spos != -1) {
th0.style.border = "2px solid gold";
th0.style.backgroundColor = "yellow";
th1.style.border = "2px solid gold";
th1.style.backgroundColor = "yellow";
lstSuiviHH[spos] = timestamp;
var tempsAr = new Array();
var len = lstSuivi.length;
for (var n = 0; n < len; n++) {
if(lstSuiviHH[n] == "--:--") continue;
var cstilde = lstSuivi[n].replace(new RegExp(/\'/g), "\\'");
var sdiff = '<a href="javascript:;" onClick="liveDiff(\''+cstilde+'\',\'current\','+revid+');" style="color:orange">Diff</a>';
var shist = '<a href="javascript:;" onClick="liveHist(\''+cstilde+'\');" style="color:darkorange">Hist</a>';
var sarti = '<a href="'+wgServer+'/wiki/'+encodeURI(lstSuivi[n])+'">'+lstSuivi[n]+'</a>';
var ligne='<small>' + lstSuiviHH[n] + ' • ' + sdiff + ' • ' + shist + ' • </small>' + sarti +'<br />';
tempsAr.push(ligne);
}
tempsAr.sort();
len = tempsAr.length;
var lvSuivi = document.getElementById( 'liveSuivi' );
lvSuivi.innerHTML = "";
for (var n=len-1; n >= 0; n--) {
lvSuivi.innerHTML = lvSuivi.innerHTML + tempsAr[n];
}
}
var isRevoq = new RegExp(/(.*)ontributions\/(.*)\|(.*)\|(.*)/);
var isRevoqPopup = new RegExp(/(.*)(par|by|de) (.*) (grâce|using)(.*)/);
var match = isRevoq.exec(comment);
var matchPopup = isRevoqPopup.exec(comment);
var fpos = "";
var fposU = "";
if (match != null && match.length > 2) {
fposU = match[2];
fpos = followRevoc.indexOf(fposU);
}
if (matchPopup != null && matchPopup.length > 3) {
fposU = matchPopup[3];
fpos = followRevoc.indexOf(fposU);
}
if (fpos != "" && fposU != user) {
if(fpos == -1) {
followRevoc.push(fposU);
followRevocNb.push(1);
followRevocHH.push(timestamp);
}
else {
followRevocNb[fpos] += 1;
followRevocHH[fpos] = timestamp;
}
updateFollowRevoc();
}
}
}
}
function getContent(xmlreq, data) {
var a=xmlreq.responseText;
var c=data.message;
var el_content = document.getElementById( c );
var i;
if(a.indexOf("<error>")!=-1) return; //cat is empty, nothing to do here
a=a.split('<content xml:space="preserve">');
var content="";
for(i in a)
{
content=a[i].substr(0,a[i].indexOf("</content>"));
if (content == "") continue;
el_content.appendChild( document.createTextNode( content ) );
}
}
function getRC(xmlreq, data) {
if(document.getElementById('stopLive').checked) return;
var page_content = document.getElementById( 'content' );
var a=xmlreq.responseText;
var c=data.message;
var d=data.type;
var i;
if(a.indexOf("<error>")!=-1) return; //cat is empty, nothing to do here
a = a.replace(new RegExp(/ (title|revid|old_revid)=\"([^\"]*)?\"/g), " <$1>$2</$1>");
var ti=a.split("<title>");
var rv=a.split("<revid>");
var ol=a.split("<old_revid>");
var title="";
var revid="";
var oldrevid="";
var tab = document.getElementById( 'tabRC' );
for(i=ti.length-1; i >= 0 ; i--)
{
title=ti[i].substr(0,ti[i].indexOf("</title>"));
if (title == "") continue;
revid=rv[i].substr(0,rv[i].indexOf("</revid>"));
oldrevid=ol[i].substr(0,ol[i].indexOf("</old_revid>"));
cwwpajax.download({url:wgServer + wgScriptPath + '/api.php?action=query&prop=revisions&titles='+title+'&rvprop=timestamp|user|comment&format=xml',
onSuccess: getRevision, message: title, avant: oldrevid });
}
}
function liveRC() {
var rcshow = "";
var rcns = "";
timer= setTimeout("liveRC()",20000);
if(document.getElementById('stopLive').checked) return;
var slcNS = document.getElementById('showNS0');
if(slcNS != null) {
var ns = slcNS.value;
if(ns != null && ns != "*") rcns = '&rcnamespace='+ ns;
}
if(document.getElementById('showBot').checked) rcshow = '&rcshow=!bot';
if(document.getElementById('showIP').checked) rcshow = '&rcshow=anon';
cwwpajax.download({url:wgServer + wgScriptPath + '/api.php?action=query&list=recentchanges'+rcshow+rcns+'&rclimit='+rclimit+'&format=xml',
onSuccess: getRC, message: "Traitement en cours...\n\n" });
// liveBlock();
}
function showHideObj(parent, fils) {
var ofils = document.getElementById( fils );
if(parent.checked)
ofils.style.display="inline";
else
ofils.style.display="none";
}
addOnloadHook(function () {
if(wgTitle == "EDUCA33E/LiveRC") {
var top = document.getElementById( 'top' ); top.innerHTML = "";
var siteSub = document.getElementById( 'siteSub' );
var contentSub = document.getElementById( 'contentSub' );
var rtb = document.getElementById( 'RealTitleBanner' );
var rt = document.getElementById( 'RealTitle' );
var pca = document.getElementById( 'p-cactions' );
top.style.display = "none";
siteSub.style.display = "none";
contentSub.style.display = "none";
if(rtb != null) rtb.style.display = "none";
if(rt != null) rt.style.display = "none";
if(pca != null) pca.style.display = "none";
var lvPreviewFoot = document.getElementById( 'livePreviewFoot' );
lvPreviewFoot.innerHTML = menu;
// Main
liveWatch();
liveSysop();
liveNS();
liveRC();
}
});
// ////////////
/* </pre> */