「MediaWiki:Common.js/edit.js」:修訂間差異
跳至導覽
跳至搜尋
小 (已匯入 1 筆修訂) |
小 (Xiplus 已移動頁面 MediaWiki:Common.js 至 MediaWiki:Common.js/edit.js,不留重新導向) |
於 2016年4月12日 (二) 17:51 的修訂
( function( $, mw ) { $( function() {
if ( $( '#editform input[name=wpSection]' ).val() === 'new' ) {
if ( $( '#no-new-title' ).length ) {
$( '#wpSummary' ).attr( 'disabled', true );
}
return;
}
$( '#wpSummaryLabel .mw-summary-preset' ).on( 'click', '.mw-summary-preset-item a', function( e ) {
e.preventDefault();
var $this = $( this ), summary = $( '#wpSummary' ).val();
var $item = $this.parent( '.mw-summary-preset-item' );
summary = summary.replace( /\s+$/g, '' );
if ( summary != '' ) {
summary += ' ';
}
summary += $item.attr( 'title' ) || $this.text();
$this.replaceWith( $this.contents() );
$( '#wpSummary' ).val( summary );
} );
} ); } )( jQuery, mediaWiki );