Benutzer:WikiSysop/common.js: Unterschied zwischen den Versionen

Aus Mediawiki Ferdinand Gruber
Zur Navigation springen Zur Suche springen
K
K
 
(9 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
// Check if we're editing a page.
+
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) { alert("***********");
 
// Add a hook handler.
 
 
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.
 
 
$textarea.wikiEditor( 'addToToolbar', {
 
$textarea.wikiEditor( 'addToToolbar', {
section: 'secondary',
+
section: 'advanced',
group: 'default',
+
group: 'format',
 
tools: {
 
tools: {
dothing: {
+
code: {
type: 'element',
+
label: 'InlineCode',
element: function ( context ) {
+
type: 'button',
// Note that the `context` object contains various useful references.
+
oouiIcon: 'markup',
console.log( context );
+
action: {
var button = new OO.ui.ButtonInputWidget( {
+
type: 'encapsulate',
label: 'Do a thing',
+
options: {
icon: 'hieroglyph'
+
pre: '<tt>',
} );
+
post: '</tt>'
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;
 
 
}
 
}
 
}
 
}

Aktuelle Version vom 18. Dezember 2024, 11:53 Uhr

if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
	mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
				code: {
					label: 'InlineCode',
					type: 'button',
					oouiIcon: 'markup',
					action: {
						type: 'encapsulate',
						options: {
							pre: '<tt>',
							post: '</tt>'
						}
					}
				}
			}
		} );
	} );
}