Jump to content

User:Robertsky/Random scripts

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Robertsky (talk | contribs) at 00:28, 4 January 2023. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Semi-manual mass move

For stuff like Talk:Meloni_government#Requested_move_19_November_2022 where the rmCloser script fails.

This appends a move link to each line item, if the new title is a red link. Ctrl + click to open in background tab.

Does not deal with new titles that are already existing links. Best to check manually if it is a redirect or an actual content first.

jQuery('#mw-content-text > div.mw-parser-output > div.boilerplate > ul:nth-child(4) li').each(function() { //adjust selector accordingly
	var oldTitle = jQuery(this).children('a').eq(0).text().replaceAll(' ', '_');
	var newTitle = jQuery(this).children('a.new, span.plainlinks').text();

	var moveReason = encodeURIComponent('Per RM discussion. See [[Talk:Alashki Engineering Constructions#Requested move 27 December 2022]].'); //adjust reason accordingly

	if (newTitle !== '') {
		var moveLink = "https://en.wikipedia.org/wiki/Special:MovePage/" + oldTitle + "?wpNewTitleMain=" + newTitle + "&wpReason=" + moveReason;
		jQuery(this).append(' <a href="' + moveLink + '">(Move)</a>');
	}

});