MediaWiki:Gadget-SpecialNukeOnContribsLink.js

From RimWorld Wiki
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
// This script provides a link called "mass deletion" at Special:Contributions that links to Special:Nuke

// Add a link to Special:Nuke/USERNAME at Special:Contributions
// Written by Grunny, modified by SVG
if( wgCanonicalSpecialPageName === 'Contributions' ) {
	$( contribLinks );
}

function contribLinks() {
	var	ug = wgUserGroups.join(' '),
		ctype,
		targ = $( 'input[name="target"]' ).val();
	// poorman contribs type finder. -1 = existing user
	try { 
		ctype = $( '#contentSub > a:first' ).attr( 'href' ).indexOf( 'User_talk' );
	} catch(e) {
		ctype = -1;
	}
	if( !targ ) {
		return;
	}
	insertContentSubContribLink( '/wiki/Special:Nuke?target=' + targ.replace( ' ', '+' ) + '&limit=15', 'mass deletion' );
}

//jQuery version of Splarka's insertContentSubContribLink, by Grunny
function insertContentSubContribLink( link, text ) {
	$( '#contentSub > a:last' ).after( ' | <a href="' + link + '" title="' + link + '">' + text + '</a>' );
}