MediaWiki:Gadget-Emoji.js
来自Limbo Wiki
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:按 Ctrl-F5。
$(function() {mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) { $textarea.wikiEditor( 'addToToolbar',{ section: 'advanced', group: 'format', tools: { buttonId: { label: 'Comment visible only for editors', type: 'button', action: { type: 'encapsulate', options: { pre: '<!-- ', peri: 'Insert comment here', post: ' -->' } } } } }); $textarea.wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { dothing: { type: 'element', element: function ( context ) { // Note that the `context` object contains various useful references. console.log( context ); var button = new OO.ui.ButtonInputWidget( { label: 'Do a thing', icon: 'hieroglyph' } ); button.connect( null, { click: function ( e ) { // Do whatever is required when the button is clicked. console.log( e ); OO.ui.alert( 'A thing is done.' ); } } ); return button.$element; } } } } ); });});