Jump to content

User:Robertsky/Random scripts

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by Robertsky (talk | contribs) at 06:03, 8 January 2024 (encodeURIComponent the titles). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Semi-manual mass move

[edit]

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/" + encodeURIComponent(oldTitle) + "?wpNewTitleMain=" + encodeURIComponent(newTitle) + "&wpReason=" + moveReason;
		jQuery(this).append(' <a href="' + moveLink + '">(Move)</a>');
	}

});