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

MediaWiki:Gadget-custom-toolbar.js

MediaWiki界面页面
Cirno.9讨论 | 贡献2023年6月3日 (六) 20:13的版本 (创建页面,内容为“// 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: {…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:Ctrl-F5
// 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: 'Templates',
                            type: 'select',
                            list: {
                                'Ping-button': {
                                    label: '{{Ping}}',
                                    action: {
                                        type: 'encapsulate',
                                        options: {
                                            pre: '{{Ping|',
                                            post: '}}'
                                        }
                                    }
                                },
                                'Clear-button': {
                                    label: 'Clear',
                                    action: {
                                        type: 'encapsulate',
                                        options: {
                                            pre: '{{Clear}}'
                                        }
                                    }
                                },
                                'Done-button': {
                                    label: 'Done',
                                    action: {
                                        type: 'encapsulate',
                                        options: {
                                            pre: '{{Done}}'
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        } );
	} );
}