미디어위키:Common.js: 두 판 사이의 차이

새 문서: →‎이 자바스크립트 설정은 모든 문서, 모든 사용자에게 적용됩니다.: var customizeToolbar = function () { $( '#wpTextbox1' ).wikiEditor( 'addToToolbar',...
 
(차이 없음)

2021년 1월 2일 (토) 19:34 기준 최신판

/* 이 자바스크립트 설정은 모든 문서, 모든 사용자에게 적용됩니다. */

var customizeToolbar = function () {
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group': 'format',
        'tools': {
            'cite': {
                label: '주석',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/4/4f/Cite_icon.svg',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "[* ",
                        peri: "주석 내용",
                        post: "]"
                    }
                }
            }
        }
    } );
};

/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
	mw.loader.using( 'user.options' ).then( function () {
		// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor' ), $.ready
			).then( customizeToolbar );
		}
	} );
}