MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus Sandboxgamer
Zeile 3: Zeile 3:
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', {
section: 'main',
group: 'format',
tools: {
"Underline": {
label: 'Underline',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/f/fd/Button_underline.png',
action: {
type: 'encapsulate',
options: {
pre: "<u>",
post: "</u>"
}
}
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
section: 'main',
group: 'format',
tools: {
"Double": {
label: 'Double Underline',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/4/45/Button_double.png',
action: {
type: 'encapsulate',
options: {
pre: "<u>",
post: "</u>"
}
}
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
$textarea.wikiEditor( 'addToToolbar', {
Zeile 27: Zeile 65:
group: 'insert',
group: 'insert',
tools: {
tools: {
"strikethrough": {
"code": {
label: 'Code',
label: 'Code',
type: 'button',
type: 'button',
Zeile 45: Zeile 83:
group: 'insert',
group: 'insert',
tools: {
tools: {
"strikethrough": {
"ref": {
label: 'Ref',
label: 'Ref',
type: 'button',
type: 'button',

Version vom 16. Februar 2022, 09:33 Uhr

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',
			group: 'format',
			tools: {
				"Underline": {
					label: 'Underline',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/f/fd/Button_underline.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "<u>",
							post: "</u>"
						}
					}
				}
			}
		} );
		$textarea.wikiEditor( 'addToToolbar', {
			
			section: 'main',
			group: 'format',
			tools: {
				"Double": {
					label: 'Double Underline',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/4/45/Button_double.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "<u>",
							post: "</u>"
						}
					}
				}
			}
		} );
		$textarea.wikiEditor( 'addToToolbar', {
			
			section: 'advanced',
			group: 'format',
			tools: {
				"strikethrough": {
					label: 'Strike',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "<s>",
							post: "</s>"
						}
					}
				}
			}
		} );
		$textarea.wikiEditor( 'addToToolbar', {
			
			section: 'advanced',
			group: 'insert',
			tools: {
				"code": {
					label: 'Code',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/2/23/Button_code.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "<code>",
							post: "</code>"
						}
					}
				}
			}
		} );
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'insert',
			tools: {
				"ref": {
					label: 'Ref',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/2/2b/Button_ref_inscription.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "<ref>",
							post: "</ref>"
						}
					}
				}
			}
		} );
	} );
}