Jump to content

User:Robertsky/Random scripts

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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

});