MediaWiki:RegexOutYourIPFromChatbanLogPage.js

/* By Sophiedp with help from Kocka, Doru, fng, and puxlit <3 */ (function {	if ( !$('body').hasClass('mw-special-Contributions') || window.SCRIPTLoaded || !mw.loader.getState('ext.Chat2') || window.QuickLogs || !$('.chat-ban-log').exists ) {		return;	}	window.SCRIPTLoaded = true;	var regex = /\/chatban\?page=[^:]+:(.*)$/;	var url = decodeURIComponent($('.chat-ban-log').attr('href'));	var user = url.match(regex)[1];	if (mw.util.isIPv4Address(user) || mw.util.isIPv6Address(user)) {		var newUser = encodeURIComponent($('.UserProfileMasthead .masthead-info h1').text);		$('.chat-ban-log').attr('href', $('.chat-ban-log').attr('href').replace(/(\/chatban\?page=[^%]+%3A).*$/, '$1' + mw.util.wikiUrlencode($('#UserProfileMasthead h1').text)));	} });