User:Nigos/scripts/RandomRootpage.js

This is an old revision of this page, as edited by Nigos (talk | contribs) at 05:45, 15 February 2018 (Adding info). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
mw.messages.set( {
	'avt-all-rc': 'All recent changes',
	'avt-auto-click': 'The "$1" button has been automatically clicked. ' +
		'Please wait for the next page to load.',
	'avt-auto-click-button-missing': 'Anti-Vandal Tool\n\nautoclick: could not find button "$1".',
	'avt-block': 'block',
	'avt-continue-question': 'Continue monitoring recent changes?',
	'avt-contribs': 'contribs',
	'avt-done': 'done up to $1',
	'avt-entry-not-found': 'Could not find an entry for $1.',
	'avt-error-HTTP-rollback': 'HTTP failed when trying to get rollback link in url\n$1' +
		'\n\nHTTP status text: $2',
	'avt-error-JSON': 'JSON business failed.\n\n$1\n\nCannot rollback.',
	'avt-error-no-bundle': 'No bundle! Please tell Lupin how to reproduce this error - it should not really happen.',
	'avt-error-no-rollback-link': 'No rollback link found.\n' +
		'Maybe you should try the non-admin rollback by checking the checkbox above?\n' +
		'Alternatively, this may be a bug.',
	'avt-error-sysop-list': 'Could not process admin list.\n\n"$1"',
	'avt-error-unable-to-rollback': 'Could not rollback - someone else has edited since the vandal.\n\n' +
		'Page: $1\nVandal: $2\nLast editor: $3\nEdit summary: $4',
	'avt-except-templates': '... except for the Template namespace',
	'avt-expand-content': 'Automatically expand new content',
	'avt-failed': 'failed: $1',
	'avt-failed-badly': 'failed badly: $1',
	'avt-filter-rc': 'Filter recent changes',
	'avt-hide': 'Hide',
	'avt-hist': 'hist',
	'avt-ignore-my-edits': 'Ignore my edits',
	'avt-ignore-outside-main': 'Ignore pages outside the article namespace',
	'avt-ignore-safe-pages': 'Ignore safe pages',
	'avt-ignore-sysop-edits': 'Hide admin edits',
	'avt-ignore-talk-pages': 'Ignore talk pages',
	'avt-ip-rc': 'Recent IP edits',
	'avt-last': 'last',
	'avt-matched': ' matched <b>$1</b>',
	'avt-missing-div': 'no such div: diff_div_$1',
	'avt-non-admin-rollback': 'Use non-admin rollback',
	'avt-only-unchanged': 'Only show edits unchanged after four updates',
	'avt-pause': 'Pause updates',
	'avt-remove-output': 'remove earlier output',
	'avt-resume': 'Resume updates',
	'avt-reverted-edits': 'Reverted edits by [[Special:Contributions/$1|$1]] ([[User talk:$1|talk]]) to last version by $2',
	'avt-rollback': 'rollback',
	'avt-rollback-aborted': '$1 seems to be the only editor to $2.\n\nRollback aborted.',
	'avt-rolled-back': '[Previously rolled back this editor] $1',
	'avt-select-correction': 'Which correction should I use?\nPlease either type a number or another correction.\n',
	'avt-show': 'Show',
	'avt-show-new': 'show new output',
	'avt-spelling-rc': 'Live spellcheck',
	'avt-talk': 'talk',
	'avt-toggle-details': 'toggle these details',
	'avt-unknown-position': 'Unknown position $1 in recent2.js, newOutputDiv.',
	'avt-updating': '($1) updating...',
	'avt-uw-test': 'uw-test',
	'avt-uw-vand': 'uw-vand',
	'avt-warning-regex': 'Warning: ignoring odd-looking regexp on line $1 ' +
		'of [[$2|badwords]]:'
		// FIXME: Remove this hack once [[bugzilla:47395]] is fixed
		.replace( /\$2/g, 'User:Lupin/badwords' ),
	'avt-watched-rc': 'Monitor my watchlist'
} );
var nonconfirmededits={
	// Edit these to your liking.
	// Make sure there's a comma at the end of each line.
	recentnoncomfirmedPage:         'User:Anchorvale/Recent_Non_Confirmed_Edits',
	linkify:              true,
	updateSeconds:        20,
	// FIXME: Use <ul> and add a border to each <li>'s
	outputSeparator:      '<hr>',
	apiAulimitUser:        500,
	apiAulimitSysop:       5000,
	backgroundWindowsMax:  10,
	// leave this last one alone
	dummy: null
};
window.addMarvin=function() {
	mw.util.addPortletLink( 'p-tb', mw.util.getUrl( nonconfirmededits.recentnonconfirmedPage ),
		mw.msg( 'avt-ip-rc' ), 'toolbox_Non_confirmed_edits');
};

