User:EDUCA33E/LiveRC.js: Difference between revisions

Content deleted Content added
EDUCA33E (talk | contribs)
D=>Diff / N=>New
m Maintenance: Replacing addOnloadHook with native jQuery (mw:ResourceLoader/Migration_guide_(users)#addOnloadHook - phab:T130879)
 
(8 intermediate revisions by 3 users not shown)
Line 2:
==LiveWP==
*Documentation : [[:fr:User:EDUCA33E/LiveRC/Documentation]]
*AuthorsAuthor : [[:fr:User:EDUCA33E]], [[:fr:User:TiChou]] & [[:pl:User:Leafnode]]
*Dev & enhancements : [[:fr:User:TiChou]], [[:pl:User:Leafnode]], [[:it:User:Jalo]] & [[:fr:User:Nakor]] & [[:fr:User:Arkanosis]]
*Version: 0.3.5a (beta)
*Version: 0.3.9 (beta)
 
Version modifiée basée sur la version du 1er avril 2007 à 00:49 :
 
http://fr.wikipedia.org/w/index.php?title=User:EDUCA33E/LiveRC.js&oldid=15525649
 
=== Variables globales ===
 
<source lang="javascript"> */
<pre> */
 
if (mw.config.get('wgTitle') == "EDUCA33E/LiveRC") {
 
// Appel des paramètres par défaut de LiveRC ;
// ///////////////////////////////////////////
document.write('<script type="text/javascript" src="'
+ wgServer + wgScriptPath + '/index.php?title='+wgPageName+'/LiveRCparam.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
// Appel des paramètres utilisateur ;
// ///////////////////////////////////////////
document.write('<script type="text/javascript" src="'
+ wgServer + wgScriptPath + '/index.php?title=User:'+encodeURI(wgUserName)+'/LiveRCparam.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
var lastrevid,lasttimestamp=1; // Timestamp d'initialisation;
 
// Découpage de l'URL et de ses paramètres;
 
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[decodeURIComponent(_temp_get_arr_1[0])] = decodeURIComponent(_temp_get_arr_1[1]);
}
delete _uri; delete _temp_get_arr; delete _temp_get_arr_1;
 
// Variables d'état (pour test sur rc.state);
Line 65 ⟶ 36:
var PAS = 2 << 19;
var FIRE = 2 << 20;
 
var UPLOAD = 2 << 21;
var NEWUSER = 2 << 22;
var BLOCK = 2 << 23;
var DELETE = 2 << 24;
var MOVE = 2 << 25;
var PROTECT = 2 << 26;
var PATROL = 2 << 27;
var ABFILTER = 2 << 28;
var TAG = 2 << 29;
var REVIEW = 2 << 30;
 
/*
// ///////////////////////////////////// //
== Global variables / Variables globales ==
// ///////////////////////////////////// //
 
*/
 
var lrcRCLimit = 30; // LiveRC default RC list size;
var lrcPreviewHeight = '250px'; // LiveRC default preview window height;
var lrcAutoCloseDiff = 0; // LiveRC default Diff behaviour;
var lrcTZ = ''; // Default time zone (+02:00, 02:00, -0200, -05:45, ...)
 
/*
 
// //////////////////// //
== Internationalization ==
// //////////////////// //
 
*/
 
// Wiki specific translation;
// /////////////////////
var lang_category = 'Catégorie:';
var lang_category_short = '(cat ?)';
var lang_main_namespace = 'Articles';
 
// Menu translation;
// /////////////////
var lang_menu = [ {
PAUSE: "Pause",
PREVIEW: "Prévisualiser",
LISTS: "Listes",
LOWDIFF: "Diff réduit",
RCLABEL: "RC",
NOBOTS: "Sans Bots",
IPONLY: "IP seules",
IPNEW: "IP et débutant",
NAMESP: "Espace",
XTIMES: "fois",
UNDORC: "Défaire",
REVERT: "Révoquer",
REASON: "Motif",
AVERTS: "Avertir",
RVMES1: "[[User:EDUCA33E/LiveRC/Documentation|LiveRC]] : Révocation des modifications de",
RVMES2: "retour à la version de",
EMPTY: "Blanchir",
LOGSHOW: "Journaux",
ABSHOW: "Filtres"
} ];
 
var lang_tooltips = {
// main menu
HIDE_ALL: "Supprimer toutes les lignes",
HIDE_REVIEWED: "Supprimer les lignes des modifications visualisées",
HIDE_REVERTS: "Supprimer les lignes d'annulation",
HIDE_NEW: "Supprimer les lignes de création de page",
HIDE_BLANKING: "Supprimer les lignes de blanchiment",
HIDE_THIS: "Supprimer cette ligne",
// links in rows
DIFF_TIP: "Différence (prévisualisation)",
DIFF_SHORT: "Diff",
HIST_TIP: "Historique (prévisualisation)",
HIST_SHORT: "C",
EDIT_TIP: "Modifier (nouvelle fenêtre)",
EDIT_SHORT: "M",
DEL_TIP: "Supprimer (nouvelle fenêtre)",
DEL_SHORT: "S",
PROTECT_TIP: "Protéger (nouvelle fenêtre)",
PROTECT_SHORT: "P",
TALK_TIP: "Page de discussion (nouvelle fenêtre)",
TALK_SHORT: "T",
CONTRIB_TIP: "Contributions (prévisualisation)",
CONTRIB_SHORT: "C",
BLOCK_TIP: "Bloquer (Nouvelle fenêtre)",
BLOCK_SHORT: "B",
USER_HIDE_TIP: "Ignorer l'utilisateur",
USER_HIDE_SHORT:"H"
}
 
var lang_log = {
UPLOAD: 'Journal d\'import de fichiers',
NEWUSER: 'Journal des création de comptes utilisateur',
BLOCK: 'Journal des blocages',
DELETE: 'Journal des suppressions de page',
MOVE: 'Journal des renommages et déplacements',
PROTECT: 'Journal des protections'
};
 
var lang_messages = {
SAME_EDITOR: 'éditeur précédent identique',
WARNING: 'Avertissement',
ON_ARTICLE: 'sur'
};
 
// Comments test table (regexp format);
// ////////////////////////////////////
var commenttests = [
{ state: BLANKING , regex: /^Résumé automatique : blanchiment|^[Bb]lanchi/ },
{ state: REPLACED , regex: /^Résumé automatique : contenu remplacé par/ },
{ state: REVERT , regex: /(LiveRC : )?Révocation |([Bb]ot : )?[Aa]nnulation des modifications|([Bb]ot : )?[Rr]évocation de |^(Undid|Revert to( the)?) revision|^(Undoing|Reverted( \d+)?) edit|^r(e)?v(ert(ing|ed)?)?\b/ }
];
 
// Categories test table (regexp format);
var categoriestests = [
{ state: LOCK , regex: 'Page (semi-protégée|en semi-protection longue)' },
{ state: FULLLOCK , regex: 'Page protégée' },
{ state: HOMONYMIE , regex: 'Homonymie' },
{ state: ADQ , regex: 'Article de qualité( contesté)?' },
{ state: BA , regex: 'Bon article' },
{ state: APDQ , regex: 'Article potentiellement (bon|de qualité)' },
{ state: COPYRIGHT , regex: 'Article soupçonné de travail sous copyright' },
{ state: PAS , regex: 'Page proposée à la suppression' },
{ state: FIRE , regex: 'Wikipompiers' }
];
 
// LiveRC default template use;
// ////////////////////////////
var lstAvert = [
{ template: "Test 0" , string: "Test 0" , hasPage: false },
{ template: "Test 1" , string: "Test 1" , hasPage: false },
{ template: "Test 2" , string: "Test 2" , hasPage: false },
{ template: "Test 3" , string: "Test 3" , hasPage: false },
{ template: "Vandalisme" , string: "Vandal" , hasPage: true },
{ template: "Spammeur" , string: "Spam" , hasPage: true },
{ template: "Motivation_modif" , string: "Résumé" , hasPage: true },
{ template: "Signature" , string: "Signature" , hasPage: false },
{ template: "Bienvenue_copyright" , string: "Copyright" , hasPage: false },
{ template: "Vandalisme_cracra" , string: "Cracra" , hasPage: false }
];
 
// LiveRC default values for checkboxes
var lrcShowBotChecked = 'checked'; // change to 'checked' to show only IPs by default
var lrcShowIPChecked = ''; // change to 'checked' to show only IPs by default
var lrcShowIPNEWChecked = ''; // change to 'checked' to show only IPs and non-patrolled by default (sysops only)
var lrcShowRCChecked = 'checked'; // change to 'checked' to hide recent changes by default
var lrcShowLogChecked = ''; // change to 'checked' to show logs by default
var lrcShowFilterChecked = ''; // change to 'checked' to show filters by default
 
// Getting user params
// FIXME: works fine in Mozilla and Opera, does not work in Chrome and Safari
 
importScript(mw.config.get('wgPageName')+'/LiveRCparam.js');
importScript('User:'+mw.config.get('wgUserName')+'/LiveRCparam.js');
 
var cssNode = document.createElement('link');
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.href = 'http://pl.wikipedia.org/skins-1.5/common/diff.css?90';
cssNode.media = 'screen';
cssNode.title = 'dynamicLoadedSheet';
document.getElementsByTagName("head")[0].appendChild(cssNode);
 
document.write('<script type="text/javascript" src="http://pl.wikipedia.org/skins-1.5/common/diff.js?90"></script>');
 
var lastrcid=0,lastfilterid=0,lastlogid=0,lastrctimestamp=1,lastletimestamp=1,lastafltimestamp=1; // Timestamp d'initialisation;
// Découpage de l'URL et de ses parametres;
 
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[decodeURIComponent(_temp_get_arr_1[0])] = decodeURIComponent(_temp_get_arr_1[1]);
}
delete _uri; delete _temp_get_arr; delete _temp_get_arr_1;
 
 
 
var lstSysop = new Array(); // Sysop list;
var lstContact = new Array(); // Contact list;
var lstContact2 = new Array(); // Contact list;
var lstRevoc = new Array(); // Reverted list;
var lstHidden = new Array(); // Hidden users list;
 
// Has user patrol rights?
var lrcPatrol = false;
var lrcAPIlimit = 500;
if(mw.config.get('wgUserGroups').indexOf("autopatrolled") != -1)
lrcPatrol = true;
// Is user Sysop;
var lrcAdmin = false; // default value;
if(mw.config.get('wgUserGroups').indexOf("sysop") != -1)
{
lrcAdmin = true;
lrcPatrol = true;
}
 
// Watchlist;
Line 80 ⟶ 243:
}
 
/* </presource>
 
===Utilities===
 
<source lang="javascript"> */
<pre> */
var wpajax = {
http: function(bundle) {
Line 138 ⟶ 301:
};
 
///////////////////////////////////////////////////////////////////////////////
// Parser
// * Recherche d'un élement dont on connait l'Id mais non unique, donc sans utiliser document.getElementById()
if (document.implementation.createDocument) {
// Thanks to Dr Brains
var gml_xmlparser = new DOMParser();
function getElementWithId( elementId , elementTagName , elementParentNode ){
if(!elementParentNode) elementParentNode = document;
if (elementParentNode.getElementById) return elementParentNode.getElementById(elementId);
var TheElement = false;
var Elements = elementParentNode.getElementsByTagName(elementTagName);
var elementcount = 0;
while(elementcount<Elements.length){
var Id = Elements[elementcount].getAttribute('id');
if(Id){
if(Id==elementId){
TheElement = Elements[elementcount];
break;
}
}
elementcount++
}
if (! TheElement) return null;
return TheElement;
}
///////////////////////////////////////////////////////////////////////////////
 
 
function getRights(xmlreq, data) {
var api = xmlreq.responseXML;
 
if (api.firstChild.nodeName == "error") return;
 
var rights = api.getElementsByTagName('query')[0].getElementsByTagName('userinfo')[0].getElementsByTagName('rights')[0].getElementsByTagName('r');
var len = rights.length;
var i;
var id,right;
 
for (i=0; i<len; i++) {
right = rights[i].textContent;
// Handle IE
if (!right)right = rights[i].text;
 
if (right == "apihighlimits") lrcAPIlimit=5000;
if (right == "autopatrol") lrcPatrol=true;
}
buildControlBar();
}
 
function buildControlBar()
{
var top = document.getElementById( 'top' );
if (top != null) {
top.innerHTML = "";
top.style.display = "none";
}
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' );
 
if (siteSub != null) siteSub.style.display = "none";
if (contentSub != null) 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 showIPNEWbox = '';
if (lrcPatrol)
showIPNEWbox = '<input id="showIPNEW" type="checkbox" ' + lrcShowIPNEWChecked + '/>' +
'<label for="showIPNEW">' + lang_menu[0].IPNEW + ' </label>';
 
var lvPreviewFoot = document.getElementById( 'livePreviewFoot' );
lvPreviewFoot.innerHTML = '<a href="javascript:;" onClick="supprLigne(\'*\');" style="color: red; font-weight: bold;" title="'+lang_tooltips.HIDE_ALL+'">X</a> | ' +
'<a href="javascript:;" onClick="supprLigne(\'d\');" style="color: rgb(255, 235, 71); font-weight: bold;" title="'+lang_tooltips.HIDE_REVIEWED+'">X</a> ' +
'<a href="javascript:;" onClick="supprLigne(\'r\');" style="color: rgb(255, 99, 83); font-weight: bold;" title="'+lang_tooltips.HIDE_REVERTS+'">X</a> ' +
'<a href="javascript:;" onClick="supprLigne(\'n\');" style="color: rgb(178, 243, 113); font-weight: bold;" title="'+lang_tooltips.HIDE_NEW+'">X</a> ' +
'<a href="javascript:;" onClick="supprLigne(\'c\');" style="color: white; font-weight: bold;" title="'+lang_tooltips.HIDE_BLANKING+'">X</a>' +
'<input id="stopLive" type="checkbox" value="true" />' +
'<label for="stopLive">' + lang_menu[0].PAUSE + '</label>' +
' &bull; ' +
'<input id="shidPrev" type="checkbox" onclick="showHideObj(this, \'divLivePreview\');" />' +
'<label for="shidPrev">' + lang_menu[0].PREVIEW + '</label>' +
'<input id="showDiffR" type="checkbox" />' +
'<label for="showDiffR">'+ lang_menu[0].LOWDIFF + '</label>' +
' &bull; ' +
'<input id="shidList" type="checkbox" onclick="showHideObj(this, \'liveFollow\');" />' +
'<label for="shidList">' + lang_menu[0].LISTS + '</label>' +
' &bull; ' +
'<input id="showBot" type="checkbox" ' + lrcShowBotChecked + ' />' +
'<label for="showBot">' + lang_menu[0].NOBOTS + '</label>' +
'<input id="showIP" type="checkbox" ' + lrcShowIPChecked + '/>' +
'<label for="showIP">' + lang_menu[0].IPONLY + ' </label>' +
showIPNEWbox +
' &bull; ' +
'<input id="showRC" type="checkbox" ' + lrcShowRCChecked + ' />' +
'<label for="showRC">' + lang_menu[0].RCLABEL + ' </label>' +
'<input id="showLog" type="checkbox" ' + lrcShowLogChecked + '/>' +
'<label for="showLog">' + lang_menu[0].LOGSHOW + ' </label>' +
'<input id="showFilter" type="checkbox" ' + lrcShowFilterChecked + '/>' +
'<label for="showFilter">' + lang_menu[0].ABSHOW + ' • </label>' +
'<span id="selectNS" />';
 
if (lrcPreviewHeight) document.getElementById('livePreview').style.height = lrcPreviewHeight;
 
liveSysop();
}
 
// Parser
if (window.DOMParser) var gml_xmlparser = new DOMParser();
 
function gml_XMLParse(string) {
if (documentwindow.implementation.createDocumentDOMParser) {
return gml_xmlparser.parseFromString(string, "text/xml");
} else if (window.ActiveXObject) {
Line 161 ⟶ 433:
var chars = new Array('&','<','>','"');
var entities = new Array('amp','lt','gt','quot');
var regex = new RegExp();
var string = this;
for (var i=0; i<chars.length; i++) {
var regex.compile = new RegExp(chars[i], "g");
string = string.replace(regex, '&' + entities[i] + ';');
}
Line 170 ⟶ 441:
}
 
/* </presource>
 
=== LiveDiff ===
 
<source lang="javascript"> */
<pre> */
 
function liveDiff(page, id, oldid) {
var el = document.getElementById( 'livePreviewTitle' );
el.innerHTML="<b style='text-decoration: blink;'>Diff : <span style='color:red'>"+page+"</span>...</b>";
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title='+encodeURIComponent(page)+'&diffonly=1&diff='+id+'&oldid='+oldid,
onSuccess: getDiff, mpage: page, mid: id, moldid:oldid});
}
 
function getDiff(xmlreq, data) {
// temporary fix for incorrect HTML code
var doc = gml_XMLParse(xmlreq.responseText);
var text = xmlreq.responseText;
var newtext = text.replace(/&nbsp<span class=\"mw-revdelundel-link/g, "&nbsp;<span class=\"mw-revdelundel-link");
var doc = gml_XMLParse(newtext);
var page=data.mpage;
var oldid=data.moldid;
var id=data.mid;
var bC = doc.getElementByIdgetElementWithId('bodyContent', 'div', doc);
if (bC == null) bC = getElementWithId('article', 'div', doc);
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
Line 195 ⟶ 470:
var upage=page.replace(new RegExp(/\'/g), "\\'");
 
if (lD[0] == null) {
LP.innerHTML = bC.innerHTML;
if (LP.innerHTML == "undefined") LP.innerHTML = bC.xml;
}
else {
if (document.getElementById('showDiffR').checked) {
var avantEl = getElementsByClass('diff-deletedline',bC,null);
var apresEl = getElementsByClass('diff-addedline',bC,null);
var rollback = getElementsByClass('mw-rollback-link',bC,null);
if (rollback[0] == null)
var rl = "";
else
var rl = rollback[0].innerHTML+"<br />";
var avant = "";
var apres = "";
Line 209 ⟶ 491:
for(var n=0; n < lap ; n++)
apres = apres + apresEl[n].innerHTML + "<br />";
LP.innerHTML = rl+"<table width='100%'><tr><td width='50%' class='diff-deletedline'>"+avant+"</td><td class='diff-addedline'>"+apres+"</td></tr></table>";
}
else {
Line 219 ⟶ 501:
elcb.checked="true";
dLP.style.display = "inline";
}
if (typeof (setupTooltips) != 'undefined') {
setupTooltips(dLP, false, true);
}
 
var entete = document.getElementById( 'livePreviewTitle' );
entete.innerHTML='<b><a href="'+mw.config.get('wgServer') + '/wiki/' + encodeURI(page) + '" target="_new">' + page + '</a></b> • ' +
'(<a href="javascript:;" onClick="liveHist(\''+upage+'\');" style="color:darkorange">Hist</a>)';
 
var asNextDiff = doc.getElementByIdgetElementWithId("'differences-nextlink"', 'a', doc);
if ((asNextDiff == null) && lrcPatrol) {
var optAvert = "";
var optl = lstAvert.length;
Line 236 ⟶ 521:
 
// Get username of submitter
var user1 = getElementsByClassgetElementWithId('mw-diff-otitleotitle2',doc, 'tddiv', doc);
if (user1 != null) && user1[0] != null){
user1var usertmp= user1[0].getElementsByTagName('a')[2].innerHTML;
if (!usertmp) usertmp=user1.firstChild.xml;
var user2 = getElementsByClass('diff-ntitle',doc,'td');
// user1 = usertmp.replace(new RegExp(/<a (.*)>(.*)<\/a> \(<a(.*)/g), "$2");
if (user2 != null && user2[0] != null)
user1 = usertmp.replace(new RegExp(/<a (.*)>(.*)<\/a>(.*)\((.*)\)/g), "$2");
user2 = user2[0].getElementsByTagName('a')[2].innerHTML;
user1 = user1.replace(new RegExp(/(.*)<(.*)>/g), "$1");
if (user2 == "défaire") {
}
user2 = getElementsByClass('diff-ntitle',doc,'td');
var user2 = getElementWithId('mw-diff-ntitle2', 'div', doc);
user2 = user2[0].getElementsByTagName('a')[3].innerHTML;
if (user2 != null) {
var usertmp=user2.innerHTML;
if (!usertmp) usertmp=user2.firstChild.xml;
// user2 = usertmp.replace(new RegExp(/<a (.*)>(.*)<\/a> \(<a(.*)/g), "$2");
user2 = usertmp.replace(new RegExp(/<a (.*)>(.*)<\/a>(.*)\(<a(.*)/g), "$2");
}
user1=user1.replace(new RegExp(/\'/g), "\\'");
user2=user2.replace(new RegExp(/\'/g), "\\'");
var identique="";
if(user1 == user2) {
identique = "<b style='color:red'>[" + lang_messages.SAME_EDITOR + "]</b> ";
}
 
entete.innerHTML = '<table width="100%" class="creator"><tr><td>' + entete.innerHTML +
'</td><td align="right"><small>' + identique +
// Verifier avant si le patrouilleur peut modifier cette page ? (query.php?what=permissions&titles=page)
'[<a id="LiveRevertLink" href="javascript:getLiveMessage(\'liverevert\',\''+user1+'\',\''+user2+'\',\''+upage+'\',\''+oldid+'\');" >' + lang_menu[0].UNDORC+'</a>] • ' +
Line 269 ⟶ 563:
document.getElementById('averto').disabled = true;
var message = document.getElementById('averto').value;
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title=User_Talk:' + encodeURIComponent(user) + '&action=edit',
onSuccess: postLiveAverto,
user: user, message: message });
Line 279 ⟶ 573:
 
var user = data.user;
var message = data.message.replace(new RegExp(/\\'/g),"'");
 
var wpTextbox1 = encodeURIComponent(doc.getElementById('wpTextbox1').value + '\n\n{{subst:' + message + '}} ~~~~\n' + doc.getElementById('wpTextbox1').value);
 
var inputs = doc.getElementById('editform').getElementsByTagName('input');
Line 292 ⟶ 586:
var wpEditToken = encodeURIComponent(editform['wpEditToken']);
 
var wpSummary = encodeURIComponent('LiveRC : Avertissement' !+ lang_messages.WARNING + ' ' + message.replace(new RegExp(/\|(.*)/), ' sur [[$1]]') + ' !');
' ' + lang_messages.ON_ARTICLE + ' [[$1]]') + ' !');
 
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title=User_Talk:' + encodeURI(user) + '&action=submit',
method: "POST", headers: headers,
data: 'wpSave=1&wpTextbox1=' + wpTextbox1 + '&wpStarttime=' + wpStarttime + '&wpEdittime=' + wpEdittime
Line 313 ⟶ 608:
document.getElementById('LiveRevertMessage').disabled = true;
var message = document.getElementById('LiveRevertMessage').value;
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title=' + encodeURI(page) + '&action=edit&oldid=' + oldid,
onSuccess: postLiveRevert,
where: where, page: page, user1: user1, user2: user2, message: message });
Line 346 ⟶ 641:
/* case 'livevandalism':
var wpSummary = 'LiveRC : Révocation de vandalisme par [[Special:Contributions/' + user2 + '|' + user2
+ ']]; retour àa la version de [[User:' + user1 + '|' + user1 + ']]';
break; */
}
Line 355 ⟶ 650:
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title=' + encodeURIComponent(page) + '&action=submit',
method: "POST", headers: headers,
data: 'wpSave=1&wpTextbox1=' + wpTextbox1 + '&wpStarttime=' + wpStarttime + '&wpEdittime=' + wpEdittime
Line 361 ⟶ 656:
}
 
/* </presource>
 
=== LiveHist ===
 
<source lang="javascript"> */
<pre> */
 
function liveHist(page) {
var el = document.getElementById( 'livePreviewTitle' );
el.innerHTML="<b style='text-decoration: blink;'>Hist : <span style='color:red'>"+page+"</span>...</b>";
wpajax.http({url:wgServer + mw.config.get('wgScriptPath') + '/index.php?title=' + encodeURIComponent(page) + '&action=history', onSuccess: getHist, message: page });
}
 
function getHist(xmlreq, data) {
doc = gml_XMLParse(xmlreq.responseText);
bC = doc.getElementByIdgetElementWithId('bodyContent', 'div', doc);
if (bC == null) bC = getElementWithId('article', 'div', doc);;
var c=data.message;
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
LP.innerHTML = bC.innerHTML;
if (LP.innerHTML == "undefined") LP.innerHTML = bC.xml;
if (dLP.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
Line 386 ⟶ 683:
}
var elt = document.getElementById( 'livePreviewTitle' );
elt.innerHTML='<b><a href="'+mw.config.get('wgServer')+'/wiki/'+encodeURIComponentencodeURI(c)+'" target="_new">'+c+'</a></b>';
}
 
/* </presource>
 
=== LiveArticle ===
 
<source lang="javascript"> */
<pre> */
 
function liveArticle(page) {
var el = document.getElementById( 'livePreviewTitle' );
el.innerHTML="<b style='text-decoration: blink;'><span style='color:red'>"+page+"</span>...</b>";
wpajax.http({url:wgServer + mw.config.get('wgScriptPath') + '/index.php?title=' + encodeURIComponent(page) + '&redirect=no', onSuccess: getArticle, message: page });
}
 
function getArticle(xmlreq, data) {
doc = gml_XMLParse(xmlreq.responseText);
bC = doc.getElementByIdgetElementWithId('bodyContent', 'div', doc);
if (bC == null) bC = getElementWithId('article', 'div', doc);
var c=data.message;
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
LP.innerHTML = bC.innerHTML;
if (LP.innerHTML == "undefined") LP.innerHTML = bC.xml;
if (dLP.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
Line 414 ⟶ 713:
}
var elt = document.getElementById( 'livePreviewTitle' );
elt.innerHTML='<b><a href="'+mw.config.get('wgServer')+'/wiki/'+encodeURI(c)+'" target="_new">'+c+'</a></b>';
}
 
/* </presource>
 
=== LiveContrib ===
 
<source lang="javascript"> */
<pre> */
 
function liveContrib(user) {
Line 432 ⟶ 731:
function getContrib(xmlreq, data) {
doc = gml_XMLParse(xmlreq.responseText);
bC = doc.getElementByIdgetElementWithId('bodyContent', 'div', doc);
if (bC == null) bC = getElementWithId('article', 'div', doc);
var user=data.message;
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
LP.innerHTML = bC.innerHTML;
if (LP.innerHTML == "undefined") LP.innerHTML = bC.xml;
if (dLP.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
Line 452 ⟶ 753:
 
var entete = document.getElementById( 'livePreviewTitle' );
entete.innerHTML='<b><a href="'+mw.config.get('wgServer')+'/wiki/User:'+encodeURIComponent(user)+'" target="_new">'+user+'</a></b>';
entete.innerHTML = '<table width="100%" class="creator"><tr><td>'+entete.innerHTML +
'</td><td align="right"><small>' +
Line 459 ⟶ 760:
}
 
/* </presource>
 
=== LiveSuiviLiveLog (:it:User:Jalo) ===
 
<source lang="javascript"> */
<pre> */
function liveLog(action,page) {
var titolo = '';
switch(action) {
case 'upload':
titolo = lang_log.UPLOAD;
break;
case 'newusers':
titolo = lang_log.NEWUSER;
break;
case 'block':
titolo = lang_log.BLOCK;
break;
case 'delete':
titolo = lang_log.DELETE;
break;
case 'move':
titolo = lang_log.MOVE;
break;
case 'protect':
titolo = lang_log.PROTECT;
break;
default:
break;
}
var el = document.getElementById( 'livePreviewTitle' );
el.innerHTML="<b style='text-decoration: blink;'><span style='color:red'>"+titolo+"</span>...</b>";
wpajax.http({url:wgServer + mw.config.get('wgScriptPath') + '/index.php?title=Special:Log&type=' + action + "&user=&page=" + encodeURIComponent(page), onSuccess: getLog, message: page });
}
function getLog(xmlreq, data) {
doc = gml_XMLParse(xmlreq.responseText);
bC = getElementWithId('bodyContent', 'div', doc);
if (bC == null) bC = getElementWithId('article', 'div', doc);
var c=data.message;
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
LP.innerHTML = bC.innerHTML;
if (LP.innerHTML == "undefined") LP.innerHTML = bC.xml;
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><a href="'+mw.config.get('wgServer')+'/wiki/'+encodeURI(c)+'" target="_new">'+c+'</a></b>';
}
 
/* </source>
 
=== LiveFilter ===
*/
 
function liveFilter(id) {
var el = document.getElementById( 'livePreviewTitle' );
el.innerHTML="<b style='text-decoration: blink;'>Filter: <span style='color:red'></span>...</b>";
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title=Special:AbuseLog&details='+id,
onSuccess: getFilter, mid: id});
}
 
function getFilter(xmlreq, data) {
doc = gml_XMLParse(xmlreq.responseText);
bC = getElementWithId('bodyContent', 'div', doc);
if (bC == null) bC = getElementWithId('article', 'div', doc);
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
LP.innerHTML = bC.innerHTML;
if (LP.innerHTML == "undefined") LP.innerHTML = bC.xml;
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><a href="'+mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?title=Special:AbuseLog&details='+data.mid+'" target="_new">Détails</a></b>';
}
 
 
/*
=== LiveSysop ===
 
<source lang="javascript"> */
 
function liveSysop() {
wpajax.http({url:wgServer + mw.config.get('wgScriptPath') + '/indexapi.php?titleaction=Special:Listusersquery&limitlist=500allusers&groupaugroup=sysop&aulimit=' +lrcAPIlimit +'&format=xml',
onSuccess: getSysop, message: "RécupTraitement sysoplisten cours...\n\n" });
}
 
function getSysop(xmlreq, data) {
var docapi = gml_XMLParse(xmlreq.responseTextresponseXML.getElementsByTagName('api')[0];
 
var bC = doc.getElementById('bodyContent');
if (api.firstChild.nodeName == "error") return;
var lstSys = bC.getElementsByTagName( 'ul' )[ 0 ].getElementsByTagName( 'li' );
 
var info="";
var rcs = api.getElementsByTagName('query')[0].getElementsByTagName('allusers')[0].getElementsByTagName('u');
var len = lstSys.length
 
for(var i=0; i < len ; i++) {
leni=rcs.length;
info=lstSys[i].getElementsByTagName( 'a' )[ 0 ].innerHTML;
for (i=leni-1; i>=0; i--) {
lstSysop.push(info);
lstSysop.push(rcs[i].getAttribute('name'));
}
liveNS();
Line 484 ⟶ 871:
 
function liveWatch() {
wpajax.http({url:wgServer + mw.config.get('wgScriptPath') + '/wiki/Special:Watchlist/editapi.php?action=query&list=watchlistraw&wrlimit=' +lrcAPIlimit +'&format=xml',
onSuccess: getWatch, message: "RécupTraitement watchlisten cours..." });
}
 
function getWatch(xmlreq, data) {
var docapi = gml_XMLParse(xmlreq.responseTextresponseXML.getElementsByTagName('api')[0];
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();
}
 
if (api.firstChild.nodeName == "error") return;
/* function liveWatch() {
wpajax.http({url:wgServer + wgScriptPath + '/api.php?action=query&list=watchlist&wllimit=500&format=xml',
onSuccess: getWatch, message: "Récup watchlist" });
}
 
var rcs = api.getElementsByTagName('watchlistraw')[0].getElementsByTagName('wr');
function getWatch(xmlreq, data) {
 
var a=xmlreq.responseText;
var cleni=datarcs.messagelength;
for (i=0; i<leni; i++) {
var i;
// document.getElementById('debug').innerHTML = a+"<br />**************************";
lstSuivi.push(rcs[i].getAttribute('title'));
if(a.indexOf("<error")!=-1) {
var lvSuivi = document.getElementById( 'liveSuivi' );
lvSuivi.innerHTML = "<small>Suivi désactivé. (API.php : watchlist)</small>";
return;
}
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("--:--");
}
//document.getElementById('debug').innerHTML += lstSuivi;
var wc1=api.getElementsByTagName('query-continue')[0];
} */
if (wc1)
{
var wrcontinue=wc1.getElementsByTagName('watchlistraw')[0].getAttribute('wrcontinue');
wpajax.http({url:wgServer + mw.config.get('wgScriptPath') + '/api.php?action=query&list=watchlistraw&wrlimit=' +lrcAPIlimit +'&format=xml&wrcontinue=' + wrcontinue,
onSuccess: getWatch, message: "Traitement en cours..." });
}
else
liveRC();
}
 
function liveNS() {
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml',
onSuccess: getNS, message: "RécupPobieranie NSnazw przestrzeni" });
}
 
Line 552 ⟶ 921:
id = nss[i].getAttribute('id');
ns = nss[i].textContent;
// Handle IE
if (!ns) ns = nss[i].text;
 
if (id < 0) continue;
if (id == 0) ns = "Article"lang_main_namespace;
 
options += '<option value="' + id + '">' + ns + '</option>';
Line 565 ⟶ 936:
}
 
/* </presource>
 
=== LiveRC ===
 
<source lang="javascript"> */
<pre> */
 
function supprLigne(quelLigne) {
var i,len;
var tab = document.getElementById('tabRC');
// IE automatically inserts a TBODY that we have to take care of
if (tab.firstChild && (tab.firstChild.nodeName == "TBODY")) tab=tab.firstChild;
var els = new Array();
if (quelLigne == '*')
Line 594 ⟶ 967:
for (i=len-1; i>=0; i--)
if (_els[i].firstChild.style.backgroundColor == 'rgb(226, 242, 210)')
els.push(_els[i]);
} else if (quelLigne == 'c') {
var _els = tab.getElementsByTagName('tr');
len = _els.length;
for (i=len-1; i>=0; i--)
if (_els[i].firstChild.style.backgroundColor == 'white')
els.push(_els[i]);
} else
Line 637 ⟶ 1,016:
function tsToHhMm(timestamp) {
var tz;
var match, regex = new RegExp();
if (lrcTZ) {
var regex.compile = new RegExp(/^([-+])?(\d?\d):?(\d\d)$/);
match = regex.exec(lrcTZ);
if (!match) {
Line 651 ⟶ 1,030:
tz = -now.getTimezoneOffset();
}
var regex.compile = new RegExp(/^\d\d\d\d-\d\d-\d\dT(\d\d):(\d\d):\d\dZ$/);
match = regex.exec(timestamp);
if (!match) {
Line 661 ⟶ 1,040:
var hh = (tt - mm) / 60 % 24;
return hh + ':' + (mm < 10 ? '0' : '') + mm;
}
 
function updateHidden() {
var tempAr = new Array();
for (var user in lstHidden) {
var utilde = user.replace(new RegExp(/\'/g), "\\'");
var uremove = '<a href="javascript:;" onClick="unhideUser(\''+utilde+'\');" style="color:grey">-</a>';
var udiscut = '<a href="'+mw.config.get('wgServer')+'/wiki/User talk:'+encodeURIComponent(user)+'" style="color:seagreen" target="_new" title="'+lang_tooltips.TALK_TIP+'">'+lang_tooltips.TALK_SHORT+'</a>';
var ucontrib = '<a href="javascript:;" onClick="liveContrib(\''+utilde+'\');" style="color:#43CD80" title="'+lang_tooltips.CONTRIB_TIP+'">'+lang_tooltips.CONTRIB_SHORT+'</a>';
var uadmin = '';
if (lrcAdmin == true) {
uadmin = ' • <a href="'+mw.config.get('wgServer')+'/wiki/Special:Blockip/'+encodeURI(user)+'" target="_new" style="color:seagreen" title="'+lang_tooltips.BLOCK_TIP+'">'+lang_tooltips.BLOCK_SHORT+'</a>';
}
var ueditor = '<a href="'+mw.config.get('wgServer')+'/wiki/User:'+encodeURIComponent(user)+'" target="_new">'+user+'</a>';
var ligne = '<span id="hidden-' + user + '"><small>' + uremove + ' • ' + udiscut + ' • ' + ucontrib + uadmin + ' • </small>' + ueditor + '</span><br />';
tempAr.push(ligne);
}
tempAr.sort();
var lvHidden = document.getElementById('liveHidden');
lvHidden.innerHTML = "";
var len = tempAr.length;
for (var n=len-1; n>=0; n--)
lvHidden.innerHTML += tempAr[n];
}
 
function updateFollowContact() {
var tempAr = new Array();
for (var user in lstContactlstContact2) {
var timestamp = lstContactlstContact2[user].ts;
if (timestamp == 0) continue;
var utilde = user.replace(new RegExp(/\'/g), "\\'");
var udiscut = '<a href="'+mw.config.get('wgServer')+'/wiki/User talk:'+encodeURIComponent(user)+'" style="color:seagreen" target="_new" title="'+lang_tooltips.TALK_TIP+'">T'+lang_tooltips.TALK_SHORT+'</a>';
var ucontrib = '<a href="javascript:;" onClick="liveContrib(\''+utilde+'\');" style="color:#43CD80" title="'+lang_tooltips.CONTRIB_TIP+'">C'+lang_tooltips.CONTRIB_SHORT+'</a>';
var uadmin = '';
if (lrcAdmin == true) {
uadmin = ' • <a href="'+mw.config.get('wgServer')+'/wiki/Special:Blockip/'+encodeURI(user)+'" target="_new" style="color:seagreen" title="'+lang_tooltips.BLOCK_TIP+'">B'+lang_tooltips.BLOCK_SHORT+'</a>';
}
var ueditor = '<a href="'+mw.config.get('wgServer')+'/wiki/User:'+encodeURIComponent(user)+'" target="_new">'+user+'</a>';
var ligne = '<span id="contact-' + timestamp + '"><small>' + tsToHhMm(timestamp) + ' • ' + udiscut + ' • ' + ucontrib + uadmin + ' • </small>' + ueditor + '</span><br />';
tempAr.push(ligne);
Line 692 ⟶ 1,094:
var timestamp = lstRevoc[user].ts;
var utilde = user.replace(new RegExp(/\'/g), "\\'");
var udiscut uremove = '<a href="javascript:;" onClick="removeRevoc(\''+wgServerutilde+'/wiki/User talk:\'+encodeURIComponent(user)+';" style="color:seagreen" target="_newgrey">T-</a>';
var ucontribudiscut = '<a href="javascript:;" onClick="liveContrib'+mw.config.get(\'wgServer'+utilde)+'\/wiki/User talk:'+encodeURIComponent(user);+'" style="color:#43CD80seagreen" target="_new" title="'+lang_tooltips.TALK_TIP+'">C'+lang_tooltips.TALK_SHORT+'</a>';
var ucontrib = '<a href="javascript:;" onClick="liveContrib(\''+utilde+'\');" style="color:#43CD80" title="'+lang_tooltips.CONTRIB_TIP+'">'+lang_tooltips.CONTRIB_SHORT+'</a>';
var uadmin = '';
if (lrcAdmin == true) {
uadmin = ' • <a href="'+mw.config.get('wgServer')+'/wiki/Special:Blockip/'+encodeURI(user)+'" target="_new" style="color:seagreen" title="'+lang_tooltips.BLOCK_TIP+'">B'+lang_tooltips.BLOCK_SHORT+'</a>';
}
var ueditor = '<a href="'+mw.config.get('wgServer')+'/wiki/User:'+encodeURIComponent(user)+'" target="_new">'+user+'</a>';
var ligne = '<span id="revoc-' + timestamp + '"><small>' + tsToHhMm(timestamp) + ' • ' + uremove + ' • ' + udiscut + ' • ' + ucontrib + uadmin + ' • </small>' + ueditor + ' (' + lstRevoc[user].nb + ' '+lang_menu[0].XTIMES+')</span><br />';
tempAr.push(ligne);
}
Line 710 ⟶ 1,113:
}
 
function getRevisionremoveRevoc(xmlreq, dataname) {
delete lstRevoc[name];
if (document.getElementById('stopLive').checked) return;
updateFollowRevoc();
}
 
var api = xmlreq.responseXML.getElementsByTagName('api')[0];
 
//function getRevision(xmlreq, data) {
if (api.firstChild.nodeName == "error") return;
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;
Line 730 ⟶ 1,140:
var state = rc.state;
 
var regex.compile = new RegExp(/\'/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;
 
Line 754 ⟶ 1,166:
// SUPPR. LIGNE //
 
th0.innerHTML = '<a href="javascript:;" onClick="supprLigne(\''+pageid+'_'+revid+'\');" style="color:red" title="'+lang_tooltips.HIDE_THIS+'">X</a>';
 
 
// ARTICLE //
 
var arti = "", artiStyle = "";
var preArti = "", postArti = "";
 
var diff = "";
var diffClose = "";
Line 767 ⟶ 1,179:
diffClose='supprLigne(\''+pageid+'_'+revid+'\');';
if (state & NEW)
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveArticle(\''+escTitle+'\',\''+user+'\');'+diffClose+'" style="color:green">New</a>';
else if (state & UPLOAD)
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveDiffliveLog(\''+escTitle+'upload\',\''+revidescTitle+','+oldid+\');'+diffClose+'" style="color:orangedarkslateblue">DiffLog</a>';
else if (state & NEWUSER)
var hist = '<a href="javascript:;" onClick="liveHist(\''+escTitle+'\');" style="color:darkorange">H</a>';
var edit diff = '<a href="'javascript:;" onClick="changeLigne(\''+ wgServer pageid+ wgScriptPath + '/index.php?title=_'+encodeURIrevid+'\');liveLog(\'newusers\',\''+escTitle+'\');'+diffClose+'&action=edit" target="_new" style="color:tomatolime">ELog</a>';
else if (state & BLOCK)
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'block\',\''+escTitle+'\');'+diffClose+'" style="color:darkgoldenrod">Log</a>';
else if (state & DELETE)
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'delete\',\''+escTitle+'\');'+diffClose+'" style="color: saddlebrown">Log</a>';
else if (state & MOVE)
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'move\',\''+escTitle+'\');'+diffClose+'" style="color:black">Log</a>';
else if (state & PROTECT)
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'protect\',\''+escTitle+'\');'+diffClose+'" style="color: darkslategray">Log</a>';
else if (state & ABFILTER)
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveFilter('+revid+');'+diffClose+'" style="color: darkslategray">Filt</a>';
else { // simple edit
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveDiff(\''+escTitle+'\','+revid+','+oldid+');'+diffClose+'" style="color:orange" title="'+lang_tooltips.DIFF_TIP+'">'+lang_tooltips.DIFF_SHORT+'</a>'
diff += '<sup><a href="' + mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title='+encodeURI(escTitle)+'&diff='+revid+'&oldid='+oldid+'" target="_new">+</a></sup>';
}
var hist = '';
var edit = '';
var admin = '';
// Don't show link for log rows
if (lrcAdmin == true) {
if (!(state & UPLOAD) &&
admin = ' • <a href="' + wgServer + wgScriptPath + '/index.php?title='+encodeURI(escTitle)+'&action=delete" target="_new" style="color:orangered">S</a>';
!(state & NEWUSER) &&
!(state & BLOCK) &&
!(state & DELETE) &&
!(state & PROTECT) &&
!(state & PATROL) &&
!(state & MOVE) &&
!(state & ABFILTER))
{
hist = '<a href="javascript:;" onClick="liveHist(\''+escTitle+'\');" style="color:darkorange" title="'+lang_tooltips.HIST_TIP+'">'+lang_tooltips.HIST_SHORT+'</a>';
edit = '<a href="' + mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title='+encodeURIComponent(title)+'&action=edit" target="_new" style="color:tomato" title="'+lang_tooltips.EDIT_TIP+'">'+lang_tooltips.EDIT_SHORT+'</a>';
if (lrcAdmin == true) {
admin = ' • <a href="' + mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title='+encodeURIComponent(title)+'&action=delete" target="_new" style="color:orangered" title="'+lang_tooltips.DEL_TIP+'">'+lang_tooltips.DEL_SHORT+'</a>';
admin += ' • <a href="' + mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title='+encodeURIComponent(title)+'&action=protect" target="_new" style="color: coral" title="'+lang_tooltips.PROTECT_TIP+'">'+lang_tooltips.PROTECT_SHORT+'</a>';
}
}
 
Line 796 ⟶ 1,240:
preArti += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Copyright.svg/16px-Copyright.svg.png" width="16px" alt="Copyright" /> ';
 
// PàSPaS ? ;
//////////////////
if (state & PAS)
preArti += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Cestino_pieno_architetto_01.svg/11px-Cestino_pieno_architetto_01.svg.png" height="11px" alt="PàSPaS" /> ';
 
// Intervention wikipompiers ? ;
Line 828 ⟶ 1,272:
&& ns == 0
&& !(state & CATEGORIZED))
postArti += '<sup style="color:crimson">(cat ?)'+lang_category_short+'</sup>';
 
// Redirect, Log, or simple edit ? ;
//////////////////
if (state & REDIRECTMOVE) {
// artiStyle = 'color: magenta; font-weight: bold; font-style: italic;';
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Forward.png/16px-Forward.png" width="16px" alt="Renommage" />';
postArti += ' <a href="javascript:;" onClick="liveArticle(\''+rc.new_title+'\',\''+user+'\');">'+rc.new_title+'</a>';
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+escTitle+'\',\''+user+'\');">'+title+'</a>';
}
else if (state & REDIRECT) {
artiStyle = 'color: green; font-weight: bold; font-style: italic;';
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/Redirectltr.png/20px-Redirectltr.png" width="20px" alt="RedirectionRedirect" />';
postArti += ' <a href="javascript:;" onClick="liveArticle(\''+rc.redirect+'\',\''+user+'\');">'+rc.redirect+'</a>';
if (rc.redirect) {
arti // postArti += '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+wgServerescTitle+'/wiki/\',\''+encodeURIComponent(rc.redirect)user+'" target="_new\');">'+rc.redirecttitle+'</a>';
}
postArti += '<a href="javascript:;" onClick="liveArticle(\''+rc.redirect+'\');">'+rc.redirect+'</a>';
else if }(state else& UPLOAD) {
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/4/47/Gartoon-Gnome-dev-floppy.png/16px-Gartoon-Gnome-dev-floppy.png" width="16px" alt="Upload" />';
regex.compile(/^#REDIRECT\s*\[\[(.*)\]\]/i);
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+escTitle+'\',\''+user+'\');" onDblClick="window.open(\''+mw.config.get('wgServer')+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>';
match = regex.exec(revisions[0].textContent);
if (match) {
// postArti += '<a style="color:red;" href="'+wgServer+'/wiki/'+encodeURIComponent(match[1])+'" target="_new">'+match[1]+'</a>';
postArti += '<a style="color:red" href="javascript:;" onClick="liveArticle(\''+match[1]+'\');">'+match[1]+'</a>';
} else {
// postArti += '<a style="color:red;" href="'+wgServer+wgScriptPath+'/index.php?title='+encodeURI(title)+'&redirect=no" target="_new">/!\\</a>';
postArti += '<a style="color:red" href="javascript:;" onClick="liveArticle(\''+title+'\');">'+title+'</a>';
}
}
// arti = '<a style="'+artiStyle+'" href="'+wgServer+wgScriptPath+'/index.php?title='+encodeURI(title)+'&redirect=no" target="_new">'+title+'</a>';
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+title+'\');">'+title+'</a>';
} else {
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+title+'\');">'+title+'</a>';
}
else if (state & NEWUSER) {
 
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Crystal_personal.png/16px-Crystal_personal.png" width="16px" alt="Nouvel utilisateur" />';
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+escTitle+'\',\''+user+'\');" onDblClick="window.open(\''+mw.config.get('wgServer')+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>';
}
else if (state & BLOCK) {
// artiStyle = 'color: magenta; font-weight: bold; font-style: italic;';
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/64/Crystal_Clear_action_lock3.png/16px-Crystal_Clear_action_lock3.png" width="16px" alt="Blocage" />';
postArti += ' <a href="javascript:;" onClick="liveLog("block",\''+rc.title+'\');">('+rc.duration+')</a>';
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+escTitle+'\',\''+user+'\');">'+title+'</a>';
}
else if (state & DELETE) {
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/ef/Editcut.png/16px-Editcut.png" width="16px" alt="Suppression" />';
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+escTitle+'\',\''+user+'\');" onDblClick="window.open(\''+mw.config.get('wgServer')+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>';
}
else if (state & PROTECT) {
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/7/72/Crystal_Clear_app_agent.png/16px-Crystal_Clear_app_agent.png" width="16px" alt="Protection" />';
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+escTitle+'\',\''+user+'\');" onDblClick="window.open(\''+mw.config.get('wgServer')+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>';
}
else {
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+escTitle+'\',\''+user+'\');" onDblClick="window.open(\''+mw.config.get('wgServer')+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>';
}
th1.innerHTML = '<small>' + tsToHhMm(timestamp) + ' • ' + diff + ' • ' + hist + ' • ' + edit + admin + ' • </small>'
+ preArti + arti + postArti;
th1.className="creator-title";
th1.style.textAlign="left";
th1.style.border="1px";
th1.style.width="40%";
 
 
// EDITOR //
////////////
var discut = '<a href="'+mw.config.get('wgServer')+'/wiki/User talk:'+encodeURIComponent(user)+'" style="color:seagreen" target="_new" title="'+lang_tooltips.TALK_TIP+'">T'+lang_tooltips.TALK_SHORT+'</a>';
var contrib = '<a href="javascript:;" onClick="liveContrib(\''+escUser+'\');" style="color:#43CD80" title="'+lang_tooltips.CONTRIB_TIP+'">C'+lang_tooltips.CONTRIB_SHORT+'</a>';
var editor = "", preEditor = "";
 
Line 884 ⟶ 1,343:
 
// TOR potentiel / AOL
var isTOR = regex.compilenew RegExp(/172\.\d+\.\d+\.\d+/);
if (isTOR.test(user))
preEditor += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Dialog-warning.svg/16px-Dialog-warning.svg.png" width="16px" />&nbsp;';
 
editor = '<a href="'+mw.config.get('wgServer')+'/wiki/User:'+encodeURIComponent(user)+'" target="_new">'+user+'</a>';
var uadmin = '';
if (lrcAdmin == true) {
uadmin = ' • <a href="'+mw.config.get('wgServer')+'/wiki/Special:Blockip/'+encodeURI(user)+'" target="_new" style="color:seagreen" title="'+lang_tooltips.BLOCK_TIP+'">B'+lang_tooltips.BLOCK_SHORT+'</a>';
}
 
var uhide = '<a href="javascript:;" onClick="supprLigne(\''+pageid+'_'+revid+'\'); hideUser(\''+ user +'\');" style="color:grey" title="'+lang_tooltips.USER_HIDE_TIP+'">'+lang_tooltips.USER_HIDE_SHORT+'</a>';
td2.innerHTML = '<small>' + discut + ' • ' + contrib + uadmin + ' • </small>'
td2.innerHTML = '<small>' + discut + ' • ' + contrib + ' • ' + uhide + uadmin + ' • </small>'
+ preEditor + editor;
td2.className="creator-name";
Line 902 ⟶ 1,363:
if (lstRevoc[user]) {
td2.style.border = "2px solid red";
td2.innerHTML += '<sup style="color:red">(' + lstRevoc[user].nb + ' révoc <a href="javascript:removeRevoc(\'' + user + '\')">-</a>)</sup>'
}
 
Line 908 ⟶ 1,369:
// Remplace lien [[xxx]] par <a> ;
var wcomment = comment.htmlize();
regex.compilevar regex1 = new RegExp(/\[\[(([^\]\|]*)(.*?))\]\]/g);
wcomment = wcomment.replace(regexregex1, "<a href='"+mw.config.get('wgServer')+mw.config.get('wgScriptPath')+"/index.php?title=$2&redirect=no' target='_new'>$1</a>");
regex.compilevar regex2 = new RegExp(/\>[^\]\|<]*\|([^\]\|<]*)</g);
wcomment = wcomment.replace(regexregex2, ">$1<");
 
// Abusefilter tag ? ;
td3.innerHTML = "<small>" + wcomment + "</small>";
/////////////////
if (state & TAG) {
wcomment += '<br /><span style="color: red; font-weight: bold;">Tag : ';
wcomment += rc.tags[0].firstChild.nodeValue;
for (var tagId = 1; tagId < rc.tags.length; ++tagId)
wcomment += ' | ' + rc.tags[tagId].firstChild.nodeValue;
wcomment += '</span>';
td3.style.border = "2px solid red";
} else {
td3.style.border = "1px";
td3.style.width = "40%";
}
 
td3.innerHTML = "<small>" + wcomment + "</small>";
 
 
if (state & PATROLLED) {
td2.style.backgroundColor = "#e3e3f1";
td3.style.backgroundColor = "#e3e3f1";
td4.style.backgroundColor = "#e3e3f1";
}
if (state & ABFILTER) {
th0.style.backgroundColor = "#FFBE60";
th1.style.backgroundColor = "#FFBE60";
td2.style.backgroundColor = "#FFBE60";
td3.style.backgroundColor = "#FFBE60";
td4.style.backgroundColor = "#FFBE60";
}
if (state & UPLOAD) {
th0.style.backgroundColor = "#D1CAFA";
th1.style.backgroundColor = "#D1CAFA";
td2.style.backgroundColor = "#D1CAFA";
td3.style.backgroundColor = "#D1CAFA";
td4.style.backgroundColor = "#D1CAFA";
tr1.style.border = "1px solid darkslateblue";
}
if (state & NEWUSER) {
th0.style.backgroundColor = "#C6FF6D";
th1.style.backgroundColor = "#C6FF6D";
td2.style.backgroundColor = "#C6FF6D";
td3.style.backgroundColor = "#C6FF6D";
td4.style.backgroundColor = "#C6FF6D";
tr1.style.border = "1px solid lime";
}
if (state & BLOCK) {
th0.style.backgroundColor = "#EECC84";
th1.style.backgroundColor = "#EECC84";
td2.style.backgroundColor = "#EECC84";
td3.style.backgroundColor = "#EECC84";
td4.style.backgroundColor = "#EECC84";
tr1.style.border = "1px solid darkgoldenrod";
}
if (state & DELETE) {
th0.style.backgroundColor = "#E7CAA7";
th1.style.backgroundColor = "#E7CAA7";
td2.style.backgroundColor = "#E7CAA7";
td3.style.backgroundColor = "#E7CAA7";
td4.style.backgroundColor = "#E7CAA7";
tr1.style.border = "1px solid saddlebrown";
}
if (state & MOVE) {
th0.style.backgroundColor = "#FDC5FF";
th1.style.backgroundColor = "#FDC5FF";
td2.style.backgroundColor = "#FDC5FF";
td3.style.backgroundColor = "#FDC5FF";
td4.style.backgroundColor = "#FDC5FF";
tr1.style.border = "1px solid magenta";
}
if (state & PROTECT) {
th0.style.backgroundColor = "#B2BCC6";
th1.style.backgroundColor = "#B2BCC6";
td2.style.backgroundColor = "#B2BCC6";
td3.style.backgroundColor = "#B2BCC6";
td4.style.backgroundColor = "#B2BCC6";
tr1.style.border = "1px solid darkslategray";
}
 
if (state & REVERT) {
Line 964 ⟶ 1,506:
// CONTACT LIST //
//////////////////
if (lstContactlstContact2[user]) {
td2.style.border = "2px solid gold";
td2.style.backgroundColor = "yellow";
}
 
if (user == mw.config.get('wgUserName')) {
td2.style.border = "2px solid #A0B0E0";
td2.style.backgroundColor = "#F0F8FF";
Line 978 ⟶ 1,520:
// delta de modif ;
///////////////////
if (!(state & NEWUSER) &&
!(state & PROTECT) &&
!(state & MOVE) &&
!(state & DELETE) &&
!(state & ABFILTER)) {
var txtdiff = "";
if (sizediff < 0)
Line 988 ⟶ 1,535:
td4.style.border = "1px";
td4.style.textAlign = "right";
}
 
 
Line 1,000 ⟶ 1,548:
 
var tab = document.getElementById( 'tabRC' );
// IE automatically inserts a TBODY that we have to take care of
if (tab.firstChild && (tab.firstChild.nodeName == "TBODY")) tab=tab.firstChild;
var elold = document.getElementById(pageid+"_"+oldid);
 
Line 1,015 ⟶ 1,565:
}
 
// Don't show RC if checkbox is not checked
if ((!document.getElementById('showRC').checked) &&
(!(state & UPLOAD) &&
!(state & NEWUSER) &&
!(state & BLOCK) &&
!(state & DELETE) &&
!(state & PROTECT) &&
!(state & MOVE) &&
!(state & ABFILTER)))
supprLigne(pageid+"_"+revid);
 
if (state & PATROL)
supprLigne(pageid+"_"+revid);
// Don't show Log if checkbox is not checked
if ((!document.getElementById('showLog').checked) &&
((state & UPLOAD) ||
(state & NEWUSER) ||
(state & BLOCK) ||
(state & DELETE) ||
(state & PROTECT) ||
(state & MOVE)))
supprLigne(pageid+"_"+revid);
 
// Don't show Filter if checkbox is not checked
if ((!document.getElementById('showFilter').checked) &&
(state & ABFILTER))
supprLigne(pageid+"_"+revid);
 
// MISE A JOUR LISTES //
Line 1,045 ⟶ 1,623:
 
 
if (lstContactlstContact2[user]) {
lstContactlstContact2[user].ts = timestamp;
updateFollowContact();
}
 
if (state & REVERT) {
var regex.compile = new RegExp(/\[\[SpecialSp[ée]cial:Contributions\/([^\]\|]+)/);
match = regex.exec(comment);
 
if (!match) {
var regex2 = new RegExp(/\[\[Specjalna:Wkład\/([^\]\|]+)/);
match = regex2.exec(comment);
}
if (match) {
var userR = match[1];
if (userR != user && userR != mw.config.get('wgUserName')) {
if (!lstRevoc[userR]) lstRevoc[userR] = { ts: 0, nb: 0 };
lstRevoc[userR].ts = timestamp;
Line 1,067 ⟶ 1,651:
function getRedirCat(xmlreq, data) {
if (document.getElementById('stopLive').checked) return;
 
var yurik = xmlreq.responseXML.getElementsByTagName('yurikapi')[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;
Line 1,084 ⟶ 1,668:
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<leni; i++)
for (j=0; j<lenj; j++)
Line 1,098 ⟶ 1,682:
state += categoriestests[j].state;
}
 
rc.state = state;
 
getRevision(rc);
wpajax.http({ url: wgServer + wgScriptPath + '/api.php?action=query&prop=revisions&pageids=' + pageid + '&rvstartid=' + revid + '&rvlimit=2&rvprop=content&format=xml',
onSuccess: getRevision, rc: rc });
}
 
function getRedirCat2(xmlreq, data) {
if (document.getElementById('stopLive').checked) return;
var api = xmlreq.responseXML.getElementsByTagName('api')[0];
if (api.firstChild.nodeName == "error") return;
var log = data.log;
var pageid = log.pageid;
var revid = log.revid;
var state = log.state;
var query = api.getElementsByTagName('query')[0];
if (query.getElementsByTagName('redirects').length) {
state += REDIRECT;
if (query.getElementsByTagName('redirects')[0].getElementsByTagName('r').length)
log.redirect = query.getElementsByTagName('redirects')[0].getElementsByTagName('r')[0].getAttribute('to');
}
if (query.getElementsByTagName('categories').length) {
state += CATEGORIZED;
var categories = query.getElementsByTagName('categories')[0].getElementsByTagName('cl');
var i,j;
var leni = categories.length;
var lenj = categoriestests.length;
for (i=0; i<leni; i++)
for (j=0; j<lenj; j++)
if (new RegExp(lang_category+categoriestests[j].regex, "i").test(categories[i].getAttribute('title')))
state += categoriestests[j].state;
}
log.state = state;
getRevision(log);
}
// Get RC and Log
function getRC(xmlreq, data) {
if (document.getElementById('stopLive').checked) return;
Line 1,117 ⟶ 1,740:
leni=rcs.length;
for (i=leni-1; i>=0; i--) {
// Using rcid as revid can be 0 (e.g. when moving a page)
if (rcs[i].getAttribute('revid') <= lastrevid) continue;
if (rcs[i].getAttribute('rcid') <= lastrcid) continue;
 
rc = new Object();
Line 1,152 ⟶ 1,776:
break;
}
}
 
var tags = rcs[i].getElementsByTagName('tags')[0].getElementsByTagName('tag');
if (tags.length) {
rc.state += TAG;
rc.tags = tags;
}
 
Line 1,160 ⟶ 1,790:
rc.state += commenttests[j].state;
}
 
if (rc.newlen == 0) rc.state += BLANKING;
 
if (lstSysop.indexOf(rc.user) != -1)
rc.state += SYSOP;
 
var mitigating = (rc.state & REVERT)
|| (rc.state & BLANKING)
|| (rc.state & REPLACED)
|| (rc.state & TAG)
|| (lstContact2[rc.user])
|| (lstRevoc[rc.user])
|| (rc.user == mw.config.get('wgUserName'));
 
if (document.getElementById('showIP').checked
&& !(rc.state & IP)
&& !(rc.statemitigating & REVERT) continue;
 
&& !(rc.state & BLANKING)
if && !((rc.state & REPLACEDPATROLLED)
&& document.getElementById('showIPNEW').checked
&& !(lstContact[rc.user])
&& !(lstRevoc[rc.user]mitigating ) continue;
&& (rc.user != wgUserName)) continue;
if ((typeof(rc.logtype) != "undefined")
&& rc.logtype == "newuser") continue;
 
if (lstHidden[rc.user] && !mitigating) continue;
 
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/queryapi.php?titles=' + encodeURIComponent(rc.title) + '&whataction=query&prop=redirects|categories&redirects&format=xml',
onSuccess: getRedirCat, rc: rc });
}
 
// Log
lastrevid = rcs[0].getAttribute('revid');
var logs = api.getElementsByTagName('query')[0].getElementsByTagName('logevents')[0].getElementsByTagName('item');
lasttimestamp = rcs[0].getAttribute('timestamp').replace(new RegExp(/\D/g), "");
var i,j,leni,lenj,log;
document.getElementById('tsInit').innerHTML = "Dernière situation : " + lasttimestamp;
leni=logs.length;
for (i=leni-1; i>=0; i--) {
if (logs[i].getAttribute('logid') <= lastlogid) continue;
log = new Object();
log.state = 0;
lenj = logs[i].attributes.length;
for (j=0; j<lenj; j++) {
if (logs[i].attributes[j].name == 'type')
{
switch(logs[i].attributes[j].value) {
case 'patrol':
// I "Segna come verificata" non li cago
log.state += PATROL;
break;
case 'newusers':
log.state += NEWUSER;
break;
case 'upload':
log.state += UPLOAD;
break;
case 'block':
log.state += BLOCK;
if (logs[i].firstChild)
log.duration = logs[i].firstChild.attributes[1].value;
break;
case 'delete':
log.state += DELETE;
break;
case 'move':
log.state += MOVE;
if (logs[i].firstChild)
log.new_title = logs[i].firstChild.attributes[1].value;
case 'protect':
log.state += PROTECT;
break;
case 'review':
log.state += REVIEW;
break;
default:
break;
}
}
else
log[logs[i].attributes[j].name] = logs[i].attributes[j].value;
//Set a dummy revid to prevent deletion
log.revid=log.logid;
}
if (typeof(log.comment) != "undefined") {
lenj = commenttests.length;
for (j=0; j<lenj; j++)
if (new RegExp(commenttests[j].regex).test(log.comment))
log.state += commenttests[j].state;
}
if (lstSysop.indexOf(log.user) != -1)
log.state += SYSOP;
if (!(log.state & REVIEW))
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?titles=' + encodeURIComponent(log.title) + '&action=query&prop=categories&redirects&format=xml',
onSuccess: getRedirCat2, log: log });
}
 
// Filters
var filters = api.getElementsByTagName('query')[0].getElementsByTagName('abuselog')[0].getElementsByTagName('item');
var i,j,leni,lenj,filter;
leni=filters.length;
for (i=leni-1; i>=0; i--) {
if (filters[i].getAttribute('id') <= lastfilterid) continue;
filter = new Object();
filter.state = ABFILTER;
lenj = filters[i].attributes.length;
for (j=0; j<lenj; j++) {
filter[filters[i].attributes[j].name] = filters[i].attributes[j].value;
}
//Set a dummy revid to prevent deletion
filter.revid = filter.id
// Get filter description
//Set a dummy revid to prevent deletion
filter.revid = filter.id
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=query&list=abusefilters&abflimit=1&format=xml&abfstartid=' + filter.filter_id,
onSuccess: getFilterTitle, filter: filter });
}
 
 
lastrcid = rcs[0].getAttribute('rcid');
lastlogid = logs[0].getAttribute('logid');
lastfilterid = filters[0].getAttribute('id');
lastrctimestamp = rcs[0].getAttribute('timestamp').replace(new RegExp(/\D/g), "");
lastletimestamp = logs[0].getAttribute('timestamp').replace(new RegExp(/\D/g), "");
lastafltimestamp = filters[0].getAttribute('timestamp').replace(new RegExp(/\D/g), "");
document.getElementById('tsInit').innerHTML = "Last situation : " + lastrctimestamp ;
}
 
function getFilterTitle(xmlreq, data) {
var filter = data.filter;
 
var xmlinfo = xmlreq.responseXML.getElementsByTagName('api')[0];
if (xmlinfo.firstChild.nodeName == "error") return;
filter.comment = 'Déclenchement du filtre '
filter.comment += xmlinfo.getElementsByTagName('abusefilters')[0].getElementsByTagName('filter')[0].getAttribute('id');
filter.comment += ': ';
filter.comment += xmlinfo.getElementsByTagName('abusefilters')[0].getElementsByTagName('filter')[0].getAttribute('description');
filter.comment += ' (action: '+ filter.result + ')';
 
getRevision(filter);
}
 
Line 1,190 ⟶ 1,953:
var rcns = document.getElementById('showNS0').value;
if (rcns == null) return;
var rcshow = "";
if (document.getElementById('showBot').checked) rcshow = '&rcshow=!bot';
 
wpajax.http({url:wgServer + mw.config.get('wgScriptPath')
+ '/api.php?action=query&list=recentchanges|logevents|abuselog&rcnamespace=' + rcns
+ '&rcprop=user|comment|flags|timestamp|title|ids|sizes|tags' + rcshow(lrcPatrol ? '|patrolled' : '')
+ (document.getElementById('showBot').checked ? '&rcshow=!bot' : '')
+ '&rcend=' + lasttimestamp + '&rclimit=' + lrcRCLimit + '&format=xml',
+ '&rcend=' + lastrctimestamp + '&rclimit=' + lrcRCLimit
+ '&leend=' + lastletimestamp + '&lelimit=' + lrcRCLimit
+ '&aflend=' + lastafltimestamp + '&afllimit=' + lrcRCLimit
+ '&format=xml',
onSuccess: getRC, message: "Traitement en cours...\n\n" });
}
 
function hideUser(name) {
lstHidden[name] = true;
updateHidden();
}
 
function unhideUser(name) {
delete lstHidden[name];
updateHidden();
}
 
function showHideObj(parent, fils) {
Line 1,208 ⟶ 1,983:
}
 
addOnloadHook(function liveRCInit() {
{
if (wgTitle == "EDUCA33E/LiveRC") {
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=query&meta=userinfo&uiprop=rights&format=xml',
onSuccess: getRights});
}
 
$(function () {
var top = document.getElementById( 'top' ); top.innerHTML = "";
if (mw.config.get('wgTitle') == "EDUCA33E/LiveRC") {
 
var top = document.getElementById( 'top' );
if (top != null) {
top.innerHTML = "";
top.style.display = "none";
}
var siteSub = document.getElementById( 'siteSub' );
var contentSub = document.getElementById( 'contentSub' );
Line 1,218 ⟶ 2,003:
var pca = document.getElementById( 'p-cactions' );
 
top.style.display = "none";
if (siteSub != null) siteSub.style.display = "none";
if (contentSub != null) 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 showIPNEWbox = '';
if (lrcPatrol)
showIPNEWbox = '<input id="showIPNEW" type="checkbox" ' + lrcShowIPNEWChecked + '/>' +
'<label for="showIPNEW">' + lang_menu[0].IPNEW + ' </label>';
 
var lvPreviewFoot = document.getElementById( 'livePreviewFoot' );
Line 1,238 ⟶ 2,028:
'<input id="showDiffR" type="checkbox" />' +
'<label for="showDiffR">'+ lang_menu[0].LOWDIFF + '</label>' +
'<input id="shidRCshowBot" type="checkbox" checked' onclick="showHideObj(this,+ lrcShowBotChecked + \'divTabRC\');" />' +
'<label for="shidRC">' + lang_menu[0].RCLABEL + '</label>' +
'<input id="showBot" type="checkbox" checked />' +
'<label for="showBot">' + lang_menu[0].NOBOTS + '</label>' +
'<input id="showIP" type="checkbox" ' + lrcShowIPChecked + '/>' +
'<label for="showIP">' + lang_menu[0].IPONLY + ' </label>' +
showIPNEWbox +
'<input id="showRC" type="checkbox" ' + lrcShowRCChecked + ' />' +
'<label for="showRC">' + lang_menu[0].RCLABEL + ' </label>' +
'<input id="showLog" type="checkbox" ' + lrcShowLogChecked + '/>' +
'<label for="showLog">' + lang_menu[0].LOGSHOW + ' </label>' +
'<input id="showFilter" type="checkbox" ' + lrcShowFilterChecked + '/>' +
'<label for="showFilter">' + lang_menu[0].ABSHOW + ' • </label>' +
'<span id="selectNS" />';
 
// '<input id="shidRC" type="checkbox" checked onclick="showHideObj(this, \'divTabRC\');" />' +
// '<label for="shidRC">' + lang_menu[0].RCLABEL + '</label>' +
 
if (lrcPreviewHeight) document.getElementById('livePreview').style.height = lrcPreviewHeight;
 
var _lstContact = lstContact;
var _len = lstContact.length;
lstContactlstContact2 = new Array();
for (var _i=0; _i<_len; _i++)
lstContactlstContact2[_lstContactlstContact[_i]] = { ts: 0 };
 
// Main
liveSysopliveRCInit();
}
});
 
/* </presource> */