'+lstAvert[j].string+'';
}
// Get username of submitter
var user1 = getElementsByClass('diff-otitle',doc,'td');
if (user1 != null && user1[0] != null) {
var usertmp=user1[0].innerHTML;
user1 = usertmp.replace(new RegExp(/(.*)
(.*)<\/a> \((.*)<\/a> \(' +
// Verifier avant si le patrouilleur peut modifier cette page ? (query.php?what=permissions&titles=page)
'[' + lang_menu[0].UNDORC+'] • ' +
lang_menu[0].REASON+' : ••• ' +
'['+lang_menu[0].AVERTS+'] : ' +
'' +
' | ';
document.getElementById('LiveRevertMessage').focus();
}
}
function getLiveAverto(user) {
var link = document.getElementById('LiveAvertoLink');
link.href = "javascript:;";
link.style.color = "silver";
link.style.cursor = "default";
link.style.textDecoration = "none";
document.getElementById('averto').disabled = true;
var message = document.getElementById('averto').value;
wpajax.http({ url: wgServer + wgScriptPath + '/index.php?title=User_Talk:' + encodeURIComponent(user) + '&action=edit',
onSuccess: postLiveAverto,
user: user, message: message });
}
function postLiveAverto(xmlreq, data) {
var parser = new DOMParser();
var doc = parser.parseFromString(xmlreq.responseText, 'application/xhtml+xml');
var user = data.user;
var message = data.message.replace(new RegExp(/\\'/g),"'");
// Message au début
// var wpTextbox1 = encodeURIComponent('{{subst:' + message + '}} ~~~~\n' + doc.getElementById('wpTextbox1').value);
var wpTextbox1 = encodeURIComponent(doc.getElementById('wpTextbox1').value + '\n\n{{subst:' + message + '}} ~~~~\n');
var inputs = doc.getElementById('editform').getElementsByTagName('input');
var editform = new Array();
for (i=0; i
=== LiveHist ===
*/
function liveHist(page) {
var el = document.getElementById( 'livePreviewTitle' );
el.innerHTML="Hist : "+page+"...";
wpajax.http({url:wgServer + wgScriptPath + '/index.php?title=' + encodeURIComponent(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=''+c+'';
}
/*
=== LiveArticle ===
*/
function liveArticle(page) {
var el = document.getElementById( 'livePreviewTitle' );
el.innerHTML=""+page+"...";
wpajax.http({url:wgServer + wgScriptPath + '/index.php?title=' + encodeURIComponent(page) + '&redirect=no', onSuccess: getArticle, message: page });
}
function getArticle(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=''+c+'';
}
/*
=== LiveContrib ===
*/
function liveContrib(user) {
var el = document.getElementById( 'livePreviewTitle' );
el.innerHTML=""+user+"...";
wpajax.http({url:wgServer + '/wiki/Special:Contributions/'+encodeURIComponent(user),
onSuccess: getContrib, message: user });
}
function getContrib(xmlreq, data) {
doc = gml_XMLParse(xmlreq.responseText);
bC = doc.getElementById('bodyContent')
var user=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 utilde=user.replace(new RegExp(/\'/g), "\\'");
var optAvert = "";
var optl = lstAvert.length;
for (j=0; j'+lstAvert[j].string+'';
}
var entete = document.getElementById( 'livePreviewTitle' );
entete.innerHTML=''+user+'';
entete.innerHTML = '';
}
/*
=== LiveSuivi ===
*/
function liveSysop() {
wpajax.http({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);
}
liveNS();
}
function liveWatch() {
wpajax.http({url:wgServer + '/wiki/Special:Watchlist/edit',
onSuccess: getWatch, message: "Récup watchlist" });
}
function getWatch(xmlreq, data) {
var doc = gml_XMLParse(xmlreq.responseText);
var bC = doc.getElementById('bodyContent');
var info="";
var lstUL = bC.getElementsByTagName( 'ul' );
var lenUL = lstUL.length;
for(var j=0; j < lenUL ; j++) {
var lstLI = lstUL[j].getElementsByTagName( 'li' );
var lenLI = lstLI.length;
for(var i=0; i < lenLI ; i++) {
info=lstLI[i].getElementsByTagName( 'input' )[ 0 ].value;
lstSuivi.push(info);
lstSuiviHH.push("--:--");
}
}
liveRC();
}
/* function liveWatch() {
wpajax.http({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;
// document.getElementById('debug').innerHTML = a+"
**************************";
if(a.indexOf("= 0 ; i--) {
info=a[i].substr(0,a[i].indexOf("\" pageid"));
if (info == "") continue;
lstSuivi.push(info);
lstSuiviHH.push("--:--");
}
//document.getElementById('debug').innerHTML += lstSuivi;
} */
function liveNS() {
wpajax.http({url: wgServer + wgScriptPath + '/api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml',
onSuccess: getNS, message: "Récup NS" });
}
function getNS(xmlreq, data) {
var api = xmlreq.responseXML;
if (api.firstChild.nodeName == "error") return;
var nss = api.getElementsByTagName('query')[0].getElementsByTagName('namespaces')[0].getElementsByTagName('ns');
var len = nss.length;
var i;
var id,ns;
var options = "";
var lstNs = new Array();
for (i=0; i' + ns + '';
lstNs.push(id);
}
options = '' + options;
document.getElementById('selectNS').innerHTML = '';
liveWatch();
}
/*
=== LiveRC ===
*/
function supprLigne(quelLigne) {
var i,len;
var tab = document.getElementById('tabRC');
var els = new Array();
if (quelLigne == '*')
els = tab.getElementsByTagName('tr');
else if (quelLigne == 'd') {
var _els = tab.getElementsByTagName('tr');
len = _els.length;
for (i=len-1; i>=0; i--)
if (_els[i].firstChild.style.backgroundColor == 'rgb(255, 250, 205)')
els.push(_els[i]);
} else if (quelLigne == 'r') {
var _els = tab.getElementsByTagName('tr');
len = _els.length;
for (i=len-1; i>=0; i--)
if (_els[i].firstChild.style.backgroundColor == 'rgb(255, 228, 225)')
els.push(_els[i]);
} else if (quelLigne == 'n') {
var _els = tab.getElementsByTagName('tr');
len = _els.length;
for (i=len-1; i>=0; i--)
if (_els[i].firstChild.style.backgroundColor == 'rgb(226, 242, 210)')
els.push(_els[i]);
} else
els.push(document.getElementById(quelLigne));
len = els.length;
for (i=len-1; i>=0; i--)
if (els[i] != null)
tab.removeChild(els[i]);
}
function changeLigne(quelLigne) {
var el = document.getElementById(quelLigne);
var els1 = el.getElementsByTagName('th');
var els2 = el.getElementsByTagName('td');
var len = els1.length;
for (var i=len-1; i>=0; i--)
if (els1[i] != null)
els1[i].style.backgroundColor = "#FFFACD";
var len = els2.length;
for (var i=len-1; i>=0; i--)
if (els2[i] != null)
els2[i].style.backgroundColor = "#FFFFE0";
}
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 tsToHhMm(timestamp) {
var tz;
var match, regex = new RegExp();
if (lrcTZ) {
regex.compile(/^([-+])?(\d?\d):?(\d\d)$/);
match = regex.exec(lrcTZ);
if (!match) {
//livercError(lang_error.TZ);
return 'xx:xx';
}
tz = match[2]*60 + match[3]*1;
tz = match[1] == '-' ? -tz : tz;
} else {
var now = new Date();
tz = -now.getTimezoneOffset();
}
regex.compile(/^\d\d\d\d-\d\d-\d\dT(\d\d):(\d\d):\d\dZ$/);
match = regex.exec(timestamp);
if (!match) {
//livercError(lang_error.timestamp);
return 'xx:xx';
}
var tt = (match[1]*60 + match[2]*1 + tz + 1440) % 1440;
var mm = tt % 60;
var hh = (tt - mm) / 60 % 24;
return hh + ':' + (mm < 10 ? '0' : '') + mm;
}
function updateFollowContact() {
var tempAr = new Array();
for (var user in lstContact) {
var timestamp = lstContact[user].ts;
if (timestamp == 0) continue;
var utilde = user.replace(new RegExp(/\'/g), "\\'");
var udiscut = 'T';
var ucontrib = 'C';
var uadmin = '';
if (lrcAdmin == true) {
uadmin = ' • B';
}
var ueditor = ''+user+'';
var ligne = '' + tsToHhMm(timestamp) + ' • ' + udiscut + ' • ' + ucontrib + uadmin + ' • ' + ueditor + '
';
tempAr.push(ligne);
}
tempAr.sort();
var lvContact = document.getElementById('liveContact');
lvContact.innerHTML = "";
var len = tempAr.length;
for (var n=len-1; n>=0; n--)
lvContact.innerHTML += tempAr[n];
}
function updateFollowRevoc() {
var tempAr = new Array();
for (var user in lstRevoc) {
var timestamp = lstRevoc[user].ts;
var utilde = user.replace(new RegExp(/\'/g), "\\'");
var udiscut = 'T';
var ucontrib = 'C';
var uadmin = '';
if (lrcAdmin == true) {
uadmin = ' • B';
}
var ueditor = ''+user+'';
var ligne = '' + tsToHhMm(timestamp) + ' • ' + udiscut + ' • ' + ucontrib + uadmin + ' • ' + ueditor + ' (' + lstRevoc[user].nb + ' '+lang_menu[0].XTIMES+')
';
tempAr.push(ligne);
}
tempAr.sort();
var lvRevoc = document.getElementById('liveRevoc');
lvRevoc.innerHTML = "";
var len = tempAr.length;
for (var n=len-1; n>=0; n--)
lvRevoc.innerHTML += tempAr[n];
}
//function getRevision(xmlreq, data) {
function getRevision(rc) {
if (document.getElementById('stopLive').checked) return;
// var api = xmlreq.responseXML.getElementsByTagName('api')[0];
//
// if (api.firstChild.nodeName == "error") return;
var match, regex = new RegExp();
// var rc = data.rc
var title = rc.title;
var pageid = rc.pageid;
var revid = rc.revid;
var oldid = rc.old_revid;
var user = rc.user;
var comment = (rc.comment ? rc.comment : "");
var timestamp = rc.timestamp;
var ns = rc.ns;
var state = rc.state;
regex.compile(/\'/g);
var escTitle = title.replace(regex, "\\'");
var escUser = user.replace(regex, "\\'");
// var revisions = api.getElementsByTagName('query')[0].getElementsByTagName('pages')[0].getElementsByTagName('page')[0].getElementsByTagName('revisions')[0].getElementsByTagName('rev');
//
// var oldsize = (state & NEW ? 0 : revisions[1].textContent.length);
// var newsize = revisions[0].textContent.length
var oldsize = rc.oldlen
var newsize = rc.newlen
var sizediff = newsize - oldsize;
// INITIALISATION LIGNE RC //
var tr1 = document.createElement('tr');
var th0 = document.createElement('th');
var th1 = document.createElement('th');
var td2 = document.createElement('td');
var td3 = document.createElement('td');
var td4 = document.createElement('td');
// SUPPR. LIGNE //
th0.innerHTML = 'X';
// ARTICLE //
var arti = "", artiStyle = "";
var preArti = "", postArti = "";
var diff = "";
var diffClose = "";
if (lrcAutoCloseDiff == 1)
diffClose='supprLigne(\''+pageid+'_'+revid+'\');';
if (state & NEW)
diff = 'New';
else
diff = 'Diff';
var hist = 'H';
var edit = 'E';
var admin = '';
if (lrcAdmin == true) {
admin = ' • S';
}
// Disambig / Homonymie ? ;
///////////////////////////
if (ns == 0 && state & HOMONYMIE) {
artiStyle = 'color: darkorange; font-weight: bold; font-style: italic;';
preArti += '
'
}
// Page protégée ? ;
////////////////////
if (state & FULLLOCK)
preArti += '
';
if (state & LOCK)
preArti += '
';
// Copyright ? ;
//////////
if (state & COPYRIGHT)
preArti += '
';
// PàS ? ;
//////////////////
if (state & PAS)
preArti += '
';
// Intervention wikipompiers ? ;
////////////////////////////////
if (state & FIRE)
preArti += '
';
// Adq ? ;
//////////
if (state & ADQ)
postArti += '
';
// Bon article ? ;
//////////////////
if (state & BA)
postArti += '
';
// Article potentiellement de qualité ? ;
/////////////////////////////////////////
if (state & APDQ)
postArti += '
';
// Article catégorisé ? ;
/////////////////////////
var isCategorized = "";
if (!(state & REDIRECT)
&& !(state & HOMONYMIE)
&& ns == 0
&& !(state & CATEGORIZED))
postArti += '(cat ?)';
// Redirect ? ;
//////////////////
if (state & REDIRECT) {
artiStyle = 'color: green; font-weight: bold; font-style: italic;';
postArti += '
';
postArti += ''+rc.redirect+'';
/* if (rc.redirect) {
// postArti += ''+rc.redirect+'';
postArti += ''+rc.redirect+'';
} else {
regex.compile(/^#REDIRECT\s*\[\[(.*)\]\]/i);
match = regex.exec(revisions[0].textContent);
if (match) {
// postArti += ''+match[1]+'';
postArti += ''+match[1]+'';
} else {
// postArti += '/!\\';
postArti += ''+title+'';
}
} */
// arti = ''+title+'';
arti = ''+title+'';
} else {
// arti = ''+title+'';
// arti = ''+title+'';
arti = ''+title+'';
}
th1.innerHTML = '' + tsToHhMm(timestamp) + ' • ' + diff + ' • ' + hist + ' • ' + edit + admin + ' • '
+ preArti + arti + postArti;
th1.className="creator-title";
th1.style.border="1px";
th1.style.width="40%";
// EDITOR //
////////////
var discut = 'T';
var contrib = 'C';
var editor = "", preEditor = "";
// Bot ? ;
//////////
if (state & BOT)
preEditor += '
';
// Sysop ? ;
////////////
if (state & SYSOP)
preEditor += '
';
// Reverted ? ;
/////////////////
if (state & REVERT)
preEditor += '
';
// TOR potentiel / AOL
var isTOR = regex.compile(/172\.\d+\.\d+\.\d+/);
if (isTOR.test(user))
preEditor += '
';
editor = ''+user+'';
var uadmin = '';
if (lrcAdmin == true) {
uadmin = ' • B';
}
td2.innerHTML = '' + discut + ' • ' + contrib + uadmin + ' • '
+ preEditor + editor;
td2.className="creator-name";
td2.style.border = "1px";
td2.style.width = "20%";
if (lstRevoc[user]) {
td2.style.border = "2px solid red";
td2.innerHTML += '(' + lstRevoc[user].nb + ' révoc)'
}
// COMMENT //
// Remplace lien [[xxx]] par ;
var wcomment = comment.htmlize();
regex.compile(/\[\[(([^\]\|]*)(.*?))\]\]/g);
wcomment = wcomment.replace(regex, "$1");
regex.compile(/\>[^\]\|<]*\|([^\]\|<]*)$1<");
td3.innerHTML = "" + wcomment + "";
td3.style.border = "1px";
td3.style.width = "40%";
if (state & REVERT) {
th0.style.backgroundColor = "#FFE4E1";
th1.style.backgroundColor = "#FFE4E1";
td2.style.backgroundColor = "#FFE4E1";
td3.style.backgroundColor = "#FFE4E1";
td4.style.backgroundColor = "#FFE4E1";
tr1.style.border = "1px solid crimson";
}
if (state & BLANKING || newsize == 0) {
th0.style.backgroundColor = "white";
th1.style.backgroundColor = "white";
td2.style.backgroundColor = "white";
td3.style.backgroundColor = "white";
td4.style.backgroundColor = "white";
tr1.style.border = "2px double crimson";
}
if (state & NEW) {
th0.style.backgroundColor = "#e2f2d2";
th1.style.backgroundColor = "#e2f2d2";
td2.style.backgroundColor = "#e2f2d2";
td3.style.backgroundColor = "#e2f2d2";
td4.style.backgroundColor = "#e2f2d2";
tr1.style.border = "1px solid green";
}
if (state & IP) {
td2.style.backgroundColor = "white";
td3.style.backgroundColor = "white";
td4.style.backgroundColor = "white";
}
if (isTOR.test(user))
td2.style.backgroundColor = "pink";
if (state & REPLACED) {
th0.style.backgroundColor = "pink";
th1.style.backgroundColor = "pink";
td2.style.backgroundColor = "pink";
td3.style.backgroundColor = "pink";
td4.style.backgroundColor = "pink";
td4.innerHTML = '
';
tr1.style.border = "2px solid crimson";
}
// CONTACT LIST //
//////////////////
if (lstContact[user]) {
td2.style.border = "2px solid gold";
td2.style.backgroundColor = "yellow";
}
if (user == wgUserName) {
td2.style.border = "2px solid #A0B0E0";
td2.style.backgroundColor = "#F0F8FF";
}
// DELTA SIZE //
// delta de modif ;
///////////////////
var txtdiff = "";
if (sizediff < 0)
txtdiff = ''+sizediff+'';
else if (sizediff == 0)
txtdiff = '='+sizediff+'';
else
txtdiff = '+'+sizediff+'';
td4.innerHTML += txtdiff;
td4.style.border = "1px";
td4.style.textAlign = "right";
// ASSEMBLAGE LIGNE //
tr1.appendChild(th0);
tr1.appendChild(th1);
tr1.appendChild(td2);
tr1.appendChild(td3);
tr1.appendChild(td4);
tr1.id = pageid+"_"+revid;
var tab = document.getElementById( 'tabRC' );
var elold = document.getElementById(pageid+"_"+oldid);
if (tab.firstChild != null)
tab.insertBefore(tr1, tab.firstChild);
else
tab.appendChild(tr1);
if (elold == null) {
if (tab.childNodes.length > lrcRCLimit) {
var idt = tab.lastChild.id;
supprLigne(idt);
}
} else {
supprLigne(pageid+"_"+oldid);
}
// MISE A JOUR LISTES //
var spos = lstSuivi.indexOf(title);
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] = tsToHhMm(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 = 'Diff';
var shist = 'H';
var sarti = ''+lstSuivi[n]+'';
var ligne='' + lstSuiviHH[n] + ' • ' + sdiff + ' • ' + shist + ' • ' + sarti +'
';
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];
}
if (lstContact[user]) {
lstContact[user].ts = timestamp;
updateFollowContact();
}
if (state & REVERT) {
regex.compile(/\[\[Special:Contributions\/([^\]\|]+)/);
match = regex.exec(comment);
if (match) {
var userR = match[1];
if (userR != user && userR != wgUserName) {
if (!lstRevoc[userR]) lstRevoc[userR] = { ts: 0, nb: 0 };
lstRevoc[userR].ts = timestamp;
lstRevoc[userR].nb += 1;
updateFollowRevoc();
}
}
}
}
function getRedirCat(xmlreq, data) {
if (document.getElementById('stopLive').checked) return;
var yurik = xmlreq.responseXML.getElementsByTagName('yurik')[0];
if (yurik.firstChild.nodeName == "error") return;
var rc = data.rc;
var pageid = rc.pageid;
var revid = rc.revid;
var state = rc.state;
var page = yurik.getElementsByTagName('pages')[0].getElementsByTagName('page')[0];
if (page.getElementsByTagName('redirect').length) {
state += REDIRECT;
if (page.getElementsByTagName('redirect')[0].getElementsByTagName('to').length)
rc.redirect = page.getElementsByTagName('redirect')[0].getElementsByTagName('to')[0].textContent;
}
if (page.getElementsByTagName('categories').length) {
state += CATEGORIZED;
var categories = page.getElementsByTagName('categories')[0].getElementsByTagName('cl');
var i,j;
var leni = categories.length;
var lenj = categoriestests.length;
for (i=0; i=0; i--) {
if (rcs[i].getAttribute('revid') <= lastrevid) continue;
rc = new Object();
rc.state = 0;
lenj = rcs[i].attributes.length;
for (j=0; jX' +
'X' +
'X' +
'X' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'';
if (lrcPreviewHeight) document.getElementById('livePreview').style.height = lrcPreviewHeight;
var _lstContact = lstContact;
var _len = lstContact.length;
lstContact = new Array();
for (var _i=0; _i<_len; _i++)
lstContact[_lstContact[_i]] = { ts: 0 };
// Main
liveSysop();
}
});
/* */