PageRenderTime 58ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/plwiki/liverc/LiveRC.js

https://bitbucket.org/plwiki/bot
JavaScript | 1642 lines | 1421 code | 130 blank | 91 comment | 179 complexity | 9e5275ff39b57c00c551b7efa555967a MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. /*
  2. ==LiveRC==
  3. *Documentation : [[:fr:User:EDUCA33E/LiveRC/Documentation]]
  4. *Author : [[:fr:User:EDUCA33E]]
  5. *Dev & enhancements : [[:fr:User:TiChou]], [[:pl:User:Leafnode]] & [[:it:User:Jalo]]
  6. *Version: 0.3.7 (beta)
  7. Oparte na wersji z dnia 26 sierpnia 2008, 17:18
  8. http://fr.wikipedia.org/w/index.php?title=Utilisateur:EDUCA33E/LiveRC.js&oldid=32777249
  9. === Variables globales ===
  10. <source lang="javascript"> */
  11. if (wgTitle == "Leafnode/LiveRC") {
  12. // Appel des parametres par défaut de LiveRC ;
  13. // ///////////////////////////////////////////
  14. document.write('<script type="text/javascript" src="'
  15. + wgServer + wgScriptPath + '/index.php?title='+wgPageName+'/LiveRCparam.js'
  16. + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
  17. // Appel des parametres utilisateur ;
  18. // ///////////////////////////////////////////
  19. document.write('<script type="text/javascript" src="'
  20. + wgServer + wgScriptPath + '/index.php?title=User:'+encodeURI(wgUserName)+'/LiveRCparam.js'
  21. + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
  22. var cssNode = document.createElement('link');
  23. cssNode.type = 'text/css';
  24. cssNode.rel = 'stylesheet';
  25. cssNode.href = 'http://pl.wikipedia.org/skins-1.5/common/diff.css?90';
  26. cssNode.media = 'screen';
  27. cssNode.title = 'dynamicLoadedSheet';
  28. document.getElementsByTagName("head")[0].appendChild(cssNode);
  29. document.write('<script type="text/javascript" src="http://pl.wikipedia.org/skins-1.5/common/diff.js?90"></script>');
  30. var lastrevid,lasttimestamp=1; // Timestamp d'initialisation;
  31. // Découpage de l'URL et de ses parametres;
  32. var _GET = new Array();
  33. var _uri = location.href;
  34. var _temp_get_arr = _uri.substring(_uri.indexOf('?')+1, _uri.length).split("&");
  35. var _temp_get_arr_1 = new Array();
  36. for(_get_arr_i=0; _get_arr_i<_temp_get_arr.length; _get_arr_i++){
  37. _temp_get_arr_1 = _temp_get_arr[_get_arr_i].split("=");
  38. _GET[decodeURIComponent(_temp_get_arr_1[0])] = decodeURIComponent(_temp_get_arr_1[1]);
  39. }
  40. delete _uri; delete _temp_get_arr; delete _temp_get_arr_1;
  41. // Variables d'état (pour test sur rc.state);
  42. var IP = 1;
  43. var BOT = 2 << 0;
  44. var SYSOP = 2 << 1;
  45. var NEW = 2 << 2;
  46. var MINOR = 2 << 3;
  47. var NEWNS = 2 << 4;
  48. var RENAMED = 2 << 5;
  49. var PATROLLED = 2 << 6;
  50. var REVERT = 2 << 7;
  51. var BLANKING = 2 << 8;
  52. var REPLACED = 2 << 9;
  53. var REDIRECT = 2 << 10;
  54. var CATEGORIZED = 2 << 11;
  55. var LOCK = 2 << 12;
  56. var FULLLOCK = 2 << 13;
  57. var HOMONYMIE = 2 << 14;
  58. var ADQ = 2 << 15;
  59. var BA = 2 << 16;
  60. var APDQ = 2 << 17;
  61. var COPYRIGHT = 2 << 18;
  62. var PAS = 2 << 19;
  63. var FIRE = 2 << 20;
  64. var UPLOAD = 2 << 21;
  65. var NEWUSER = 2 << 22;
  66. var BLOCK = 2 << 23;
  67. var DELETE = 2 << 24;
  68. var MOVE = 2 << 25;
  69. var PROTECT = 2 << 26;
  70. var REVIEW = 2 << 27;
  71. var lstSysop = new Array(); // Sysop list;
  72. var lstContact = new Array(); // Contact list;
  73. var lstRevoc = new Array(); // Reverted list;
  74. var lstHidden = new Array(); // Hidden users list;
  75. // Is user Sysop;
  76. var lrcAdmin = false; // default value;
  77. if(wgUserGroups.indexOf("sysop") != -1)
  78. lrcAdmin = true;
  79. // Watchlist;
  80. var lstSuivi = new Array();
  81. var lstSuiviHH = new Array();
  82. }
  83. /* </source>
  84. ===Utilities===
  85. <source lang="javascript"> */
  86. var wpajax = {
  87. http: function(bundle) {
  88. // mandatory: bundle.url
  89. // optional: bundle.async
  90. // optional: bundle.method
  91. // optional: bundle.headers
  92. // optional: bundle.data
  93. // optional: bundle.onSuccess (xmlhttprequest, bundle)
  94. // optional: bundle.onFailure (xmlhttprequest, bundle)
  95. // optional: bundle.otherStuff OK too, passed to onSuccess and onFailure
  96. var xmlhttp;
  97. try {
  98. xmlhttp = new XMLHttpRequest();
  99. } catch(e) {
  100. try {
  101. xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  102. } catch (e) {
  103. try {
  104. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  105. } catch (e) {
  106. xmlhttp = false
  107. }
  108. }
  109. }
  110. if (xmlhttp) {
  111. xmlhttp.onreadystatechange = function() {
  112. if (xmlhttp.readyState == 4)
  113. wpajax.httpComplete(xmlhttp,bundle);
  114. };
  115. xmlhttp.open(bundle.method ? bundle.method : "GET",bundle.url,bundle.async == false ? false : true);
  116. if (bundle.headers) {
  117. for (var field in bundle.headers)
  118. xmlhttp.setRequestHeader(field,bundle.headers[field]);
  119. }
  120. xmlhttp.send(bundle.data ? bundle.data : null);
  121. }
  122. return xmlhttp;
  123. },
  124. httpComplete: function(xmlhttp,bundle) {
  125. if (xmlhttp.status == 200 || xmlhttp.status == 302) {
  126. if (bundle.onSuccess)
  127. bundle.onSuccess(xmlhttp,bundle);
  128. } else if (bundle.onFailure) {
  129. bundle.onFailure(xmlhttp,bundle);
  130. } else {
  131. // A activer en debug mode ?
  132. // alert(xmlhttp.statusText);
  133. }
  134. }
  135. };
  136. // Parser
  137. if (document.implementation.createDocument) {
  138. var gml_xmlparser = new DOMParser();
  139. }
  140. function gml_XMLParse(string) {
  141. if (document.implementation.createDocument) {
  142. return gml_xmlparser.parseFromString(string, "text/xml");
  143. } else if (window.ActiveXObject) {
  144. var gml_xmldoc = new ActiveXObject("Microsoft.XMLDOM");
  145. gml_xmldoc.async = "false";
  146. ret = gml_xmldoc.loadXML(string);
  147. if (!ret)
  148. return null;
  149. return gml_xmldoc.documentElement;
  150. }
  151. return null;
  152. }
  153. // HTMLize
  154. String.prototype.htmlize = function() {
  155. var chars = new Array('&','<','>','"');
  156. var entities = new Array('amp','lt','gt','quot');
  157. var regex = new RegExp();
  158. var string = this;
  159. for (var i=0; i<chars.length; i++) {
  160. regex.compile(chars[i], "g");
  161. string = string.replace(regex, '&' + entities[i] + ';');
  162. }
  163. return string;
  164. }
  165. /* </source>
  166. === LiveDiff ===
  167. <source lang="javascript"> */
  168. function liveDiff(page, id, oldid) {
  169. var el = document.getElementById( 'livePreviewTitle' );
  170. el.innerHTML="<b style='text-decoration: blink;'>Diff : <span style='color:red'>"+page+"</span>...</b>";
  171. wpajax.http({ url: wgServer + wgScriptPath + '/index.php?title='+encodeURIComponent(page)+'&diffonly=1&diff='+id+'&oldid='+oldid,
  172. onSuccess: getDiff, mpage: page, mid: id, moldid:oldid});
  173. }
  174. function getDiff(xmlreq, data) {
  175. var doc = gml_XMLParse(xmlreq.responseText);
  176. var page=data.mpage;
  177. var oldid=data.moldid;
  178. var id=data.mid;
  179. var bC = doc.getElementById('bodyContent');
  180. if (bC == null) bC = doc.getElementById('article')
  181. var LP = document.getElementById( 'livePreview' );
  182. var dLP = document.getElementById( 'divLivePreview' );
  183. var lD = getElementsByClass('diff',bC,null);
  184. var upage=page.replace(new RegExp(/\'/g), "\\'");
  185. if (lD[0] == null)
  186. LP.innerHTML = bC.innerHTML;
  187. else {
  188. if (document.getElementById('showDiffR').checked) {
  189. var avantEl = getElementsByClass('diff-deletedline',bC,null);
  190. var apresEl = getElementsByClass('diff-addedline',bC,null);
  191. var rollback = getElementsByClass('mw-rollback-link',bC,null);
  192. if (rollback[0] == null)
  193. var rl = "";
  194. else
  195. var rl = rollback[0].innerHTML+"<br />";
  196. var avant = "";
  197. var apres = "";
  198. var lav = avantEl.length;
  199. var lap = apresEl.length;
  200. for(var n=0; n < lav ; n++)
  201. avant = avant + avantEl[n].innerHTML + "<br />";
  202. for(var n=0; n < lap ; n++)
  203. apres = apres + apresEl[n].innerHTML + "<br />";
  204. LP.innerHTML = rl+"<table width='100%'><tr><td width='50%' class='diff-deletedline'>"+avant+"</td><td class='diff-addedline'>"+apres+"</td></tr></table>";
  205. }
  206. else {
  207. LP.innerHTML = "<table border='0' width='98%' cellpadding='0' cellspacing='4' class='diff'>"+lD[0].innerHTML+"</table>";
  208. }
  209. }
  210. if (dLP.style.display == "none") {
  211. var elcb = document.getElementById( 'shidPrev' );
  212. elcb.checked="true";
  213. dLP.style.display = "inline";
  214. }
  215. var entete = document.getElementById( 'livePreviewTitle' );
  216. entete.innerHTML='<b><a href="'+wgServer + '/wiki/' + encodeURI(page) + '" target="_new">' + page + '</a></b> • ' +
  217. '(<a href="javascript:;" onClick="liveHist(\''+upage+'\');" style="color:darkorange">Hist</a>)';
  218. var asNextDiff = doc.getElementById("differences-nextlink");
  219. if(asNextDiff == null) {
  220. var optAvert = "";
  221. var optl = lstAvert.length;
  222. for (j=0; j<optl; j++) {
  223. optAvert += '<option value="'+lstAvert[j].template;
  224. if(lstAvert[j].hasPage) optAvert += '|'+upage;
  225. optAvert += '">'+lstAvert[j].string+'</option>';
  226. }
  227. // Get username of submitter
  228. var user1 = doc.getElementById( 'mw-diff-otitle2' );
  229. if (user1 != null) {
  230. var usertmp=user1.innerHTML;
  231. user1 = usertmp.replace(new RegExp(/<a (.*)>(.*)<\/a>(.*)\((.*)\)/g), "$2");
  232. user1 = user1.replace(new RegExp(/(.*)<(.*)>/g), "$1");
  233. }
  234. var user2 = doc.getElementById( 'mw-diff-ntitle2' );
  235. if (user2 != null) {
  236. var usertmp=user2.innerHTML;
  237. user2 = usertmp.replace(new RegExp(/<a (.*)>(.*)<\/a>(.*)\(<a(.*)/g), "$2");
  238. }
  239. user1=user1.replace(new RegExp(/\'/g), "\\'");
  240. user2=user2.replace(new RegExp(/\'/g), "\\'");
  241. var identique="";
  242. if(user1 == user2) {
  243. identique = "<b style='color:red'>[kolejna edycja]</b> ";
  244. }
  245. entete.innerHTML = '<table width="100%" class="creator"><tr><td>' + entete.innerHTML +
  246. '</td><td align="right"><small>' + identique +
  247. // Verifier avant si le patrouilleur peut modifier cette page ? (query.php?what=permissions&titles=page)
  248. '[<a id="LiveRevertLink" href="javascript:getLiveMessage(\'liverevert\',\''+user1+'\',\''+user2+'\',\''+upage+'\',\''+oldid+'\');" >' + lang_menu[0].UNDORC+'</a>] • ' +
  249. lang_menu[0].REASON+' : <input id="LiveRevertMessage" /> ••• ' +
  250. '[<a id="LiveAvertoLink" href="javascript:getLiveAverto(\''+user2+'\');">'+lang_menu[0].AVERTS+'</a>] : ' +
  251. '<select id="averto">' + optAvert + '</select>' +
  252. '</td></tr></table>';
  253. document.getElementById('LiveRevertMessage').focus();
  254. }
  255. }
  256. function getLiveAverto(user) {
  257. var link = document.getElementById('LiveAvertoLink');
  258. link.href = "javascript:;";
  259. link.style.color = "silver";
  260. link.style.cursor = "default";
  261. link.style.textDecoration = "none";
  262. document.getElementById('averto').disabled = true;
  263. var message = document.getElementById('averto').value;
  264. wpajax.http({ url: wgServer + wgScriptPath + '/index.php?title=User_Talk:' + encodeURIComponent(user) + '&action=edit',
  265. onSuccess: postLiveAverto,
  266. user: user, message: message });
  267. }
  268. function postLiveAverto(xmlreq, data) {
  269. var parser = new DOMParser();
  270. var doc = parser.parseFromString(xmlreq.responseText, 'application/xhtml+xml');
  271. var user = data.user;
  272. var message = data.message.replace(new RegExp(/\\'/g),"'");
  273. // Message au début
  274. // var wpTextbox1 = encodeURIComponent('{{subst:' + message + '}} ~~~~\n' + doc.getElementById('wpTextbox1').value);
  275. var wpTextbox1 = encodeURIComponent(doc.getElementById('wpTextbox1').value + '\n\n{{subst:' + message + '}} ~~~~\n');
  276. var inputs = doc.getElementById('editform').getElementsByTagName('input');
  277. var editform = new Array();
  278. for (i=0; i<inputs.length; i++) {
  279. editform[inputs[i].name] = inputs[i].value;
  280. }
  281. var wpStarttime = encodeURIComponent(editform['wpStarttime']);
  282. var wpEdittime = encodeURIComponent(editform['wpEdittime']);
  283. var wpEditToken = encodeURIComponent(editform['wpEditToken']);
  284. //var wpSummary = encodeURIComponent('LiveRC : Avertissement ! ' + message.replace(new RegExp(/\|(.*)/), ' sur [[$1]]') + ' !');
  285. var wpSummary = encodeURIComponent('LiveRC : Ostrze?enie ! ' + message.replace(new RegExp(/\|(.*)/), ' on [[$1]]') + ' !');
  286. var headers = new Array();
  287. headers['Content-Type'] = 'application/x-www-form-urlencoded';
  288. wpajax.http({ url: wgServer + wgScriptPath + '/index.php?title=User_Talk:' + encodeURI(user) + '&action=submit',
  289. method: "POST", headers: headers,
  290. data: 'wpSave=1&wpTextbox1=' + wpTextbox1 + '&wpStarttime=' + wpStarttime + '&wpEdittime=' + wpEdittime
  291. + '&wpEditToken=' + wpEditToken + '&wpSummary=' + wpSummary});
  292. }
  293. function getLiveMessage(where, user1, user2, page, oldid) {
  294. var links = [ document.getElementById('LiveRevertLink') ];
  295. var i,len=links.length;
  296. for (i=0; i<len; i++) {
  297. links[i].href = "javascript:;";
  298. links[i].style.color = "silver";
  299. links[i].style.cursor = "default";
  300. links[i].style.textDecoration = "none";
  301. }
  302. document.getElementById('LiveRevertMessage').disabled = true;
  303. var message = document.getElementById('LiveRevertMessage').value;
  304. wpajax.http({ url: wgServer + wgScriptPath + '/index.php?title=' + encodeURI(page) + '&action=edit&oldid=' + oldid,
  305. onSuccess: postLiveRevert,
  306. where: where, page: page, user1: user1, user2: user2, message: message });
  307. }
  308. function postLiveRevert(xmlreq, data) {
  309. var parser = new DOMParser();
  310. var doc = parser.parseFromString(xmlreq.responseText, 'application/xhtml+xml');
  311. var where = data.where;
  312. var page = data.page;
  313. var user1 = data.user1;
  314. var user2 = data.user2;
  315. var message = data.message;
  316. var wpTextbox1 = encodeURIComponent(doc.getElementById('wpTextbox1').value);
  317. var inputs = doc.getElementById('editform').getElementsByTagName('input');
  318. var editform = new Array();
  319. for (i=0; i<inputs.length; i++) {
  320. editform[inputs[i].name] = inputs[i].value;
  321. }
  322. var wpStarttime = encodeURIComponent(editform['wpStarttime']);
  323. var wpEdittime = encodeURIComponent(editform['wpEdittime']);
  324. var wpEditToken = encodeURIComponent(editform['wpEditToken']);
  325. switch(where) {
  326. case 'liverevert':
  327. var wpSummary = lang_menu[0].RVMES1 + ' [[Special:Contributions/' + user2 + '|' + user2
  328. + ']]; '+lang_menu[0].RVMES2+' [[User:' + user1 + '|' + user1 + ']]';
  329. break;
  330. /* case 'livevandalism':
  331. var wpSummary = 'LiveRC : Révocation de vandalisme par [[Special:Contributions/' + user2 + '|' + user2
  332. + ']]; retour a la version de [[User:' + user1 + '|' + user1 + ']]';
  333. break; */
  334. }
  335. if (message)
  336. wpSummary = wpSummary + ' ; ' + message;
  337. wpSummary = encodeURIComponent(wpSummary);
  338. var headers = new Array();
  339. headers['Content-Type'] = 'application/x-www-form-urlencoded';
  340. wpajax.http({ url: wgServer + wgScriptPath + '/index.php?title=' + encodeURIComponent(page) + '&action=submit',
  341. method: "POST", headers: headers,
  342. data: 'wpSave=1&wpTextbox1=' + wpTextbox1 + '&wpStarttime=' + wpStarttime + '&wpEdittime=' + wpEdittime
  343. + '&wpEditToken=' + wpEditToken + '&wpSummary=' + wpSummary});
  344. }
  345. /* </source>
  346. === LiveHist ===
  347. <source lang="javascript"> */
  348. function liveHist(page) {
  349. var el = document.getElementById( 'livePreviewTitle' );
  350. el.innerHTML="<b style='text-decoration: blink;'>Hist : <span style='color:red'>"+page+"</span>...</b>";
  351. wpajax.http({url:wgServer + wgScriptPath + '/index.php?title=' + encodeURIComponent(page) + '&action=history', onSuccess: getHist, message: page });
  352. }
  353. function getHist(xmlreq, data) {
  354. doc = gml_XMLParse(xmlreq.responseText);
  355. bC = doc.getElementById('bodyContent')
  356. if (bC == null) bC = doc.getElementById('article')
  357. var c=data.message;
  358. var LP = document.getElementById( 'livePreview' );
  359. var dLP = document.getElementById( 'divLivePreview' );
  360. LP.innerHTML = bC.innerHTML;
  361. if (dLP.style.display == "none") {
  362. var elcb = document.getElementById( 'shidPrev' );
  363. elcb.checked="true";
  364. dLP.style.display = "inline";
  365. }
  366. var elt = document.getElementById( 'livePreviewTitle' );
  367. elt.innerHTML='<b><a href="'+wgServer+'/wiki/'+encodeURIComponent(c)+'" target="_new">'+c+'</a></b>';
  368. }
  369. /* </source>
  370. === LiveArticle ===
  371. <source lang="javascript"> */
  372. function liveArticle(page) {
  373. var el = document.getElementById( 'livePreviewTitle' );
  374. el.innerHTML="<b style='text-decoration: blink;'><span style='color:red'>"+page+"</span>...</b>";
  375. wpajax.http({url:wgServer + wgScriptPath + '/index.php?title=' + encodeURIComponent(page) + '&redirect=no', onSuccess: getArticle, message: page });
  376. }
  377. function getArticle(xmlreq, data) {
  378. doc = gml_XMLParse(xmlreq.responseText);
  379. bC = doc.getElementById('bodyContent')
  380. if (bC == null) bC = doc.getElementById('article')
  381. var c=data.message;
  382. var LP = document.getElementById( 'livePreview' );
  383. var dLP = document.getElementById( 'divLivePreview' );
  384. LP.innerHTML = bC.innerHTML;
  385. if (dLP.style.display == "none") {
  386. var elcb = document.getElementById( 'shidPrev' );
  387. elcb.checked="true";
  388. dLP.style.display = "inline";
  389. }
  390. var elt = document.getElementById( 'livePreviewTitle' );
  391. elt.innerHTML='<b><a href="'+wgServer+'/wiki/'+encodeURI(c)+'" target="_new">'+c+'</a></b>';
  392. }
  393. /* </source>
  394. === LiveContrib ===
  395. <source lang="javascript"> */
  396. function liveContrib(user) {
  397. var el = document.getElementById( 'livePreviewTitle' );
  398. el.innerHTML="<b style='text-decoration: blink;'><span style='color:red'>"+user+"</span>...</b>";
  399. wpajax.http({url:wgServer + '/wiki/Special:Contributions/'+encodeURIComponent(user),
  400. onSuccess: getContrib, message: user });
  401. }
  402. function getContrib(xmlreq, data) {
  403. doc = gml_XMLParse(xmlreq.responseText);
  404. bC = doc.getElementById('bodyContent')
  405. if (bC == null) bC = doc.getElementById('article')
  406. var user=data.message;
  407. var LP = document.getElementById( 'livePreview' );
  408. var dLP = document.getElementById( 'divLivePreview' );
  409. LP.innerHTML = bC.innerHTML;
  410. if (dLP.style.display == "none") {
  411. var elcb = document.getElementById( 'shidPrev' );
  412. elcb.checked="true";
  413. dLP.style.display = "inline";
  414. }
  415. var utilde=user.replace(new RegExp(/\'/g), "\\'");
  416. var optAvert = "";
  417. var optl = lstAvert.length;
  418. for (j=0; j<optl; j++) {
  419. if(lstAvert[j].hasPage) continue;
  420. optAvert += '<option value="'+lstAvert[j].template+'">'+lstAvert[j].string+'</option>';
  421. }
  422. var entete = document.getElementById( 'livePreviewTitle' );
  423. entete.innerHTML='<b><a href="'+wgServer+'/wiki/User:'+encodeURIComponent(user)+'" target="_new">'+user+'</a></b>';
  424. entete.innerHTML = '<table width="100%" class="creator"><tr><td>'+entete.innerHTML +
  425. '</td><td align="right"><small>' +
  426. '[<a id="LiveAvertoLink" href="javascript:var message=getLiveAverto(\''+utilde+'\');">'+lang_menu[0].AVERTS+'</a>] : ' +
  427. '<select id="averto">' + optAvert + '</select>' + '</td></tr></table>';
  428. }
  429. /* </source>
  430. === LiveLog (:it:User:Jalo) ===
  431. <source lang="javascript"> */
  432. function liveLog(action,page) {
  433. var titolo = '';
  434. switch(action) {
  435. case 'upload':
  436. titolo = 'Log dei caricamenti';
  437. break;
  438. case 'newuser':
  439. titolo = 'Log dei nuovi utenti';
  440. break;
  441. case 'block':
  442. titolo = 'Log dei blocchi utente';
  443. break;
  444. case 'delete':
  445. titolo = 'Log delle cancellazioni';
  446. break;
  447. case 'move':
  448. titolo = 'Log degli spostamenti';
  449. break;
  450. case 'protect':
  451. titolo = 'Log delle protezioni';
  452. break;
  453. default:
  454. break;
  455. }
  456. var el = document.getElementById( 'livePreviewTitle' );
  457. el.innerHTML="<b style='text-decoration: blink;'><span style='color:red'>"+titolo+"</span>...</b>";
  458. wpajax.http({url:wgServer + wgScriptPath + '/index.php?title=Special:Log&type=' + action + "&user=&page=" + encodeURIComponent(page), onSuccess: getLog, message: page });
  459. }
  460. function getLog(xmlreq, data) {
  461. doc = gml_XMLParse(xmlreq.responseText);
  462. bC = doc.getElementById('bodyContent')
  463. if (bC == null) bC = doc.getElementById('article')
  464. var c=data.message;
  465. var LP = document.getElementById( 'livePreview' );
  466. var dLP = document.getElementById( 'divLivePreview' );
  467. LP.innerHTML = bC.innerHTML;
  468. if (dLP.style.display == "none") {
  469. var elcb = document.getElementById( 'shidPrev' );
  470. elcb.checked="true";
  471. dLP.style.display = "inline";
  472. }
  473. var elt = document.getElementById( 'livePreviewTitle' );
  474. elt.innerHTML='<b><a href="'+wgServer+'/wiki/'+encodeURI(c)+'" target="_new">'+c+'</a></b>';
  475. }
  476. /* </source>
  477. === LiveSysop ===
  478. <source lang="javascript"> */
  479. function liveSysop() {
  480. wpajax.http({url:wgServer + wgScriptPath + '/index.php?title=Special:Listusers&limit=500&group=sysop',
  481. onSuccess: getSysop, message: "Pobieranie listy adminów" });
  482. }
  483. function getSysop(xmlreq, data) {
  484. var doc = gml_XMLParse(xmlreq.responseText);
  485. var bC = doc.getElementById('bodyContent');
  486. if (bC == null) bC = doc.getElementById('article')
  487. var lstSys = bC.getElementsByTagName( 'ul' )[ 0 ].getElementsByTagName( 'li' );
  488. var info="";
  489. var len = lstSys.length
  490. for(var i=0; i < len ; i++) {
  491. info=lstSys[i].getElementsByTagName( 'a' )[ 0 ].innerHTML;
  492. lstSysop.push(info);
  493. }
  494. liveNS();
  495. }
  496. function liveWatch() {
  497. wpajax.http({url:wgServer + '/wiki/Special:Watchlist/edit',
  498. onSuccess: getWatch, message: "Pobieranie obserwowanych" });
  499. }
  500. function getWatch(xmlreq, data) {
  501. var doc = gml_XMLParse(xmlreq.responseText);
  502. var bC = doc.getElementById('bodyContent');
  503. if (bC == null) bC = doc.getElementById('article')
  504. var info="";
  505. var lstUL = bC.getElementsByTagName( 'ul' );
  506. var lenUL = lstUL.length;
  507. for(var j=0; j < lenUL ; j++) {
  508. var lstLI = lstUL[j].getElementsByTagName( 'li' );
  509. var lenLI = lstLI.length;
  510. for(var i=0; i < lenLI ; i++) {
  511. var input = lstLI[i].getElementsByTagName( 'input' )
  512. if (input.length > 0) {
  513. info = input[0].value
  514. lstSuivi.push(info);
  515. lstSuiviHH.push("--:--");
  516. }
  517. }
  518. }
  519. liveRC();
  520. }
  521. /* function liveWatch() {
  522. wpajax.http({url:wgServer + wgScriptPath + '/api.php?action=query&list=watchlist&wllimit=500&format=xml',
  523. onSuccess: getWatch, message: "Pobieranie listy obserwowanych" });
  524. }
  525. function getWatch(xmlreq, data) {
  526. var a=xmlreq.responseText;
  527. var c=data.message;
  528. var i;
  529. // document.getElementById('debug').innerHTML = a+"<br />**************************";
  530. if(a.indexOf("<error")!=-1) {
  531. var lvSuivi = document.getElementById( 'liveSuivi' );
  532. lvSuivi.innerHTML = "<small>Suivi désactivé. (API.php : watchlist)</small>";
  533. return;
  534. }
  535. a=a.split("title=\"");
  536. var info="";
  537. for(i=a.length-1; i >= 0 ; i--) {
  538. info=a[i].substr(0,a[i].indexOf("\" pageid"));
  539. if (info == "") continue;
  540. lstSuivi.push(info);
  541. lstSuiviHH.push("--:--");
  542. }
  543. //document.getElementById('debug').innerHTML += lstSuivi;
  544. } */
  545. function liveNS() {
  546. wpajax.http({url: wgServer + wgScriptPath + '/api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml',
  547. onSuccess: getNS, message: "Pobieranie nazw przestrzeni" });
  548. }
  549. function getNS(xmlreq, data) {
  550. var api = xmlreq.responseXML;
  551. if (api.firstChild.nodeName == "error") return;
  552. var nss = api.getElementsByTagName('query')[0].getElementsByTagName('namespaces')[0].getElementsByTagName('ns');
  553. var len = nss.length;
  554. var i;
  555. var id,ns;
  556. var options = "";
  557. var lstNs = new Array();
  558. for (i=0; i<len; i++) {
  559. id = nss[i].getAttribute('id');
  560. ns = nss[i].textContent;
  561. if (id < 0) continue;
  562. if (id == 0) ns = "Article";
  563. options += '<option value="' + id + '">' + ns + '</option>';
  564. lstNs.push(id);
  565. }
  566. options = '<option value="' + lstNs.join('|') + '">*</option>' + options;
  567. document.getElementById('selectNS').innerHTML = '<label for="showNS0">'+lang_menu[0].NAMESP+' </label><select id="showNS0">' + options + '</select>';
  568. liveWatch();
  569. }
  570. /* </source>
  571. === LiveRC ===
  572. <source lang="javascript"> */
  573. function supprLigne(quelLigne) {
  574. var i,len;
  575. var tab = document.getElementById('tabRC');
  576. var els = new Array();
  577. if (quelLigne == '*')
  578. els = tab.getElementsByTagName('tr');
  579. else if (quelLigne == 'd') {
  580. var _els = tab.getElementsByTagName('tr');
  581. len = _els.length;
  582. for (i=len-1; i>=0; i--)
  583. if (_els[i].firstChild.style.backgroundColor == 'rgb(255, 250, 205)')
  584. els.push(_els[i]);
  585. } else if (quelLigne == 'r') {
  586. var _els = tab.getElementsByTagName('tr');
  587. len = _els.length;
  588. for (i=len-1; i>=0; i--)
  589. if (_els[i].firstChild.style.backgroundColor == 'rgb(255, 228, 225)')
  590. els.push(_els[i]);
  591. } else if (quelLigne == 'n') {
  592. var _els = tab.getElementsByTagName('tr');
  593. len = _els.length;
  594. for (i=len-1; i>=0; i--)
  595. if (_els[i].firstChild.style.backgroundColor == 'rgb(226, 242, 210)')
  596. els.push(_els[i]);
  597. } else
  598. els.push(document.getElementById(quelLigne));
  599. len = els.length;
  600. for (i=len-1; i>=0; i--)
  601. if (els[i] != null)
  602. tab.removeChild(els[i]);
  603. }
  604. function changeLigne(quelLigne) {
  605. var el = document.getElementById(quelLigne);
  606. var els1 = el.getElementsByTagName('th');
  607. var els2 = el.getElementsByTagName('td');
  608. var len = els1.length;
  609. for (var i=len-1; i>=0; i--)
  610. if (els1[i] != null)
  611. els1[i].style.backgroundColor = "#FFFACD";
  612. var len = els2.length;
  613. for (var i=len-1; i>=0; i--)
  614. if (els2[i] != null)
  615. els2[i].style.backgroundColor = "#FFFFE0";
  616. }
  617. function getElementsByClass(searchClass,node,tag) {
  618. var classElements = new Array();
  619. if ( node == null )
  620. node = document;
  621. if ( tag == null )
  622. tag = '*';
  623. var els = node.getElementsByTagName(tag);
  624. var elsLen = els.length;
  625. var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
  626. for (i = 0, j = 0; i < elsLen; i++) {
  627. if (pattern.test(els[i].className) ) {
  628. classElements[j] = els[i];
  629. j++;
  630. }
  631. }
  632. return classElements;
  633. }
  634. function tsToHhMm(timestamp) {
  635. var tz;
  636. var match, regex = new RegExp();
  637. if (lrcTZ) {
  638. regex.compile(/^([-+])?(\d?\d):?(\d\d)$/);
  639. match = regex.exec(lrcTZ);
  640. if (!match) {
  641. //livercError(lang_error.TZ);
  642. return 'xx:xx';
  643. }
  644. tz = match[2]*60 + match[3]*1;
  645. tz = match[1] == '-' ? -tz : tz;
  646. } else {
  647. var now = new Date();
  648. tz = -now.getTimezoneOffset();
  649. }
  650. regex.compile(/^\d\d\d\d-\d\d-\d\dT(\d\d):(\d\d):\d\dZ$/);
  651. match = regex.exec(timestamp);
  652. if (!match) {
  653. //livercError(lang_error.timestamp);
  654. return 'xx:xx';
  655. }
  656. var tt = (match[1]*60 + match[2]*1 + tz + 1440) % 1440;
  657. var mm = tt % 60;
  658. var hh = (tt - mm) / 60 % 24;
  659. return hh + ':' + (mm < 10 ? '0' : '') + mm;
  660. }
  661. function updateHidden() {
  662. var tempAr = new Array();
  663. for (var user in lstHidden) {
  664. var utilde = user.replace(new RegExp(/\'/g), "\\'");
  665. var uremove = '<a href="javascript:;" onClick="unhideUser(\''+utilde+'\');" style="color:grey">-</a>';
  666. var udiscut = '<a href="'+wgServer+'/wiki/User talk:'+encodeURIComponent(user)+'" style="color:seagreen" target="_new">T</a>';
  667. var ucontrib = '<a href="javascript:;" onClick="liveContrib(\''+utilde+'\');" style="color:#43CD80">C</a>';
  668. var uadmin = '';
  669. if (lrcAdmin == true) {
  670. uadmin = ' • <a href="'+wgServer+'/wiki/Special:Blockip/'+encodeURI(user)+'" target="_new" style="color:seagreen">B</a>';
  671. }
  672. var ueditor = '<a href="'+wgServer+'/wiki/User:'+encodeURIComponent(user)+'" target="_new">'+user+'</a>';
  673. var ligne = '<span id="hidden-' + user + '"><small>' + uremove + ' • ' + udiscut + ' • ' + ucontrib + uadmin + ' • </small>' + ueditor + '</span><br />';
  674. tempAr.push(ligne);
  675. }
  676. tempAr.sort();
  677. var lvHidden = document.getElementById('liveHidden');
  678. lvHidden.innerHTML = "";
  679. var len = tempAr.length;
  680. for (var n=len-1; n>=0; n--)
  681. lvHidden.innerHTML += tempAr[n];
  682. }
  683. function updateFollowContact() {
  684. var tempAr = new Array();
  685. for (var user in lstContact) {
  686. var timestamp = lstContact[user].ts;
  687. if (timestamp == 0) continue;
  688. var utilde = user.replace(new RegExp(/\'/g), "\\'");
  689. var udiscut = '<a href="'+wgServer+'/wiki/User talk:'+encodeURIComponent(user)+'" style="color:seagreen" target="_new">T</a>';
  690. var ucontrib = '<a href="javascript:;" onClick="liveContrib(\''+utilde+'\');" style="color:#43CD80">C</a>';
  691. var uadmin = '';
  692. if (lrcAdmin == true) {
  693. uadmin = ' • <a href="'+wgServer+'/wiki/Special:Blockip/'+encodeURI(user)+'" target="_new" style="color:seagreen">B</a>';
  694. }
  695. var ueditor = '<a href="'+wgServer+'/wiki/User:'+encodeURIComponent(user)+'" target="_new">'+user+'</a>';
  696. var ligne = '<span id="contact-' + timestamp + '"><small>' + tsToHhMm(timestamp) + ' • ' + udiscut + ' • ' + ucontrib + uadmin + ' • </small>' + ueditor + '</span><br />';
  697. tempAr.push(ligne);
  698. }
  699. tempAr.sort();
  700. var lvContact = document.getElementById('liveContact');
  701. lvContact.innerHTML = "";
  702. var len = tempAr.length;
  703. for (var n=len-1; n>=0; n--)
  704. lvContact.innerHTML += tempAr[n];
  705. }
  706. function updateFollowRevoc() {
  707. var tempAr = new Array();
  708. for (var user in lstRevoc) {
  709. var timestamp = lstRevoc[user].ts;
  710. var utilde = user.replace(new RegExp(/\'/g), "\\'");
  711. var udiscut = '<a href="'+wgServer+'/wiki/User talk:'+encodeURIComponent(user)+'" style="color:seagreen" target="_new">T</a>';
  712. var ucontrib = '<a href="javascript:;" onClick="liveContrib(\''+utilde+'\');" style="color:#43CD80">C</a>';
  713. var uadmin = '';
  714. if (lrcAdmin == true) {
  715. uadmin = ' • <a href="'+wgServer+'/wiki/Special:Blockip/'+encodeURI(user)+'" target="_new" style="color:seagreen">B</a>';
  716. }
  717. var ueditor = '<a href="'+wgServer+'/wiki/User:'+encodeURIComponent(user)+'" target="_new">'+user+'</a>';
  718. var ligne = '<span id="revoc-' + timestamp + '"><small>' + tsToHhMm(timestamp) + ' • ' + udiscut + ' • ' + ucontrib + uadmin + ' • </small>' + ueditor + ' (' + lstRevoc[user].nb + ' '+lang_menu[0].XTIMES+')</span><br />';
  719. tempAr.push(ligne);
  720. }
  721. tempAr.sort();
  722. var lvRevoc = document.getElementById('liveRevoc');
  723. lvRevoc.innerHTML = "";
  724. var len = tempAr.length;
  725. for (var n=len-1; n>=0; n--)
  726. lvRevoc.innerHTML += tempAr[n];
  727. }
  728. //function getRevision(xmlreq, data) {
  729. function getRevision(rc) {
  730. if (document.getElementById('stopLive').checked) return;
  731. // var api = xmlreq.responseXML.getElementsByTagName('api')[0];
  732. //
  733. // if (api.firstChild.nodeName == "error") return;
  734. var match, regex = new RegExp();
  735. // var rc = data.rc
  736. var title = rc.title;
  737. var pageid = rc.pageid;
  738. var revid = rc.revid;
  739. var oldid = rc.old_revid;
  740. var user = rc.user;
  741. var comment = (rc.comment ? rc.comment : "");
  742. var timestamp = rc.timestamp;
  743. var ns = rc.ns;
  744. var state = rc.state;
  745. regex.compile(/\'/g);
  746. var escTitle = title.replace(regex, "\\'");
  747. var escUser = user.replace(regex, "\\'");
  748. // var revisions = api.getElementsByTagName('query')[0].getElementsByTagName('pages')[0].getElementsByTagName('page')[0].getElementsByTagName('revisions')[0].getElementsByTagName('rev');
  749. //
  750. // var oldsize = (state & NEW ? 0 : revisions[1].textContent.length);
  751. // var newsize = revisions[0].textContent.length
  752. var oldsize = rc.oldlen
  753. var newsize = rc.newlen
  754. var sizediff = newsize - oldsize;
  755. // INITIALISATION LIGNE RC //
  756. var tr1 = document.createElement('tr');
  757. var th0 = document.createElement('th');
  758. var th1 = document.createElement('th');
  759. var td2 = document.createElement('td');
  760. var td3 = document.createElement('td');
  761. var td4 = document.createElement('td');
  762. // SUPPR. LIGNE //
  763. th0.innerHTML = '<a href="javascript:;" onClick="supprLigne(\''+pageid+'_'+revid+'\');" style="color:red">X</a>';
  764. // ARTICLE //
  765. var arti = "", artiStyle = "";
  766. var preArti = "", postArti = "";
  767. var diff = "";
  768. var diffClose = "";
  769. if (lrcAutoCloseDiff == 1)
  770. diffClose='supprLigne(\''+pageid+'_'+revid+'\');';
  771. if (state & NEW)
  772. diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveArticle(\''+escTitle+'\',\''+user+'\');'+diffClose+'" style="color:green">New</a>';
  773. else if (state & UPLOAD)
  774. diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'upload\',\''+escTitle+'\');'+diffClose+'" style="color:darkslateblue">Log</a>';
  775. else if (state & NEWUSER)
  776. diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'newusers\',\''+escTitle+'\');'+diffClose+'" style="color:lime">Log</a>';
  777. else if (state & BLOCK)
  778. diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'block\',\''+escTitle+'\');'+diffClose+'" style="color:darkgoldenrod">Log</a>';
  779. else if (state & DELETE)
  780. diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'delete\',\''+escTitle+'\');'+diffClose+'" style="color: saddlebrown">Log</a>';
  781. else if (state & MOVE)
  782. diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'move\',\''+escTitle+'\');'+diffClose+'" style="color:black">Log</a>';
  783. else if (state & PROTECT)
  784. diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'protect\',\''+escTitle+'\');'+diffClose+'" style="color: darkslategray">Log</a>';
  785. else { // simple edit
  786. diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveDiff(\''+escTitle+'\','+revid+','+oldid+');'+diffClose+'" style="color:orange">Diff</a>';
  787. diff += '<sup><a href="' + wgServer + wgScriptPath + '/index.php?title='+encodeURI(escTitle)+'&diff='+revid+'&oldid='+oldid+'" target="_new">+</a></sup>';
  788. }
  789. var hist = '';
  790. var edit = '';
  791. var admin = '';
  792. // Don't show link for log rows
  793. if (!(state & UPLOAD) &&
  794. !(state & NEWUSER) &&
  795. !(state & BLOCK) &&
  796. !(state & DELETE) &&
  797. !(state & PROTECT) &&
  798. !(state & MOVE))
  799. {
  800. hist = '<a href="javascript:;" onClick="liveHist(\''+escTitle+'\');" style="color:darkorange">C</a>';
  801. edit = '<a href="' + wgServer + wgScriptPath + '/index.php?title='+encodeURI(escTitle)+'&action=edit" target="_new" style="color:tomato">M</a>';
  802. if (lrcAdmin == true) {
  803. admin = ' • <a href="' + wgServer + wgScriptPath + '/index.php?title='+encodeURI(escTitle)+'&action=delete" target="_new" style="color:orangered">S</a>';
  804. admin += ' • <a href="' + wgServer + wgScriptPath + '/index.php?title='+encodeURI(escTitle)+'&action=protect" target="_new" style="color: coral">P</a>';
  805. }
  806. }
  807. // Disambig / Homonymie ? ;
  808. ///////////////////////////
  809. if (ns == 0 && state & HOMONYMIE) {
  810. artiStyle = 'color: darkorange; font-weight: bold; font-style: italic;';
  811. preArti += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/7/72/Disambig.svg/16px-Disambig.svg.png" width="16px" alt="Homonymie" /> '
  812. }
  813. // Page protégée ? ;
  814. ////////////////////
  815. if (state & FULLLOCK)
  816. preArti += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Padlock-red.svg/16px-Padlock-red.svg.png" width="16px" alt="Article protégé"/> ';
  817. if (state & LOCK)
  818. preArti += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Padlock-gold.svg/16px-Padlock-gold.svg.png" width="16px" alt="Article semi-protégé"/> ';
  819. // Copyright ? ;
  820. //////////
  821. if (state & COPYRIGHT)
  822. preArti += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Copyright.svg/16px-Copyright.svg.png" width="16px" alt="Copyright" /> ';
  823. // PaS ? ;
  824. //////////////////
  825. if (state & PAS)
  826. 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="PaS" /> ';
  827. // Intervention wikipompiers ? ;
  828. ////////////////////////////////
  829. if (state & FIRE)
  830. preArti += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/99/FireIcon.svg/12px-FireIcon.svg.png" height="12px" alt="Intervention Wikipompiers" /> ';
  831. // Adq ? ;
  832. //////////
  833. if (state & ADQ)
  834. postArti += '<sup><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/Fairytale_bookmark_gold.png/10px-Fairytale_bookmark_gold.png" width="10px" alt="Adq" /></sup>';
  835. // Bon article ? ;
  836. //////////////////
  837. if (state & BA)
  838. postArti += '<sup><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/8/8a/Fairytale_bookmark_silver_light.png/10px-Fairytale_bookmark_silver_light.png" width="10px" alt="Bon article" /></sup>';
  839. // Article potentiellement de qualité ? ;
  840. /////////////////////////////////////////
  841. if (state & APDQ)
  842. postArti += '<sup><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Fairytale_bookmark_light.png/10px-Fairytale_bookmark_light.png" width="10px" alt="Article potentiellement de qualité" /></sup>';
  843. // Article catégorisé ? ;
  844. /////////////////////////
  845. var isCategorized = "";
  846. if (!(state & REDIRECT)
  847. && !(state & HOMONYMIE)
  848. && ns == 0
  849. && !(state & CATEGORIZED))
  850. postArti += '<sup style="color:crimson">(cat ?)</sup>';
  851. // Redirect, Log, or simple edit ? ;
  852. //////////////////
  853. if (state & MOVE) {
  854. // artiStyle = 'color: magenta; font-weight: bold; font-style: italic;';
  855. postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Forward.png/16px-Forward.png" width="16px" alt="Renommage" />';
  856. postArti += ' <a href="javascript:;" onClick="liveArticle(\''+rc.new_title+'\',\''+user+'\');">'+rc.new_title+'</a>';
  857. arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+escTitle+'\',\''+user+'\');">'+title+'</a>';
  858. }
  859. else if (state & REDIRECT) {
  860. artiStyle = 'color: green; font-weight: bold; font-style: italic;';
  861. postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/Redirectltr.png/20px-Redirectltr.png" width="20px" alt="Redirect" />';
  862. postArti += ' <a href="javascript:;" onClick="liveArticle(\''+rc.redirect+'\',\''+user+'\');">'+rc.redirect+'</a>';
  863. arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+escTitle+'\',\''+user+'\');">'+title+'</a>';
  864. }
  865. else if (state & UPLOAD) {
  866. 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" />';
  867. arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+escTitle+'\',\''+user+'\');" onDblClick="window.open(\''+wgServer+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>';
  868. }
  869. else if (state & NEWUSER) {
  870. postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Crystal_personal.png/16px-Crystal_personal.png" width="16px" alt="Nouvel utilisateur" />';
  871. arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+escTitle+'\',\''+user+'\');" onDblClick="window.open(\''+wgServer+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>';
  872. }
  873. else if (state & BLOCK) {
  874. // artiStyle = 'color: magenta; font-weight: bold; font-style: italic;';
  875. 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" />';
  876. postArti += ' <a href="javascript:;" onClick="liveLog("block",\''+rc.title+'\');">('+rc.duration+')</a>';
  877. arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+escTitle+'\',\''+user+'\');">'+title+'</a>';
  878. }
  879. else if (state & DELETE) {
  880. postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/ef/Editcut.png/16px-Editcut.png" width="16px" alt="Suppression" />';
  881. arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+escTitle+'\',\''+user+'\');" onDblClick="window.open(\''+wgServer+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>';
  882. }
  883. else if (state & PROTECT) {
  884. 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" />';
  885. arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+escTitle+'\',\''+user+'\');" onDblClick="window.open(\''+wgServer+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>';
  886. }
  887. else {
  888. arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+escTitle+'\',\''+user+'\');" onDblClick="window.open(\''+wgServer+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>';
  889. }
  890. th1.innerHTML = '<small>' + tsToHhMm(timestamp) + ' • ' + diff + ' • ' + hist + ' • ' + edit + admin + ' • </small>'
  891. + preArti + arti + postArti;
  892. th1.className="creator-title";
  893. th1.style.textAlign="left";
  894. th1.style.border="1px";
  895. th1.style.width="40%";
  896. // EDITOR //
  897. ////////////
  898. var discut = '<a href="'+wgServer+'/wiki/User talk:'+encodeURIComponent(user)+'" style="color:seagreen" target="_new">T</a>';
  899. var contrib = '<a href="javascript:;" onClick="liveContrib(\''+escUser+'\');" style="color:#43CD80">C</a>';
  900. var editor = "", preEditor = "";
  901. // Bot ? ;
  902. //////////
  903. if (state & BOT)
  904. preEditor += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/Nuvola_apps_kservices.png/16px-Nuvola_apps_kservices.png" width="16px" />&nbsp;';
  905. // Sysop ? ;
  906. ////////////
  907. if (state & SYSOP)
  908. preEditor += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Broom_icon.svg/16px-Broom_icon.svg.png" width="16px" />&nbsp;';
  909. // Reverted ? ;
  910. /////////////////
  911. if (state & REVERT)
  912. preEditor += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Nuvola_actions_undo.png/16px-Nuvola_actions_undo.png" width="16px" />&nbsp;';
  913. // TOR potentiel / AOL
  914. var isTOR = regex.compile(/172\.\d+\.\d+\.\d+/);
  915. if (isTOR.test(user))
  916. preEditor += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Dialog-warning.svg/16px-Dialog-warning.svg.png" width="16px" />&nbsp;';
  917. editor = '<a href="'+wgServer+'/wiki/User:'+encodeURIComponent(user)+'" target="_new">'+user+'</a>';
  918. var uadmin = '';
  919. if (lrcAdmin == true) {
  920. uadmin = ' • <a href="'+wgServer+'/wiki/Special:Blockip/'+encodeURI(user)+'" target="_new" style="color:seagreen">B</a>';
  921. }
  922. var uhide = '<a href="javascript:;" onClick="supprLigne(\''+pageid+'_'+revid+'\'); hideUser(\''+ user +'\');" style="color:grey">H</a>'
  923. td2.innerHTML = '<small>' + discut + ' • ' + contrib + ' • ' + uhide + uadmin + ' • </small>'
  924. + preEditor + editor;
  925. td2.className="creator-name";
  926. td2.style.border = "1px";
  927. td2.style.width = "20%";
  928. if (lstRevoc[user]) {
  929. td2.style.border = "2px solid red";
  930. td2.innerHTML += '<sup style="color:red">(' + lstRevoc[user].nb + ' révoc)</sup>'
  931. }
  932. // COMMENT //
  933. // Remplace lien [[xxx]] par <a> ;
  934. var wcomment = comment.htmlize();
  935. regex.compile(/\[\[(([^\]\|]*)(.*?))\]\]/g);
  936. wcomment = wcomment.replace(regex, "<a href='"+wgServer+wgScriptPath+"/index.php?title=$2&redirect=no' target='_new'>$1</a>");
  937. regex.compile(/\>[^\]\|<]*\|([^\]\|<]*)</g);
  938. wcomment = wcomment.replace(regex, ">$1<");
  939. td3.innerHTML = "<small>" + wcomment + "</small>";
  940. td3.style.border = "1px";
  941. td3.style.width = "40%";
  942. if (state & UPLOAD) {
  943. th0.style.backgroundColor = "#D1CAFA";
  944. th1.style.backgroundColor = "#D1CAFA";
  945. td2.style.backgroundColor = "#D1CAFA";
  946. td3.style.backgroundColor = "#D1CAFA";
  947. td4.style.backgroundColor = "#D1CAFA";
  948. tr1.style.border = "1px solid darkslateblue";
  949. }
  950. if (state & NEWUSER) {
  951. th0.style.backgroundColor = "#C6FF6D";
  952. th1.style.backgroundColor = "#C6FF6D";
  953. td2.style.backgroundColor = "#C6FF6D";
  954. td3.style.backgroundColor = "#C6FF6D";
  955. td4.style.backgroundColor = "#C6FF6D";
  956. tr1.style.border = "1px solid lime";
  957. }
  958. if (state & BLOCK) {
  959. th0.style.backgroundColor = "#EECC84";
  960. th1.style.backgroundColor = "#EECC84";
  961. td2.style.backgroundColor = "#EECC84";
  962. td3.style.backgroundColor = "#EECC84";
  963. td4.style.backgroundColor = "#EECC84";
  964. tr1.style.border = "1px solid darkgoldenrod";
  965. }
  966. if (state & DELETE) {
  967. th0.style.backgroundColor = "#E7CAA7";
  968. th1.style.backgroundColor = "#E7CAA7";
  969. td2.style.backgroundColor = "#E7CAA7";
  970. td3.style.backgroundColor = "#E7CAA7";
  971. td4.style.backgroundColor = "#E7CAA7";
  972. tr1.style.border = "1px solid saddlebrown";
  973. }
  974. if (state & MOVE) {
  975. th0.style.backgroundColor = "#FDC5FF";
  976. th1.style.backgroundColor = "#FDC5FF";
  977. td2.style.backgroundColor = "#FDC5FF";
  978. td3.style.backgroundColor = "#FDC5FF";
  979. td4.style.backgroundColor = "#FDC5FF";
  980. tr1.style.border = "1px solid magenta";
  981. }
  982. if (state & PROTECT) {
  983. th0.style.backgroundColor = "#B2BCC6";
  984. th1.style.backgroundColor = "#B2BCC6";
  985. td2.style.backgroundColor = "#B2BCC6";
  986. td3.style.backgroundColor = "#B2BCC6";
  987. td4.style.backgroundColor = "#B2BCC6";
  988. tr1.style.border = "1px solid darkslategray";
  989. }
  990. if (state & REVERT) {
  991. th0.style.backgroundColor = "#FFE4E1";
  992. th1.style.backgroundColor = "#FFE4E1";
  993. td2.style.backgroundColor = "#FFE4E1";
  994. td3.style.backgroundColor = "#FFE4E1";
  995. td4.style.backgroundColor = "#FFE4E1";
  996. tr1.style.border = "1px solid crimson";
  997. }
  998. if (state & BLANKING || newsize == 0) {
  999. th0.style.backgroundColor = "white";
  1000. th1.style.backgroundColor = "white";
  1001. td2.style.backgroundColor = "white";
  1002. td3.style.backgroundColor = "white";
  1003. td4.style.backgroundColor = "white";
  1004. tr1.style.border = "2px double crimson";
  1005. }
  1006. if (state & NEW) {
  1007. th0.style.backgroundColor = "#e2f2d2";
  1008. th1.style.backgroundColor = "#e2f2d2";
  1009. td2.style.backgroundColor = "#e2f2d2";
  1010. td3.style.backgroundColor = "#e2f2d2";
  1011. td4.style.backgroundColor = "#e2f2d2";
  1012. tr1.style.border = "1px solid green";
  1013. }
  1014. if (state & IP) {
  1015. td2.style.backgroundColor = "white";
  1016. td3.style.backgroundColor = "white";
  1017. td4.style.backgroundColor = "white";
  1018. }
  1019. if (isTOR.test(user))
  1020. td2.style.backgroundColor = "pink";
  1021. if (state & REPLACED) {
  1022. th0.style.backgroundColor = "pink";
  1023. th1.style.backgroundColor = "pink";
  1024. td2.style.backgroundColor = "pink";
  1025. td3.style.backgroundColor = "pink";
  1026. td4.style.backgroundColor = "pink";
  1027. td4.innerHTML = '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Categorie_III.svg/10px-Categorie_III.svg.png" width="10px" alt="Warning"/>';
  1028. tr1.style.border = "2px solid crimson";
  1029. }
  1030. // CONTACT LIST //
  1031. //////////////////
  1032. if (lstContact[user]) {
  1033. td2.style.border = "2px solid gold";
  1034. td2.style.backgroundColor = "yellow";
  1035. }
  1036. if (user == wgUserName) {
  1037. td2.style.border = "2px solid #A0B0E0";
  1038. td2.style.backgroundColor = "#F0F8FF";
  1039. }
  1040. // DELTA SIZE //
  1041. // delta de modif ;
  1042. ///////////////////
  1043. var txtdiff = "";
  1044. if (sizediff < 0)
  1045. txtdiff = '<sub style="color:red">'+sizediff+'</sub>';
  1046. else if (sizediff == 0)
  1047. txtdiff = '<small style="color:purple">='+sizediff+'</small>';
  1048. else
  1049. txtdiff = '<sup style="color:blue">+'+sizediff+'</sup>';
  1050. td4.innerHTML += txtdiff;
  1051. td4.style.border = "1px";
  1052. td4.style.textAlign = "right";
  1053. // ASSEMBLAGE LIGNE //
  1054. tr1.appendChild(th0);
  1055. tr1.appendChild(th1);
  1056. tr1.appendChild(td2);
  1057. tr1.appendChild(td3);
  1058. tr1.appendChild(td4);
  1059. tr1.id = pageid+"_"+revid;
  1060. var tab = document.getElementById( 'tabRC' );
  1061. var elold = document.getElementById(pageid+"_"+oldid);
  1062. if (tab.firstChild != null)
  1063. tab.insertBefore(tr1, tab.firstChild);
  1064. else
  1065. tab.appendChild(tr1);
  1066. if (elold == null) {
  1067. if (tab.childNodes.length > lrcRCLimit) {
  1068. var idt = tab.lastChild.id;
  1069. supprLigne(idt);
  1070. }
  1071. } else {
  1072. supprLigne(pageid+"_"+oldid);
  1073. }
  1074. // Don't show RC if checkbox is not checked
  1075. if ((!document.getElementById('showRC').checked) &&
  1076. (!(state & UPLOAD) &&
  1077. !(state & NEWUSER) &&
  1078. !(state & BLOCK) &&
  1079. !(state & DELETE) &&
  1080. !(state & PROTECT) &&
  1081. !(state & MOVE)))
  1082. supprLigne(pageid+"_"+revid);
  1083. // Don't show Log if checkbox is not checked
  1084. if ((!document.getElementById('showLog').checked) &&
  1085. ((state & UPLOAD) ||
  1086. (state & NEWUSER) ||
  1087. (state & BLOCK) ||
  1088. (state & DELETE) ||
  1089. (state & PROTECT) ||
  1090. (state & MOVE)))
  1091. supprLigne(pageid+"_"+revid);
  1092. // MISE A JOUR LISTES //
  1093. var spos = lstSuivi.indexOf(title);
  1094. if(spos != -1) {
  1095. th0.style.border = "2px solid gold";
  1096. th0.style.backgroundColor = "yellow";
  1097. th1.style.border = "2px solid gold";
  1098. th1.style.backgroundColor = "yellow";
  1099. lstSuiviHH[spos] = tsToHhMm(timestamp);
  1100. var tempsAr = new Array();
  1101. var len = lstSuivi.length;
  1102. for (var n = 0; n < len; n++) {
  1103. if(lstSuiviHH[n] == "--:--") continue;
  1104. var cstilde = lstSuivi[n].replace(new RegExp(/\'/g), "\\'");
  1105. var sdiff = '<a href="javascript:;" onClick="liveDiff(\''+cstilde+'\','+revid+','+oldid+');" style="color:orange">Diff</a>';
  1106. var shist = '<a href="javascript:;" onClick="liveHist(\''+cstilde+'\');" style="color:darkorange">H</a>';
  1107. var sarti = '<a href="javascript:;" onClick="liveArticle(\''+cstilde+'\');">'+lstSuivi[n]+'</a>';
  1108. var ligne='<small>' + lstSuiviHH[n] + ' • ' + sdiff + ' • ' + shist + ' • </small>' + sarti +'<br />';
  1109. tempsAr.push(ligne);
  1110. }
  1111. tempsAr.sort();
  1112. len = tempsAr.length;
  1113. var lvSuivi = document.getElementById( 'liveSuivi' );
  1114. lvSuivi.innerHTML = "";
  1115. for (var n=len-1; n >= 0; n--)
  1116. lvSuivi.innerHTML = lvSuivi.innerHTML + tempsAr[n];
  1117. }
  1118. if (lstContact[user]) {
  1119. lstContact[user].ts = timestamp;
  1120. updateFollowContact();
  1121. }
  1122. if (state & REVERT) {
  1123. regex.compile(/\[\[Special:Contributions\/([^\]\|]+)/);
  1124. match = regex.exec(comment);
  1125. if (!match) {
  1126. regex.compile(/\[\[Specjalna:Wk?ad\/([^\]\|]+)/);
  1127. match = regex.exec(comment);
  1128. }
  1129. if (match) {
  1130. var userR = match[1];
  1131. if (userR != user && userR != wgUserName) {
  1132. if (!lstRevoc[userR]) lstRevoc[userR] = { ts: 0, nb: 0 };
  1133. lstRevoc[userR].ts = timestamp;
  1134. lstRevoc[userR].nb += 1;
  1135. updateFollowRevoc();
  1136. }
  1137. }
  1138. }
  1139. }
  1140. function getRedirCat(xmlreq, data) {
  1141. if (document.getElementById('stopLive').checked) return;
  1142. var yurik = xmlreq.responseXML.getEle…

Large files files are truncated, but you can click here to view the full file