「MediaWiki:Gadget-specialchars.js」:修訂間差異

出自竹園Wiki
跳至導覽 跳至搜尋
(新頁面: ( function( $, mw ) { $( window ).load( function() { var $toolbar = $( '#toolbar, #wikiEditor-ui-toolbar' ); var $specialchars = $( '#editpage-specialchars' ); if ( $toolbar.length...)
 
(無差異)

於 2016年1月14日 (四) 08:11 的最新修訂

( function( $, mw ) { $( window ).load( function() {
	var $toolbar = $( '#toolbar, #wikiEditor-ui-toolbar' );
	var $specialchars = $( '#editpage-specialchars' );
	if ( $toolbar.length == 0 || $specialchars.length == 0 ) {
		return;
	}
	var $menu = $( '<select/>' ).css( 'display', 'inline' ).change( function( e ) {
		$specialchars.find( 'p' ).hide().eq( this.selectedIndex ).css( 'display', 'inline' );
	} );
	$specialchars.find( 'p' ).each( function() {
		$( '<option/>' ).text( this.title ).appendTo( $menu );
	} );
	$specialchars.prepend( $menu.change() ).insertAfter( $toolbar );
} ); } )( jQuery, mediaWiki );