打开/关闭菜单
Toggle preferences menu
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

MediaWiki:Gadget-custom-toolbar.js:修订间差异

MediaWiki界面页面
(创建页面,内容为“// Check if we're editing a page. if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) { // Add a hook handler. mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) { // Configure a new toolbar entry on the given $textarea jQuery object. $textarea.wikiEditor( 'addToToolbar', { section: 'main', groups: { list: { tools: { templates: {…”)
 
无编辑摘要
第4行: 第4行:
mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
// Configure a new toolbar entry on the given $textarea jQuery object.
// Configure a new toolbar entry on the given $textarea jQuery object.
//题库模板的下拉菜单
$textarea.wikiEditor( 'addToToolbar', {
$textarea.wikiEditor( 'addToToolbar', {
             section: 'main',
             section: 'main',
第10行: 第11行:
                     tools: {
                     tools: {
                         templates: {
                         templates: {
                             label: 'Templates',
                             label: '题库模板',
                             type: 'select',
                             type: 'select',
                             list: {
                             list: {
                                 'Ping-button': {
                                 'A1-button': {
                                     label: '{{Ping}}',
                                     label: 'A1型题',
                                     action: {
                                     action: {
                                         type: 'encapsulate',
                                         type: 'encapsulate',
                                         options: {
                                         options: {
                                             pre: '{{Ping|',
                                             pre: '{{A型题\n|source=\n|title=\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer=\n|explain=',
                                             post: '}}'
                                             post: '\n}}'
                                         }
                                         }
                                     }
                                     }

2023年6月3日 (六) 20:18的版本

// Check if we're editing a page.
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
	// Add a hook handler.
	mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
		// Configure a new toolbar entry on the given $textarea jQuery object.
		//题库模板的下拉菜单
		$textarea.wikiEditor( 'addToToolbar', {
            section: 'main',
            groups: {
                list: {
                    tools: {
                        templates: {
                            label: '题库模板',
                            type: 'select',
                            list: {
                                'A1-button': {
                                    label: 'A1型题',
                                    action: {
                                        type: 'encapsulate',
                                        options: {
                                            pre: '{{A型题\n|source=\n|title=\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer=\n|explain=',
                                            post: '\n}}'
                                        }
                                    }
                                },
                                'Clear-button': {
                                    label: 'Clear',
                                    action: {
                                        type: 'encapsulate',
                                        options: {
                                            pre: '{{Clear}}'
                                        }
                                    }
                                },
                                'Done-button': {
                                    label: 'Done',
                                    action: {
                                        type: 'encapsulate',
                                        options: {
                                            pre: '{{Done}}'
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        } );
	} );
}