window.maybeStart=function() {
	switch (mw.config.get('wgPageName')) {
	case nonconfirmededits.recentIPPage:
		nonconfirmededits.filter_anonsOnly=true;
		return;
	}
	setTimeout(marvin, 1000);
	window.processRecentChangesSingle=function(){
	NonConfirmedEdits.itemsCurrent--;
	var i = NonConfirmedEdits.itemsCurrent;
	var items = NonConfirmedEdits.items;
	if (i < 0) { processRecentChangesDisplay(NonConfirmedEdits.bundleRef); return; }

	var timestamp = Date.parse(getFirstTagContent(items[i],'pubDate'));
	if (timestamp <= processRecentChanges.lastDate) { nextChangeSoon(true); return; }
	NonConfirmedEdits.latest = (timestamp > NonConfirmedEdits.latest) ? timestamp : NonConfirmedEdits.latest;

	var diffText=getFirstTagContent(items[i],'description').split('</tr>').join('</tr>\n');
	var editSummary=diffText.replace( /^<p>(.*?)<\/p>[\s\S]*/, '$1');
	var editor=getFirstTagContent(items[i], 'creator') || getFirstTagContent(items[i], 'dc:creator');

	if (NonConfirmedEdits.ignore_my_edits && mw.config.get('wgUserName')==editor) { return; }

	var article;
	var articleTitle;
	// NB article is the link attribute - a fully qualified URL
	// strip out the &diff=...&oldid=...  bit to leave only ?title=...
	article=getFirstTagContent(items[i], 'link').split('&')[0];
	if (NonConfirmedEdits.delayedLines[article] && NonConfirmedEdits.delayedLines[article].editor != editor) {
		delete NonConfirmedEdits.delayedLines[article];
	}

	if (NonConfirmedEdits.filter_anonsOnly && !mw.util.isRegistered(editor)) {
		nextChangeSoon(true);
		return;
	}
};
window.processRecentChangesSingle=function(){
	NonConfirmedEdits.itemsCurrent--;
	var i = NonConfirmedEdits.itemsCurrent;
	var items = NonConfirmedEdits.items;
	if (i < 0) { processRecentChangesDisplay(NonConfirmedEdits.bundleRef); return; }

	var timestamp = Date.parse(getFirstTagContent(items[i],'pubDate'));
	if (timestamp <= processRecentChanges.lastDate) { nextChangeSoon(true); return; }
	NonConfirmedEdits.latest = (timestamp > NonConfirmedEdits.latest) ? timestamp : NonConfirmedEdits.latest;

	var diffText=getFirstTagContent(items[i],'description').split('</tr>').join('</tr>\n');
	var editSummary=diffText.replace( /^<p>(.*?)<\/p>[\s\S]*/, '$1');
	var editor=getFirstTagContent(items[i], 'creator') || getFirstTagContent(items[i], 'dc:creator');

	if (NonConfirmedEdits.ignore_my_edits && mw.config.get('wgUserName')==editor) { return; }

	var article;
	var articleTitle;
	// NB article is the link attribute - a fully qualified URL
	// strip out the &diff=...&oldid=...  bit to leave only ?title=...
	article=getFirstTagContent(items[i], 'link').split('&')[0];
	if (NonConfirmedEdits.delayedLines[article] && NonConfirmedEdits.delayedLines[article].editor != editor) {
		delete NonConfirmedEdits.delayedLines[article];
	}

	if (NonConfirmedEdits.filter_anonsOnly && !mw.util.isIPAddress(editor)) {
		nextChangeSoon(true);
		return;
	}
};
};
/* [[Category:Wikipedia scripts]]
*/