Guest User

Untitled

a guest
Jun 21st, 2013
50
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  
  3. This tool hits the RSS feed for recent changes every 30 seconds or so
  4. and checks for common vandalism. It does not make a separate server request
  5. for every edit.
  6.  
  7. Currently, the RSS feed is full of holes and so this may miss many edits.
  8. http://bugzilla.wikimedia.org/show_bug.cgi?id=3942
  9.  
  10. */
  11.  
  12.  
  13. // <pre><nowiki>
  14.  
  15. recent2={
  16. // Edit these to your liking.
  17. // Make sure there's a comma at the end of each line.
  18. badwordsUrl: 'Wikipedysta:ChP94/badwords',
  19. filterPage: 'Wikipedysta:ChP94/Filter_recent_changes',
  20. allRecentPage: 'Wikipedysta:ChP94/All_recent_changes',
  21. recentIPPage: 'Wikipedysta:ChP94/Recent_IP_edits',
  22. monitorWatchlistPage: 'Wikipedysta:ChP94/Monitor_my_watchlist',
  23. spelldictUrl: 'Wikipedia:Lists_of_common_misspellings/For_machines',
  24. spelldictPage: 'Wikipedysta:ChP94/Live_spellcheck',
  25. safePages: '[Ww]ikipedia:([Ww]stęp|[Bb]rudnopis|[Tt]utorial[^/]*/sandbox)',
  26. // leave this alone
  27. dummy: null
  28. };
  29.  
  30. recent2.download=function(bundle) {
  31. // mandatory: bundle.url
  32. // optional: bundle.onSuccess (xmlhttprequest, bundle)
  33. // optional: bundle.onFailure (xmlhttprequest, bundle)
  34. // optional: bundle.otherStuff OK too, passed to onSuccess and onFailure
  35.  
  36. var x = window.XMLHttpRequest ? new XMLHttpRequest()
  37. : window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP")
  38. : false;
  39.  
  40. if (x) {
  41. x.onreadystatechange=function() {
  42. x.readyState==4 && recent2.downloadComplete(x,bundle);
  43. };
  44. x.open("GET",bundle.url,true);
  45. x.send(null);
  46. }
  47. return x;
  48. }
  49.  
  50. recent2.downloadComplete=function(x,bundle) {
  51. x.status==200 && ( bundle.onSuccess && bundle.onSuccess(x,bundle) || true )
  52. || ( bundle.onFailure && bundle.onFailure(x,bundle) || alert(x.statusText));
  53. }
  54.  
  55. window.gettingBadWords=false;
  56. window.badWords=null;
  57.  
  58. recent2.getBadWords=function() {
  59. window.gettingBadWords=true;
  60. recent2.download({ url: 'http://' + document.location.hostname +
  61. '/w/index.php?title=' + recent2.badwordsUrl + '&action=raw&ctype=text/css',
  62. onSuccess: recent2.processBadWords, onFailure: function () { setTimeout(recent2.getBadWords, 15000); return true;}});
  63. }
  64.  
  65. recent2.processBadWords=function(d) {
  66. var data=d.responseText.split('\n');
  67. var ret=[];
  68. for (var i=0; i<data.length; ++i) {
  69. var s=data[i];
  70. if (s.length==0) continue;
  71. if (RegExp('^/.*/\\s*$').test(s)) {
  72. s=s.replace(RegExp('^/'), '').replace(RegExp('/\\s*$'), '');
  73. s=s.replace(RegExp('[(]([^?])', 'g'), '(?:$1');
  74. try { var r=new RegExp(s); }
  75. catch (err) {
  76. var errDiv=newOutputDiv('recent2_error', recent2.outputPosition);
  77. errDiv.innerHTML='Warning: ignoring odd-looking regexp on line '+i
  78. +' of <a href="/wiki/' + recent2.badwordsUrl + '">badwords</a>:<pre>' + s + '</pre>';
  79. continue;
  80. }
  81. ret.push(s);
  82. continue;
  83. }
  84. if (s.charAt(0)=='<') continue;
  85. ret.push(s.replace(RegExp('([-|.()\\+:!,?*^${}\\[\\]])', 'g'), '\\$1'));
  86. }
  87. // 123 3 2| 4 415 5
  88. // ((( repeatedchar ) )| ( ... | ... | ... ))( bdy )
  89. window.badWords=RegExp("<td>[+]</td>\\s*<td .*?>\\s*.*?((([^-{}.\\s'=wI:*#0-9A-F])\\3{2,})|[^/]\\b(" + ret.join('|') + "))(\\b[^/]|[|]).*\\s*</td>", 'im');
  90. }
  91.  
  92. window.gettingWatchlist=false;
  93. recent2.watchlist=null;
  94. recent2.getWatchlist=function() {
  95. window.gettingWatchlist=true;
  96. recent2.download({url: 'http://' + document.location.hostname + '/wiki/Special:Watchlist/edit',
  97. onSuccess: recent2.processWatchlist, onFailure: function () { setTimeout(getWatchlist, 15000); return true; }});
  98. }
  99. recent2.processWatchlist=function(req, bundle) {
  100. var watchlist={};
  101. var lines=req.responseText.split('\n');
  102. for (var i=0; i<lines.length; ++i) {
  103. if (lines[i].indexOf('<li><input type="checkbox" name="id[]" value=') > -1) {
  104. var article=lines[i].replace(/.*title="(.*?)">.*/, '$1');
  105. watchlist[article]=true;
  106. }
  107. }
  108. window.watchlist=watchlist;
  109. }
  110.  
  111. window.gettingSpelldict=false;
  112. window.spelldict=null;
  113. recent2.getSpelldict=function() {
  114. window.gettingSpelldict=true;
  115. recent2.download({url: 'http://' + document.location.hostname + '/w/index.php?title=' + recent2.spelldictUrl + '&action=raw&ctype=text/css',
  116. onSuccess: recent2.processSpelldict, onFailure: function () { setTimeout(getSpelldict, 15000); return true; }});
  117. }
  118. recent2.processSpelldict=function(req, bundle) {
  119. var spelldict={};
  120. var lines=req.responseText.split('\n');
  121. var a=[];
  122. for (var i=0; i<lines.length; ++i) {
  123. var split=lines[i].split('->');
  124. if (split.length<2) { continue; }
  125. split[1]=split.slice(1).join('->').split(/, */);
  126. split[0]=split[0].toLowerCase().replace(/^\s*/, '');
  127. spelldict[split[0]]=split[1];
  128. a.push(split[0]);
  129. }
  130. window.spelldict=spelldict;
  131. window.spellRe=RegExp('<td>[+]</td>\\s*<td .*?>\\s*.*?\\b(' + a.join('|') + ')\\b', 'i');
  132. }
  133.  
  134.  
  135.  
  136. var feed='http://' + document.location.hostname + '/w/index.php?title=Special:Recentchanges&feed=rss';
  137.  
  138. window.newOutputDiv=function(klass, position, immortal) {
  139. var h1=document.getElementsByTagName('h1')[0];
  140. var ret=document.createElement('div');
  141. if (klass) { ret.className=klass; }
  142. if (!position) { position='bottom'; }
  143. switch(position) {
  144. case 'top':
  145. h1.parentNode.insertBefore(ret, h1.nextSibling);
  146. break;
  147. case 'bottom':
  148. h1.parentNode.appendChild(ret);
  149. break;
  150. default:
  151. if (!newOutputDiv.alerted) {
  152. alert('Unknown position '+position+' in recent2.js, newOutputDiv');
  153. window.newOutputDiv.alerted=true;
  154. }
  155. return newOutputDiv(klass, 'bottom');
  156. }
  157. if (!immortal) { ret.id=newOutputDiv.uid++; }
  158. window.outputDivs.push(ret);
  159. return ret;
  160. }
  161. window.newOutputDiv.alerted=false;
  162. window.newOutputDiv.uid=0;
  163. window.outputDivs=[];
  164.  
  165. window.grabRecentChanges=function(feed) {
  166. if (! window.badWords && recent2.filter_badwords ) {
  167. if ( ! window.gettingBadWords ) { recent2.getBadWords(); }
  168. return setTimeout(function(){grabRecentChanges(feed);}, 500);
  169. }
  170. if (! window.watchlist && recent2.filter_watchlist) {
  171. if (! window.gettingWatchlist ) recent2.getWatchlist();
  172. return setTimeout(function(){grabRecentChanges(feed);}, 500);
  173. }
  174. if (! window.spelldict && recent2.filter_spelling) {
  175. if (! window.gettingSpelldict) recent2.getSpelldict();
  176. return setTimeout(function(){grabRecentChanges(feed);}, 500);
  177. }
  178. var pos=recent2.outputPosition;
  179. if (recent2.outputPosition=='top') {
  180. var output=newOutputDiv('recent2.lines', pos);
  181. var status=newOutputDiv('recent2.status', pos);
  182. } else {
  183. var status=newOutputDiv('recent2.status', pos);
  184. var output=newOutputDiv('recent2.lines', pos);
  185. }
  186. status.style.borderStyle='solid';
  187. status.style.borderColor='orange';
  188. status.innerHTML=greyFont+'(' + recent2.count + ') updating...</font>';
  189.  
  190. // this abort stuff doesn't work properly for some reason...
  191. //recent2.lastFeedDownload && recent2.lastFeedDownload.abort(); // } catch (summatNasty) { /* do nothing */ }
  192. recent2.lastFeedDownload=recent2.download(
  193. {url: feed, onSuccess: processRecentChanges, output: output, status: status, onFailure: feedFailed});
  194. }
  195.  
  196. var greyFont='<font color="#777">';
  197.  
  198. window.feedFailed=function(x,bundle) {
  199. try { bundle.status.innerHTML+=greyFont+'failed: '+x.statusText + '</font>'; }
  200. catch (err) { bundle.status.innerHTML+=greyFont+'failed badly: '+err+'</font>'; }
  201. return true;
  202. }
  203.  
  204. recent2.newWindows=true;
  205.  
  206. window.linkmaker=function(url, text) {
  207. var s='<a href="' + url + '"';
  208. recent2.newWindows && (s += ' target="_blank"');
  209. s += '>' + text + '</a>';
  210. return s;
  211. }
  212.  
  213.  
  214. recent2.ipUserRegex=RegExp('(User:)?((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])');
  215. recent2.outputSeparator='<hr>';
  216.  
  217. recent2.delayedLines={};
  218. recent2.delay=0;
  219. recent2.namespaces={'Media':1, "Special":1, "User":1, "User talk":1, "Wikipedia":1,
  220. "Wikipedia talk":1, "Image":1, "Image talk":1, "MediaWiki":1,
  221. "MediaWiki talk":1, "Template":1, "Template talk":1, "Help":1,
  222. "Help talk":1, "Category":1, "Category talk":1, "Portal":1, "Portal talk":1};
  223. window.processRecentChanges=function(req, bundle){
  224. var initialId=processRecentChanges.id;
  225. var doc=req.responseXML.documentElement;
  226. var items=doc.getElementsByTagName('item');
  227. var latest=processRecentChanges.lastDate;
  228. var safePagesRe=new RegExp('^' + recent2.safePages + '$');
  229. for (var i=items.length - 1; i>=0; --i) {
  230. var timestamp = Date.parse(getFirstTagContent(items[i],'pubDate'));
  231. if (timestamp <= processRecentChanges.lastDate) continue;
  232. latest = (timestamp > latest) ? timestamp : latest;
  233. var diffText=getFirstTagContent(items[i],'description').split('</tr>').join('</tr>\n');
  234. var editSummary=diffText.replace(RegExp('^<p>(.*?)</p>[\\s\\S]*'), '$1');
  235. var editor=getFirstTagContent(items[i], 'creator') || getFirstTagContent(items[i], 'dc:creator');
  236. if (recent2.ignore_my_edits && wgUserName==editor) { continue; }
  237.  
  238. // NB article is the link attribute - a fully qualified URL
  239. var article=getFirstTagContent(items[i], 'link');
  240. if (recent2.delayedLines[article] && recent2.delayedLines[article].editor != editor) {
  241. delete recent2.delayedLines[article];
  242. }
  243.  
  244. if (recent2.filter_anonsOnly && !recent2.ipUserRegex.test(editor)) { continue; }
  245.  
  246. // articleTitle is the wgTitle thingy with spaces and all that
  247. var articleTitle=getFirstTagContent(items[i], 'title');
  248. //console.info('articleTitle=%s', articleTitle);
  249. if (recent2.ignore_safe_pages && safePagesRe.test(articleTitle)) {
  250. //console.warn('Ignoring safe page %s', article);
  251. continue;
  252. }
  253. if (recent2.hideNonArticles) {
  254. var namespace=articleTitle.replace(/:.*/, '');
  255. if (recent2.namespaces[namespace]) continue;
  256. }
  257. if (! recent2.show_talkpages && articleTitle && /^Dyskusja.*:|^[^:]*?[_ ]talk:/.test(articleTitle)) continue;
  258. if (recent2.filter_watchlist && articleTitle &&
  259. ! window.watchlist[articleTitle.replace(/^Talk:/, '').replace(/[ _]talk:/, ':')]) continue;
  260. if (recent2.filter_badwords) {
  261. var badMatch=null;
  262. if (window.vandals[editor] > 0) { badMatch=['', '', '[previously rolled back this editor]']; }
  263. else { badMatch=badWords.test(diffText); }// .test() is meant to be faster than a full match
  264. if (badMatch) {
  265. if (badMatch===true) { badMatch=diffText.match(badWords); }
  266. articleTitle=getFirstTagContent(items[i], 'title');
  267. var badWord=badMatch[2] || badMatch[4];
  268. if (articleTitle.toLowerCase().indexOf(badWord.toLowerCase())>-1) { continue; } // avoid "Oral sex matched Oral sex"
  269. // highlighting
  270. badMatch[0]=badMatch[0].split(badWord).join('<span style="background-color: #FF6">'+badWord+'</span>');
  271. recent2.delayedLines[article]={timestamp: timestamp, article:article, count:recent2.count, articleTitle:articleTitle,
  272. editor:editor, badWord:badWord, badDiffFragment:badMatch[0], diff:diffText,
  273. summary:editSummary};
  274. }
  275. } else if (recent2.filter_spelling) {
  276. var splMatch=spellRe.test(diffText);
  277. if (splMatch) {
  278. splMatch = diffText.match(spellRe);
  279. var misspelling = splMatch[1]; //.replace(/^\s*/, '');
  280. var badWord = '<a href=\'javascript:recent2.correctSpelling("' + articleTitle.split("'").join("%27") +
  281. '","'+misspelling.split("'").join("%27")+'")\'>'+ misspelling + '</a>';
  282. diffText = diffText.replace(RegExp('('+misspelling+')', 'gi'), '<span style="background-color: #FF6">$1</span>');
  283. recent2.delayedLines[article] = {timestamp: timestamp, article:article, count:recent2.count, articleTitle:articleTitle,
  284. editor:editor, badWord:badWord, badDiffFragment:'', diff:diffText, summary: editSummary};
  285. }
  286. } else {
  287. var article=getFirstTagContent(items[i], 'link');
  288. var articleTitle=getFirstTagContent(items[i], 'title');
  289. if (recent2.CustomFilter &&
  290. ! recent2.CustomFilter({timestamp:timestamp, article:article, articleTitle:articleTitle,
  291. editor:editor, diff:diffText, summary:editSummary})) continue;
  292. recent2.delayedLines[article]={timestamp: timestamp, article:article, count:recent2.count, articleTitle:articleTitle,
  293. editor:editor, diff:diffText, summary:editSummary};
  294. }
  295. } /* end for loop */
  296. var output=recent2.getDelayedLineOutput();
  297. //console.log(output);
  298. var outputString='';
  299. if (recent2.outputPosition=='top') {
  300. outputString=output.join(recent2.outputSeparator);
  301. }
  302. else {
  303. for (var i=output.length-1; i>=0; --i) {
  304. outputString+=output[i] + (i>0 ? recent2.outputSeparator : '') ;
  305. }
  306. }
  307. bundle.output.innerHTML+=outputString;
  308. if (recent2.wait_for_output) { recent2.pauseOutput(); }
  309. setTimeout(function() {recent2.doPopups(bundle.output)}, 300);
  310. processRecentChanges.lastDate=latest; // - 1; // overlap better than missing some out, i think; FIXME do this properly
  311. var statusTail=greyFont+'done up to ' + formatTime(latest) + '</font>';
  312. statusTail += ' <a href="javascript:deleteEarlierOutputDivs(' + bundle.status.id + ')">remove earlier output</a>';
  313. if (processRecentChanges.id > initialId) {
  314. statusTail+=' | <a href="javascript:showHideDetailRange(' + initialId + ',' + processRecentChanges.id + ')">toggle these details</a>';
  315. if (recent2.autoexpand) {
  316. setTimeout( function() {
  317. /* document.title=initialId+' '+processRecentChanges.id; */
  318. showHideDetailRange(initialId, processRecentChanges.id); }, 250 );
  319. }
  320. }
  321. if (recent2.wait_for_output) {
  322. statusTail += ' | <a href="javascript:recent2.unpauseOutputOnce()">show new output</a>';
  323. }
  324. statusTail+='<br>';
  325. bundle.status.innerHTML+=statusTail;
  326. }
  327. processRecentChanges.lastDate=0;
  328. processRecentChanges.id=0;
  329.  
  330. recent2.getDelayedLineOutput=function() {
  331. var ret=[];
  332. var id=processRecentChanges.id;
  333. for (var a in recent2.delayedLines) {
  334. if (recent2.delayedLines[a] && typeof recent2.delayedLines[a].count == typeof 1 &&
  335. recent2.count - recent2.delayedLines[a].count >= recent2.delay) {
  336. recent2.delayedLines[a].id=id++;
  337. var line=(recent2.doLine(recent2.delayedLines[a]));
  338. if (line) { ret.push(line); }
  339. delete recent2.delayedLines[a];
  340. }
  341. }
  342. processRecentChanges.id=id;
  343. return ret;
  344. }
  345.  
  346. window.deleteEarlierOutputDivs=function(cur) {
  347. for(var i=0; i<outputDivs.length; ++i) {
  348. if (!outputDivs[i] || !outputDivs[i].id) continue;
  349. if (outputDivs[i].id >= 0 && outputDivs[i].id < cur) {
  350. // FIXME BUG: if we go from the bottom up, then we'll delete one too many or too few, or something :-)
  351. outputDivs[i].parentNode.removeChild(outputDivs[i]);
  352. outputDivs[i]=null;
  353. }
  354. }
  355. // scroll to the top if we're appending output to the bottom, to keep the div we've clicked visible after the deletions
  356. if (recent2.outputPosition!='top') document.location='#';
  357. }
  358.  
  359. window.showHideDetailRange=function(start,end) {
  360. // use the first div to see if we should show or hide
  361. var div=document.getElementById('diff_div_' + start);
  362. if (!div) {alert('no such div: diff_div_' + start); return; }
  363. var state=false; // hide
  364. if (div.style.display=='none') state=true; // show
  365. for (var i=start; i<end; ++i) {
  366. showHideDetail(i, true, state);
  367. }
  368. }
  369.  
  370. window.toggleSysopEdits=function() {
  371. var divs=document.getElementsByTagName('div');
  372. for (var i=0; i<divs.length; ++i) {
  373. if (divs[i].className=='sysop_edit_line') divs[i].style.display= ( toggleSysopEdits.hidden ? 'none' : 'inline' );
  374. }
  375. toggleSysopEdits.hidden = ! toggleSysopEdits.hidden;
  376. }
  377.  
  378. window.bundles={};
  379.  
  380. window.vandalColour = function(vandal) {
  381. var num=window.vandals[vandal];
  382. if (!num) return '';
  383. switch (num) {
  384. case 1: return '#DDFFDD';
  385. case 2: return '#BBFFBB';
  386. }
  387. var i= 9-(num - 3) *2;
  388. if (i < 0) i=0;
  389. return '#' + i + i + 'FF' + i + i;
  390. }
  391.  
  392. window.clickDetails=function(action, max) {
  393. if(!action) action='show';
  394. if (!max) max = document.links.length;
  395. var count=0;
  396. for (var i=0; i<document.links.length && count < max; ++i) {
  397. if(document.links[i].innerHTML==action + ' details' && document.links[i].href.indexOf('javascript:') == 0) {
  398. ++count;
  399. eval(document.links[i].href.replace('javascript:', ''));
  400. }
  401. }
  402. }
  403.  
  404.  
  405. recent2.pendingLines=[];
  406.  
  407. recent2.unpauseOutputOnce=function() {
  408. //console.log('unpausing once');
  409. if (recent2.pausedOutput) {
  410. recent2.togglePausedOutput();
  411. recent2.togglePausedOutput();
  412. }
  413. }
  414.  
  415. recent2.pauseOutput=function() {
  416. //console.log('pausing');
  417. if (!recent2.pausedOutput) { recent2.togglePausedOutput(); }
  418. //console.log(recent2.pausedOutput);
  419. }
  420. recent2.unpauseOutput=function() {
  421. //console.log('unpausing');
  422. if (recent2.pausedOutput) { recent2.togglePausedOutput(); }
  423. //console.log(recent2.pausedOutput);
  424. }
  425.  
  426. recent2.togglePausedOutput=function() {
  427. if (!recent2.pausedOutput) { recent2.pausedOutput = true; return true; }
  428. else recent2.pausedOutput=false;
  429. var outputBuffer='';
  430. while (recent2.pendingLines.length) {
  431. outputBuffer+=recent2.doLine(recent2.pendingLines.pop());
  432. if (recent2.pendingLines.length) { outputBuffer+=recent2.outputSeparator; }
  433. }
  434. var pos=recent2.outputPosition;
  435. var output=newOutputDiv('recent2.lines', pos);
  436. output.innerHTML=outputBuffer;
  437. setTimeout(function() {recent2.doPopups(output)}, 300);
  438. return false;
  439. }
  440.  
  441. recent2.togglePaused=function() {
  442. if(!recent2.paused) { recent2.paused=true; return true; }
  443. recent2.paused=false;
  444. loopRecentChanges(loopRecentChanges.url, loopRecentChanges.iterations);
  445. return false;
  446. }
  447.  
  448. recent2.doLine=function(bundle) {
  449. if (recent2.pausedOutput) {
  450. recent2.pendingLines.push(bundle);
  451. return '';
  452. }
  453. //if (recent2.filter_spelling) { return recent2.doSpellLine(bundle); }
  454. var wikiBase='http://' + document.location.hostname + '/wiki/';
  455. var sysop = null;
  456. if (typeof sysops != 'undefined') sysop=sysops.test(bundle.editor);
  457. var lastDiffPage=bundle.article + '?diff=cur&oldid=prev';
  458. bundle.url=lastDiffPage;
  459. saveBundle(bundle);
  460. var div='';
  461. if (window.vandals[bundle.editor] > 0) { div='<div style="background-color:' + vandalColour(bundle.editor) + '">'}
  462. else if (sysop) {div='<div class="sysop_edit_line">'};
  463. return div +
  464. '<li>' +
  465. formatTime(bundle.timestamp) + ' ' +
  466. //latest + ' ' + processRecentChanges.lastDate + ' ' +
  467. '(' + linkmaker(lastDiffPage, 'last') + ')' +
  468. ' (' + linkmaker(bundle.article+'?action=history', 'hist') + ')' +
  469. ' (' + linkmaker(bundle.article+'?action=edit', 'edit') + ')' +
  470. ' (' + linkmaker(bundle.article+'?action=edit' +
  471. '&autoclick=wpSave&autominor=true&autoedit=s#^#{'+'{ek}'+'}\\n#&autosummaryprompt=1&autosummary=['+'[Kategoria:Ekspresowe kasowanko'+'|ek]'+']',
  472. 'ek') + ') ' +
  473. ' (' + linkmaker(bundle.article+'?action=delete', 'del') + ')' +
  474. ' ' + linkmaker(bundle.article, bundle.articleTitle) +
  475. ( bundle.badWord ? ' matched <b>' + bundle.badWord + '</b> . . ' : ' . . ') +
  476. linkmaker(wikiBase + 'User:' + bundle.editor, bundle.editor) + ' (' +
  477. linkmaker(wikiBase + 'User_talk:' + bundle.editor, 'talk') + ' | ' +
  478. linkmaker(wikiBase + 'User_talk:' + bundle.editor + '?action=edit' +
  479. '&autoclick=wpSave&autominor=true&autowatch=false&autoedit=s#$#\\n{{sub'+'st:testP}}%20~~' + '~~#&autosummary=Ostrzeżenie',
  480. 'testP') + ' | ' +
  481. linkmaker(wikiBase + 'Special:Contributions/' + bundle.editor, 'contribs') + ' | ' +
  482. linkmaker(wikiBase + 'Special:Blockip/' + bundle.editor, 'block') + ') . . ' +
  483. ( bundle.summary ? '<i>('+bundle.summary+')</i> . . ' : '') +
  484. '<a href="javascript:showHideDetail(' + bundle.id + ')" id="showdiff_link_' + bundle.id + '">show details</a>' +
  485. ' . . [<a href="javascript:tryRollback(' + bundle.id + ')" class="recent2_rollback">rollback</a>]' +
  486. '<p><div id="diff_div_' + bundle.id + '" style="display: none">' +
  487. '</div></li>' +
  488. ( div ? '</div>' : '') ;
  489. };
  490.  
  491. recent2.correctSpelling=function (article, badword) {
  492. var url= 'http://' + document.location.hostname + '/wiki/';
  493. url += article + '?action=edit&autoclick=wpDiff&autominor=true';
  494. var wl=badword.toLowerCase();
  495. var cor=spelldict[wl];
  496. if (!cor|| !cor.length) { alert('Could not find an entry for ' + wl); return; }
  497. if (cor.length > 1) {
  498. var q='Which correction should I use?\nPlease either type a number or another correction.\n';
  499. for (var i=0; i<cor.length; ++i) { q += '\n' + i + ': ' + cor[i]; }
  500. var ans=prompt(q);
  501. if (!ans) {return;}
  502. var num=parseInt(ans, 10);
  503. if (num > -1 && num < cor.length) { cor = cor[num]; }
  504. else { cor = ans; }
  505. } else {
  506. cor = cor[0];
  507. }
  508. cor=cor.replace(/^ *| *$/g, '');
  509. url += '&autosummary=Correcting%20spelling:%20' + wl + '->' + cor;
  510. url += '&autoedit=';
  511. c0=cor.charAt(0);
  512. wl0 = wl.charAt(0);
  513. b='\\b';
  514. url += ['s', b + wl + b, cor, 'g;'].join('#');
  515. wl=wl0.toUpperCase() + wl.substring(1);
  516. cor=c0.toUpperCase() + cor.substring(1);
  517. url += ['s', b + wl + b, cor, 'g;'].join('#');
  518. wl=wl.toUpperCase();
  519. cor=cor.toUpperCase();
  520. url += ['s', b + wl + b, cor, 'g;'].join('#');
  521. window.open(url);
  522. };
  523.  
  524. window.saveBundle= function(bundle) {
  525. var z={};
  526. for (var prop in bundle) { z[prop]=bundle[prop]; }
  527. window.bundles[bundle.id]=z;
  528. }
  529.  
  530. window.vandals={}
  531.  
  532. window.tryRollback=function(id) {
  533. if (recent2.non_admin_rollback) { recent2.tryNonAdminRollback(id); }
  534. else { recent2.tryAdminRollback(id); }
  535. };
  536.  
  537. recent2.getBundleVandal=function(id) {
  538. var b=window.bundles[id];
  539. if (!b) {
  540. alert('No bundle! Please tell Lupin how to reproduce this error - it should not really happen.');
  541. return null;
  542. }
  543. var vandal=b.editor;
  544. if (window.vandals[vandal]==null) { window.vandals[vandal]=1; }
  545. else { window.vandals[vandal]++; }
  546. return b;
  547. }
  548.  
  549. recent2.tryAdminRollback=function(id){
  550. var b=recent2.getBundleVandal(id);
  551. if (!b) { return; }
  552. var vandal=b.editor;
  553. var onSuccess=function (x, bundle) {
  554. var rollRe=RegExp('<a href="(/w/index.php[^"]*?action=rollback[^"]*?from=([^&]*)[^"]*?)".*?<br />(<span[^>]*>)?(.*?)(</span>)?<br />[^<>]*?</td>');
  555. // match[0]: useless
  556. // match[1]: url (escaped)
  557. // match[2]: last editor (escaped)
  558. // match[4]: last edit summary (wikiText - FIXME strip this to plain text)
  559. var match=rollRe.exec(x.responseText);
  560. if (!match) {
  561. alert('No rollback link found.' +
  562. '\nMaybe you should try the non-admin rollback by checking the checkbox above?\n' +
  563. 'Alternatively, this may be a bug.');
  564. return;
  565. }
  566. var lastEditor=match[2].split('+').join(' ');
  567. var lastSummary=match[4];
  568. // var vandal=b.editor; // from the closure
  569. if (lastEditor != vandal) {
  570. var summary=lastSummary.replace(RegExp('<[^>]*?>','g'),'');
  571. if (!summary) summary=lastSummary;
  572. alert( 'Could not rollback - someone else has edited since the vandal.\n\nPage: '+ b.articleTitle +
  573. '\nVandal: '+vandal+'\nLast editor: '+lastEditor+'\nEdit summary: '+summary);
  574. return;
  575. }
  576. var rollbackUrl=match[1].split('&amp;').join('&');
  577. // confirm('Rollback edits by '+vandal + ' to '+b.articleTitle+'?') &&
  578. window.open(rollbackUrl, '_blank');
  579. }
  580. var onFailure = function(x,bundle) {
  581. alert('HTTP failed when trying to get rollback link in url\n' + bundle.url +
  582. '\n\nHTTP status text: ' + x.statusText);
  583. return true;
  584. }
  585. recent2.download({ url:b.url, onSuccess: onSuccess, id: b.id, onFailure:onFailure});
  586. };
  587.  
  588. recent2.tryNonAdminRollback=function(id) {
  589. if (!autoEdit) { alert('You need to have autoedit functionality for non-admin rollback.\n\n' +
  590. 'This is included in Navigation popups - see [[WP:POP]].\n\n'+
  591. 'Alternatively, you can try adding '+
  592. '{{sub'+'st:js|User:Lupin/autoedit.js}} ' +
  593. 'to your user javascript file.'); return; }
  594. var b=recent2.getBundleVandal(id);
  595. if (!b) { return; }
  596. var vandal=b.editor;
  597. var url='http://' + document.location.hostname + '/w/query.php?format=json&titles=' + b.articleTitle;
  598. url += '&what=revisions&rvlimit=100&rvcomments';
  599. var onSuccess=function(x,y){ recent2.processHistoryQuery(x,y,b); }
  600. recent2.download({ url: url, onSuccess: onSuccess, id: b.id}); // fixme: onFailure
  601. };
  602.  
  603. recent2.processHistoryQuery=function(x,downloadBundle, bundle) {
  604. var json=x.responseText;
  605. try {
  606. eval('var o='+json);
  607. var p=o['pages'];
  608. var edits=recent2.anyChild(p)['revisions'];
  609. }
  610. catch ( someError ) { alert('JSON business failed.\n\n' + json.substring(0,100)
  611. + '\n\nCannot rollback.'); return; }
  612. var i;
  613. for (i=0; i<edits.length; ++i) {
  614. if (edits[i]['user']!=bundle.editor) { break; }
  615. }
  616. if (i===0) {
  617. alert( 'Could not rollback - someone else has edited since the vandal.\n\nPage: '+ bundle.articleTitle +
  618. '\nVandal: '+bundle.editor+'\nLast editor: '+edits[0]['user']+'\nEdit summary: '+edits[0]['comment']);
  619. return;
  620. }
  621. if (i==edits.length) { alert(bundle.editor + ' seems to be the only editor to ' + bundle.articleTitle +
  622. '.\n\nRollback aborted.'); return; }
  623. var prevEditor=edits[i]['user'];
  624. var prevRev=edits[i]['revid'];
  625. var summary='Przywrócono poprzednią wersję autorstwa [[Special:Contributions/' + escape(prevEditor) + '|' +
  626. escape(prevEditor) + ']]. Autor wycofanej edycji to ' + escape(bundle.editor);
  627. summary=summary.split(' ').join('%20');
  628. var url=bundle.article + '?action=edit&autosummary=' + summary + '&oldid=' + prevRev +
  629. '&autoclick=wpSave&autominor=true';
  630. window.open(url, '_blank');
  631. };
  632. //recent2.non_admin_rollback=true;
  633.  
  634. recent2.anyChild=function(obj) {
  635. for (var p in obj) {
  636. return obj[p];
  637. }
  638. return null;
  639. }
  640.  
  641.  
  642. recent2.doPopups=function(div) {
  643. if (typeof(window.setupTooltips)!='undefined') { setupTooltips(div); }
  644. }
  645.  
  646. window.formatTime=function(timestamp) {
  647. var date=new Date(timestamp);
  648. nums=[date.getHours(), date.getMinutes(), date.getSeconds()];
  649. for (var i=0; i<nums.length; ++i) if (nums[i]<10) nums[i]='0'+nums[i];
  650. return nums.join(':');
  651. }
  652.  
  653. window.showHideDetail = function(id, force, state) {
  654. var div=document.getElementById('diff_div_' + id);
  655. var lk=document.getElementById('showdiff_link_' + id);
  656. if (!div) return;
  657. var bundle=window.bundles[id];
  658. if (!div.innerHTML) div.innerHTML= ( bundle.badDiffFragment ? bundle.badDiffFragment:'') + bundle.diff;
  659. if ((force && state==true) || (!force && div.style.display=='none')) { div.style.display='inline'; lk.innerHTML='hide details'; }
  660. else { div.style.display='none'; lk.innerHTML='show details'; }
  661.  
  662. }
  663.  
  664.  
  665. window.getFirstTagContent=function(parent, tag) {
  666. var e=parent.getElementsByTagName(tag);
  667. if (e && (e=e[0]) ) {
  668. var ret = e.firstChild.nodeValue || e.nodeValue;
  669. if (typeof ret != typeof '') return '';
  670. return ret;
  671. }
  672. }
  673.  
  674. recent2.newCheckbox=function(label, state, action, internalName) {
  675. // checkbox
  676. var ret=document.createElement('input');
  677. ret.type='checkbox';
  678. ret.checked = state;
  679. ret.onclick = function() { recent2.setBoxCookies(); this.setVariables(); };
  680. ret.setVariables = action;
  681. recent2.controls.appendChild(ret);
  682. if (internalName) { recent2.controls[internalName]=ret; }
  683. // label
  684. var l=document.createElement('label');
  685. l.innerHTML=label;
  686. l.onclick=function(){ ret.click(); }
  687. recent2.controls.appendChild(l);
  688. recent2.checkboxes.push(ret);
  689. return ret;
  690. };
  691.  
  692. recent2.checkboxes=[];
  693.  
  694. recent2.setBoxCookies=function() {
  695. var n=1;
  696. var val=0;
  697. for (var i=0; i<recent2.checkboxes.length; ++i) {
  698. val += n * (recent2.checkboxes[i].checked ? 1 : 0);
  699. n = n << 1;
  700. }
  701. document.cookie = 'recent2_checkboxes='+val+"; expires=Tue, 31-Dec-2030 23:59:59 GMT; path=/";
  702. };
  703.  
  704. recent2.setCheckboxValuesFromCookie=function() {
  705. var val=recent2.readCookie('recent2_checkboxes');
  706. if (!val) { return; }
  707. val=parseInt(val, 10);
  708. for (var i=0; i<recent2.checkboxes.length; ++i) {
  709. if ( recent2.checkboxes[i].checked != (val & 1) ) {
  710. recent2.checkboxes[i].checked= (val & 1);
  711. recent2.checkboxes[i].setVariables();
  712. }
  713. val = val >> 1;
  714. }
  715. };
  716.  
  717. recent2.readCookie=function(name) {
  718. var nameEQ = name + "=";
  719. var ca = document.cookie.split(';');
  720. for(var i=0;i < ca.length;i++) {
  721. var c = ca[i];
  722. while (c.charAt(0)==' ') { c = c.substring(1,c.length); }
  723. if (c.indexOf(nameEQ) === 0) { return c.substring(nameEQ.length,c.length); }
  724. }
  725. return null;
  726. };
  727.  
  728.  
  729. recent2.controlUI=function() {
  730. recent2.controls=newOutputDiv('recent2.controls', 'top', true);
  731. recent2.controls.newline = function(){ recent2.controls.appendChild(document.createElement('br')); };
  732. var line=function(a,b,c,d){ recent2.newCheckbox(a,b,c,d); recent2.controls.newline(); }
  733.  
  734. line('Ignore talk pages', !recent2.show_talkpages,
  735. function() { recent2.show_talkpages=!this.checked; }, 'talk');
  736. line('Ignore pages outside the article namespace', false,
  737. function() { recent2.hideNonArticles = this.checked; }, 'hidenonarticles');
  738. line('Automatically expand new content', recent2.autoexpand,
  739. function() { recent2.autoexpand = this.checked; }, 'autoexpand');
  740. line('Only show edits unchanged after four updates', false,
  741. function() { recent2.delay = (this.checked) ? 4 : 0; }, 'delayby4');
  742. line('Use non-admin rollback', false,
  743. function() { recent2.non_admin_rollback = this.checked; }, 'nonadminrollback');
  744. line('Ignore my edits', false,
  745. function() { recent2.ignore_my_edits = this.checked; }, 'ignoremyedits');
  746. line('Ignore safe pages', false,
  747. function() { recent2.ignore_safe_pages = this.checked; }, 'ignoresafepages');
  748. // line('Only show output when I ask for it', false,
  749. // function() {
  750. // recent2.wait_for_output = this.checked;
  751. // if (this.checked) { recent2.pauseOutput(); }
  752. // else {recent2.unpauseOutput(); }
  753. // }, 'waitforoutput');
  754. var b=document.createElement('input');
  755. b.type='button';
  756. b.value='pause updates';
  757. b.onclick=function(){
  758. b.value=(recent2.paused)?'pause updates':'resume updates';
  759. recent2.togglePaused();
  760. }
  761. recent2.controls.appendChild(b);
  762. recent2.setCheckboxValuesFromCookie();
  763. }
  764.  
  765. recent2.count=0;
  766. window.loopRecentChanges=function(url, iterations) {
  767. if (!iterations) iterations=20;
  768. loopRecentChanges.iterations=iterations;
  769. loopRecentChanges.url=url;
  770. grabRecentChanges(url);
  771. setTimeout(function () {
  772. if (recent2.paused) {++recent2.count; return; }
  773. if (++recent2.count >= iterations && ! confirm('Continue monitoring recent changes?') ) return;
  774. recent2.count %= iterations; loopRecentChanges(url, iterations);
  775. }, 10000);
  776. }
  777. window.marvin=function() {
  778. // this isn't really used (not accessible from the UI), so don't worry about it
  779. window.sysops=RegExp("^(\\-\\- April|23skidoo|A Man In Black|ABCD|ALoan|Academic Challenger|Acetic Acid|Adam Bishop|Ahoerstemeier|Alabamaboy|Alai|AlainV|Alex S|Alex756|AlistairMcMillan|Alkivar|Allen3|AllyUnion|Alteripse|Ambi|Ams80|Andres|Andrevan|Andrew Yong|Andrewa|Andris|Android79|Angela|Angr|Antandrus|Anthere|AntonioMartin|Aranel|Arcadian|Aris Katsaris|Arminius|Arvindn|Arwel Parry|Asbestos|AstroNomer|Ausir|AxelBoldt|BanyanTree|BaronLarf|Bcorr|Bdesham|Bearcat|Beland|Benc|Bhadani|Biekko|BillyH|Bishonen|Bkonrad|Blankfaze|Bluemoose|Bmicomp|Bovlb|Bratsche|Brian Kendig|Brian0918|BrianSmithson|Briangotts|Brighterorange|Brion VIBBER|Brockert|BrokenSegue|Brookie|Bryan Derksen|Bumm13|Burgundavia|CJCurrie|COGDEN|CSTAR|CYD|Cacycle|Caltrop|CambridgeBayWeather|Camembert|Canderson7|Capitalistroadster|Carbonite|Carnildo|Catbar|CatherineMunro|Cburnett|Cdc|Cecropia|Cedar\\-Guardian|Celestianpower|CesarB|Cgs|Chadloder|Chancemill|Changlc|Charles Matthews|Chmod007|Chris 73|Chris Roy|ChrisO|Christopher Mahan|Chuck SMITH|Chuq|Cimon avaro|Clarkk|Clifford Adams|ClockworkSoul|Commander Keane|ContiE|Cool Hand Luke|Cprompt|Craigy144|Cryptic|CryptoDerk|Curps|Cutler|Cyan|Cyberjunkie|CyborgTosser|Cyp|Cyrius|DESiegel|DF08|DJ Clayworth|Dale Arnett|Dan100|DanKeshet|Daniel Quinlan|DanielCD|Danny|Dante Alighieri|Darwinek|Dave souza|David Gerard|David Newton|David\\.Monniaux|DavidLevinson|DavidWBrooks|Davidcannon|Davodd|Dbachmann|Dbenbenn|Dbiv|Dcoetzee|Deb|Decumanus|Delirium|Denelson83|Denni|Derek Ross|Dgrant|Diberri|Dieter Simon|Dino|Dmcdevit|Dmn|Doc glasgow|Docu|Dori|Dpbsmith|DrBob|DragonflySixtyseven|Dragons flight|Drini|DropDeadGorgias|Duk|Duncharris|Durin|Dvyost|Dwheeler|Dysprosia|Earl Andrew|Ed Poor|Ed g2s|Edcolins|Edward|Efghij|Egil|El C|Elf|Ellsworth|Eloquence|Enchanter|Essjay|Eugene van der Pijll|Evercat|Everyking|Evil Monkey|Evil saltine|Evilphoenix|Exploding Boy|Ezhiki|FCYTravis|Fabiform|Fantasy|Fastfission|Fawcett5|Feco|FeloniousMonk|Fennec|Ferkelparade|Fernando Rizo|Ffirehorse|Filiocht|Finlay McWalter|Fire Star|FireFox|Flcelloguy|Flockmeal|Francs2000|Frazzydee|Fred Bauder|Fredrik|Freestylefrappe|FreplySpang|Friday|Func|Furrykef|Fuzheado|Fvw|G\\-Man|Gabbe|Gadfium|Gamaliel|Garzo|Gaz|Gdr|GeneralPatton|Geni|Gentgeen|Geogre|Gerald Farinas|Goatasaur|Golbez|Graft|GregAsche|GregRobson|Grenavitar|Grm wnr|Ground Zero|Grue|Grunt|Grutness|Gtrmp|Guettarda|Gwalla|Gyrofrog|Hadal|Hajor|Hall Monitor|HappyCamper|Hashar|Hawstom|Hcheney|Hedley|Hemanshu|Henrygb|Hephaestos|Hermione1980|Heron|Homeontherange|Humblefool|Hyacinth|Icairns|IceKarma|Ihcoyc|Ike9898|Ilyanep|Improv|Imran|Infrogmation|Ingoolemo|Inter|Isomorphic|Ixfd64|J\\.J\\.|JCarriker|JHK|JIP|JRM|JYolkowski|Jake Nelson|Jallan|JamesTeterenko|Jamesday|Jasonr|Jaxl|Jay|Jayjg|Jcw69|Jdavidb|Jdforrester|JeLuF|Jeffrey O\\. Gustafson|Jengod|JeremyA|Jeronimo|Jerzy|JesseW|Jfdwolff|Jiang|Jimbo Wales|Jimfbleak|Jimregan|Jinian|Jitse Niesen|Jmabel|Jnc|Jni|JoJan|John Kenney|JohnOwens|Johnleemk|Johntex|JonMoore|Jondel|Joolz|Josh Grosse|Jossifresco|Journalist|Joy|Joy Stovall|Jpgordon|Jrdioko|Jredmond|Jtdirl|Jtkiefer|Justinc|Jwrosenzweig|K1Bond007|KF|Kaihsu|Kaldari|Karada|Karen Johnson|Karmafist|Katefan0|Kbdank71|Kelly Martin|Khaosworks|Khendon|Khym Chanur|Kingturtle|Kirill Lokshin|Kmccoy|Knowledge Seeker|Kosebamse|Ktsquare|Kwamikagami|Kzollman|LC|Lachatdelarue|Lacrimosus|Lectonar|Lee Daniel Crocker|Lexor|Linuxbeak|LittleDan|Llywrch|Lommer|Longhair|Lord Emsworth|LordAmeth|LouI|Lowellian|Lucky 6\\.9|Ludraman|Lupin|Lupo|MC MasterChef|MacGyverMagic|Mackensen|Mackeriv|Madchester|Magnus Manske|Mailer diablo|Mairi|Malcolm Farmer|Manning Bartlett|Marianocecowski|Marine 69\\-71|Mark|Mark Christensen|Mark Dingemanse|Mark Richards|MarkSweep|Markalexander100|Marshman|Marudubshinki|Marumari|Master Thief Garrett|Matt Crypto|Maury Markowitz|Maveric149|Maximus Rex|Mbecker|Meelar|Mel Etitis|Menchi|Merovingian|Merphant|Mic|Michael Hardy|Michael Snow|Mike Halterman|Mikkalai|Mindspillage|Minesweeper|Mintguy|Mirv|Mirwin|Mkmcconn|Mkweise|Modemac|Moink|Moncrief|Montrealais|Moriori|Morven|Morwen|Mulad|Mustafaa|MyRedDice|MykReeve|Mysekurity|Mzajac|Nabla|Nandesuka|Nanobug|Necrothesp|Neutrality|Ngb|Nichalp|NicholasTurnbull|Nickptar|Nickshanks|Niteowlneils|Nohat|Noldoaran|Notheruser|Nufy8|Nunh\\-huh|Nv8200p|Oberiko|OldakQuill|Oleg Alexandrov|Oliver Pereira|Olivier|Omegatron|Optim|Ortolan88|Oven Fresh|OwenX|PFHLai|PMA|PRueda29|PZFUN|Pakaran|Pamri|Patrick|Paul A|Paul August|Pcb21|PedanticallySpeaking|Petaholmes|Peter Winnberg|Pfortuny|Pharos|Phil Bordelon|Phil Boswell|Phils|Philwelch|Phroziac|Physchim62|PierreAbbat|Piotrus|Pjacobi|Pollinator|Poor Yorick|Postdlf|Pratyeka|Premeditated Chaos|Proteus|Psy guy|Qaz|Quadell|Quercusrobur|R\\. fiend|R3m0t|RHaworth|RJFJR|RN|Radiant\\!|RadicalBender|Ragib|Ral315|Ram\\-Man|Rama|Ramallite|Ran|Raul654|Rbrwr|Rd232|Rdsmith4|RedWolf|RedWordSmith|Redux|Redwolf24|Refdoc|Reflex Reaction|Rfl|Rhobite|Rholton|Rhymeless|Rich Farmbrough|Rick Block|RickK|Rje|Rlandmann|Rlquall|Rmhermen|Roadrunner|RobLa|Robchurch|Robert Merkel|RobertG|Robin Patterson|RobyWayne|Roozbeh|RoseParks|Rossami|RoyBoy|RoySmith|Rx StrangeLove|Ryan Delaney|SD6\\-Agent|SWAdair|Salsa Shark|Sam Hocevar|Sam Korn|Sango123|Sannse|Sarge Baldy|Sasquatch|Schissel|Schneelocke|Scimitar|Scipius|Scott Burley|ScottDavis|Seabhcan|Sebastiankessel|Secretlondon|Seglea|Sesel|Seth Ilys|Sfoskett|Shanes|Shauri|Sheldon Rampton|Shimgray|SimonP|Siroxo|Sj|Sjakkalle|Sjc|Slambo|SlimVirgin|Slowking Man|Slrubenstein|Smith03|Sn0wflake|Snowspinner|Snoyes|Solipsist|Someone else|Sortior|Spangineer|Spencer195|Splash|Ssd|Stan Shebs|Starblind|Stevenj|Stevertigo|Stewartadcock|Stormie|Sugarfish|Sundar|Sverdrup|TPK|TUF\\-KAT|Ta bu shi da yu|Talrias|Tannin|Tarquin|Taw|Taxman|TenOfAllTrades|Texture|Thames|The Anome|The Cunctator|The Epopt|The Singing Badger|The wub|TheCoffee|TheoClarke|Theresa knott|Thryduulf|Thue|Thunderbrand|Tillwe|Tim Ivorson|Tim Starling|Timc|Timrollpickering|Timshell|Timwi|Titoxd|Tkinias|Toby Bartels|Tom\\-|Tomf688|Tompagenet|Tony Sidaway|Topbanana|Tregoweth|Trevor macinnis|Triddle|Trilobite|Tristanb|Ugen64|Ulayiti|Uncle G|UninvitedCompany|Urhixidur|Utcursch|UtherSRG|Vague Rant|VampWillow|Vancouverguy|Vaoverland|Viajero|Vicki Rosenzweig|Violetriga|Visorstuff|Voice of All\\(MTG\\)|Vsmith|Waltpohl|Wapcaplet|Warofdreams|Wayward|Wernher|Wesley|WhisperToMe|Who|Wiglaf|Wikiacc|Wikibofh|Wile E\\. Heresiarch|Wilfried Derksen|Willmcw|Woggly|WojPob|Woohookitty|Worldtraveller|Ww|Wwoods|XJamRastafire|Xezbeth|Y0u|Yacht|Zanimum|Zero0000|Zippy|Zocky|Zoe|Zoicon5|Zoney|Zscout370|Zzyzx11)$");
  780. recent2.show_talkpages=true;
  781. recent2.controlUI();
  782. loopRecentChanges(feed, 200);
  783. }
  784.  
  785. // **************************************************
  786. // Installation
  787. // **************************************************
  788.  
  789. recent2.addlilink=function(tabs, url, name, id, title, key){
  790. var na = document.createElement('a');
  791. na.href = url;
  792. na.appendChild(document.createTextNode(name));
  793. var li = document.createElement('li');
  794. if(id) li.id = id;
  795. li.appendChild(na);
  796. tabs.appendChild(li);
  797. if(id) {
  798. if(key && title) ta[id] = [key, title];
  799. else if(key) ta[id] = [key, ''];
  800. else if(title) ta[id] = ['', title];
  801. }
  802. // re-render the title and accesskeys from existing code in wikibits.js
  803. akeytt();
  804. Uncaught ReferenceError: akeytt is not defined
  805. return li;
  806. }
  807.  
  808. recent2.addToolboxLink=function(url, name, id){
  809. var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
  810. recent2.addlilink(tb, url, name, id);
  811. }
  812.  
  813. window.addMarvin=function() {
  814. var prefix = 'http://' + document.location.hostname + '/wiki/';
  815. recent2.addToolboxLink(prefix + recent2.filterPage, 'Filter recent changes', 'toolbox_filter_changes');
  816. recent2.addToolboxLink(prefix + recent2.allRecentPage, 'All recent changes', 'toolbox_all_changes');
  817. recent2.addToolboxLink(prefix + recent2.recentIPPage, 'Recent IP edits', 'toolbox_IP_edits');
  818. recent2.addToolboxLink(prefix + recent2.monitorWatchlistPage, 'Monitor my watchlist', 'toolbox_watchlist_edits');
  819. recent2.addToolboxLink(prefix + recent2.spelldictPage, 'Live spellcheck', 'toolbox_spelling');
  820. //document.getElementById('toolbox_filter_changes').onclick=marvin;
  821. }
  822.  
  823. recent2.testPage = function (str) {
  824. return RegExp(str.split(/[_ ]/).join('[_ ]'), 'i').test(document.location.href);
  825. };
  826.  
  827. window.maybeStart=function() {
  828. var loc=document.location.href;
  829. if (recent2.testPage(recent2.filterPage)) {
  830. recent2.filter_badwords=true;
  831. } else if (recent2.testPage(recent2.allRecentPage)) {
  832. recent2.filter_badwords=false;
  833. } else if (recent2.testPage(recent2.recentIPPage)) {
  834. recent2.filter_anonsOnly=true;
  835. } else if (recent2.testPage(recent2.monitorWatchlistPage)) {
  836. recent2.filter_watchlist=true;
  837. } else if (recent2.testPage(recent2.spelldictPage)) {
  838. recent2.filter_spelling=true;
  839. } else {
  840. return;
  841. }
  842. setTimeout(marvin, 1000);
  843. }
  844.  
  845. // onload
  846. addOnloadHook(maybeStart);
  847. addOnloadHook(addMarvin);
  848.  
  849. //// testing code
  850. //recent2.filter_badwords=true;
  851. //recent2.filter_spelling=true;
  852. //setTimeout(marvin,1000);
  853.  
  854.  
  855. // </nowiki></pre>
RAW Paste Data