Patch demo (971624,2 971625,1 971626,1 971627,1 971628,2 970452,2) patchdemo_bdce762b0e https://patchdemo.wmflabs.org/wikis/bdce762b0e/wiki/Main_Page MediaWiki 1.42.0-alpha first-letter Media Special Talk User User talk Project Project talk File File talk MediaWiki MediaWiki talk Template Template talk Help Help talk Category Category talk TimedText TimedText talk Module Module talk Gadget Gadget talk Gadget definition Gadget definition talk T350544 0 152 153 2023-11-06T01:23:31Z Patch Demo 1 Demo page for [[phab:T350544]] 153 wikitext text/x-wiki Test in all skins: * [https://patchdemo.wmflabs.org/wikis/bdce762b0e/w/index.php?title={{FULLPAGENAME}}&useskin=vector-2022 {{int:skinname-vector-2022}}] * [https://patchdemo.wmflabs.org/wikis/bdce762b0e/w/index.php?title={{FULLPAGENAME}}&useskin=vector {{int:skinname-vector}}] * [https://patchdemo.wmflabs.org/wikis/bdce762b0e/w/index.php?title={{FULLPAGENAME}}&useskin=cologneblue {{int:skinname-cologneblue}}] * [https://patchdemo.wmflabs.org/wikis/bdce762b0e/w/index.php?title={{FULLPAGENAME}}&useskin=minerva {{int:skinname-minerva}}] * [https://patchdemo.wmflabs.org/wikis/bdce762b0e/w/index.php?title={{FULLPAGENAME}}&useskin=modern {{int:skinname-modern}}] * [https://patchdemo.wmflabs.org/wikis/bdce762b0e/w/index.php?title={{FULLPAGENAME}}&useskin=monobook {{int:skinname-monobook}}] * [https://patchdemo.wmflabs.org/wikis/bdce762b0e/w/index.php?title={{FULLPAGENAME}}&useskin=timeless {{int:skinname-timeless}}] hozwg7qg8gu7h90e8qvahc9r1x4pzbp MediaWiki:Common.js 8 151 152 2023-11-06T01:20:51Z Patch Demo 1 Demo script for [[phab:T350544]] 152 javascript text/javascript // https://www.mediawiki.org/wiki/OOUI/Windows/Process_Dialogs $.when( mw.loader.using( 'oojs-ui-windows' ), $.ready ).then( function() { // Example: Creating and opening a process dialog window. // Subclass ProcessDialog. function ProcessDialog( config ) { ProcessDialog.super.call( this, config ); } OO.inheritClass( ProcessDialog, OO.ui.ProcessDialog ); // Specify a name for .addWindows() ProcessDialog.static.name = 'myDialog'; // Specify a static title and actions. ProcessDialog.static.title = 'Process dialog'; ProcessDialog.static.size = 'full'; ProcessDialog.static.actions = [ { action: 'save', label: 'Done', flags: 'primary' }, { label: 'Cancel', flags: 'safe' } ]; // Use the initialize() method to add content to the dialog's $body, // to initialize widgets, and to set up event handlers. ProcessDialog.prototype.initialize = function () { ProcessDialog.super.prototype.initialize.apply( this, arguments ); this.content = new OO.ui.PanelLayout( { padded: true, expanded: false } ); this.content.$element.append( '<p>This is a process dialog window. The header contains the title and two buttons: \'Cancel\' (a safe action) on the left and \'Done\' (a primary action) on the right. </p>' ); this.content.$element.append( new OO.ui.ButtonWidget( { label: 'Toggle size' } ).on( 'click', function () { this.setSize( this.getSize() === 'full' ? 'medium' : 'full' ); }.bind( this ) ).$element ); this.$body.append( this.content.$element ); }; // Use the getActionProcess() method to specify a process to handle the // actions (for the 'save' action, in this example). ProcessDialog.prototype.getActionProcess = function ( action ) { var dialog = this; if ( action ) { return new OO.ui.Process( function () { dialog.close( { action: action } ); } ); } return ProcessDialog.super.prototype.getActionProcess.call( this, action ); }; ProcessDialog.prototype.getReadyProcess = function ( data ) { return ProcessDialog.super.prototype.getReadyProcess.call( this, data ) .next( function () { return OO.ui.findFocusable( this.content.$element ).focus(); }, this ); }; // Get dialog height. ProcessDialog.prototype.getBodyHeight = function () { return this.content.$element.outerHeight( true ); }; // Create and append the window manager. var oldStyle = new OO.ui.WindowManager(); $( document.body ).append( oldStyle.$element ); var newStyle = new OO.ui.WindowManager(); $( OO.ui.getTeleportTarget() ).append( newStyle.$element ); // Add windows to window manager using the addWindows() method. oldStyle.addWindows( [ new ProcessDialog() ] ); newStyle.addWindows( [ new ProcessDialog() ] ); $( '#mw-content-text' ).prepend( new OO.ui.ButtonWidget( { label: 'Demo: Old-style dialog' } ).on( 'click', function () { oldStyle.openWindow( 'myDialog' ); } ).$element, new OO.ui.ButtonWidget( { label: 'Demo: New-style dialog' } ).on( 'click', function () { newStyle.openWindow( 'myDialog' ); } ).$element ); } ); mbj0s9dedfl8qhy9huc533ku8hflqu4