Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js

MediaWiki interface page
Revision as of 10:33, 25 June 2026 by Simon (talk | contribs) (Disable "This is my own work" checkbox in VE upload dialog (via create-page on MediaWiki MCP Server))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/**
 * Pre-select and hide the "This is my own work" checkbox
 * in the VisualEditor media upload dialog.
 */
mw.loader.using( 'mediawiki.ForeignStructuredUpload.BookletLayout' ).done( function () {
	var BookletLayout = mw.ForeignStructuredUpload &&
		mw.ForeignStructuredUpload.BookletLayout;
	if ( !BookletLayout ) {
		return;
	}

	var origRender = BookletLayout.prototype.renderUploadForm;
	BookletLayout.prototype.renderUploadForm = function () {
		var form = origRender.call( this );

		if ( this.ownWorkCheckbox ) {
			// Pre-check "This is my own work" (also triggers the change handler
			// that hides the "not own work" message label)
			this.ownWorkCheckbox.setSelected( true );
			// Hide the checkbox's FieldLayout so users don't see it
			this.ownWorkCheckbox.$element
				.closest( '.oo-ui-fieldLayout' )
				.hide();
		}

		return form;
	};
} );