Jump to content

MediaWiki talk:Common.js/Archive 12

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Shadowbot3 (talk | contribs) at 00:02, 4 December 2007 (Automated archival of 1 sections from MediaWiki talk:Common.js). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Log page field labels

Perhaps there have been more people than me feeling that the field labels on the Special:Log doesn't always fit. I propose following script, that will update the field names according to the wanted action, at the moment, only for block is changed, but it's easy to update for the other actions also. AzaToth 01:18, 2 November 2007 (UTC)[reply]

if( wgCanonicalSpecialPageName == 'Log' ) {
	var form = document.forms[0];
	var labels = form.getElementsByTagName( 'label' );

	// Save the given text from the beginning, first one is the "user" field, and the nect one is the "page" field;
	var old = {};
	old.user = labels[0].textContent;
	old.page = labels[1].textContent;
	var logLabelCallback = function logLabelCallback( event ) {
		var form = event.target;
		var value = form.type.value;
		labels = form.getElementsByTagName( 'label' );

		switch( value ) {
		case 'block':
			labels[0].textContent = 'Blocker:';
			labels[1].textContent = 'Blockee:';
			break;
		default:
			labels[0].textContent = old.user;
			labels[1].textContent = old.page;
			break;
		}
	}

	// We add an event listener to the callback in the form element
	form.addEventListener( 'change', logLabelCallback, false );

	// to make it "pop up" on load, we initiate an change event
	var evt = document.createEvent( "Event" );
	evt.initEvent( 'change', true, true );
	form.dispatchEvent( evt );
}
1) I don't think it's important enough to warrant a script; 2) this would break interface for users with custom language in preferences; 3) stop trying to make Common.js IE-incompatible, you've yet to come back and fix Sysop.js :) ∴ AlexSm 04:22, 2 November 2007 (UTC)[reply]
Agree with Alex, this adds way to much code for such a minor fix. This sohuld just be fixed in MediaWiki instead. —Ruud 16:32, 2 November 2007 (UTC)[reply]