User:Nigos/scripts/EditsToVandalismPronePages.js

//This script helps show recent edits to vandalism-prone pages.

//Listing of pages var list={ vandalismpronePage:'User:Anchorvale/Pages_prone_to_vandalism', showeditsPage:'User:Anchorvale/Edits_to_pages_prone_to_vandalism', linkify:             true, updateSeconds:       30, outputSeparator:     ' ', apiAulimitUser:       500, apiAulimitSysop:      5000, backgroundWindowsMax: 10, dummy: null }; //Shown on page window.maybeStart=function { switch (mw.config.get('wgPageName')) { case EditsToVandalismPronePages.showeditsPage: EditsToVandalismPronePages.vandalismpronePage=true; }	setTimeout(marvin, 1000); }; //Data EditsToVandalismPronePages.download=function(bundle) { var x = window.XMLHttpRequest ? new XMLHttpRequest : window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : false;

if (x) { x.onreadystatechange=function { if( x.readyState==4 ) { EditsToVandalismPronePages.downloadComplete(x,bundle); }		};		x.open('GET',bundle.url,true); x.send(null); }	return x; };

EditsToVandalismPronePages.downloadComplete=function(x,bundle) { if(x.status==200){ if(bundle.onSuccess){ bundle.onSuccess(x,bundle); }	} else { if(bundle.onFailure){ bundle.onFailure(x,bundle); } else { alert(x.statusText); }	} };

if (! EditsToVandalismPronePages.outputPosition) { EditsToVandalismPronePages.outputPosition=''; } window.vandalismpronePage=false; window.showeditsPage=null;

//Paths if ( typeof(mw.config.get('wgServer'))!='string' ||		typeof(mw.config.get('wgArticlePath'))!='string' ||		typeof(mw.config.get('wgScriptPath'))!='string') { EditsToVandalismPronePages.articlePath= '//' + document.location.hostname + '/wiki/'; EditsToVandalismPronePages.scriptPath= '//' + document.location.hostname + '/w/'; } else { EditsToVandalismPronePages.articlePath=mw.config.get('wgServer')+mw.config.get('wgArticlePath').replace(/\$1/, ''); EditsToVandalismPronePages.scriptPath=mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/'; }

EditsToVandalismPronePages.vandalismpronePage=function { window.showeditsPage=true; EditsToVandalismPronePages.download({ url: EditsToVandalismPronePages.scriptPath + 'index.php?title=' +	// reload every 2 h	EditsToVandalismPronePages.showeditsPage + '&action=raw&ctype=text/css&max-age=7200',	onSuccess: EditsToVandalismPronePages.showeditsPage,	onFailure: function { setTimeout(EditsToVandalismPronePages.vandalismpronePage, 15000); return true;}}); };

window.diffCellRe=/\+<\/td>\s*]*>\s* \s*(.*?)\s*<\/div>\s*<\/td>/gi;

//Linking window.addMarvin= mw.util.addPortletLink( 'p-tb', mw.util.getUrl( showeditsPage.showeditsPage )); window.maybeStart=function { switch (mw.config.get('wgPageName')) { case EditsToVandalismPronePages.liveSpellcheckPage: EditsToVandalismPronePages.filter_spelling=true; }	setTimeout(marvin, 1000); };