2 * JavaScript for Special:Preferences: editfont field enhancements.
5 mw
.hook( 'htmlform.enhance' ).add( function ( $root
) {
7 $target
= $root
.find( '#mw-input-wpeditfont' );
11 $target
.closest( '.mw-htmlform-autoinfuse-lazy' ).length
17 widget
= OO
.ui
.infuse( $target
);
19 // This preference could theoretically be disabled ($wgHiddenPrefs)
24 widget
.dropdownWidget
.menu
.items
.forEach( function ( item
) {
25 item
.$label
.addClass( 'mw-editfont-' + item
.getData() );
28 function updateLabel( value
) {
29 // Style selected item label
30 widget
.dropdownWidget
.$label
31 .removeClass( 'mw-editfont-' + lastValue
)
32 .addClass( 'mw-editfont-' + value
);
36 widget
.on( 'change', updateLabel
);
37 updateLabel( widget
.getValue() );