User:Robinr78/common.js: Difference between revisions

From Robin's SM-201 Website
Jump to navigation Jump to search
No edit summary
No edit summary
Line 7: Line 7:
/* Your code goes here */
/* Your code goes here */


    mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
$textarea.wikiEditor( 'addToToolbar', {
$textarea.wikiEditor( 'addToToolbar', {
section: 'main',
// Configuration object here
groups: {advanced
$textarea.wikiEditor( 'addToToolbar', {
list: {
section: 'emoticons',
tools: {
groups: {
templates: {
faces: {
label: 'Templates',
label: 'Faces' // or use labelMsg for a localized label, see above
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}}'
}
}
}
}
}
}
}
}
}
}
} );
} );
// Configuration object here
} );
} );


/* Your code goes here */
/* Your code goes here */

Revision as of 00:10, 31 December 2022

// 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', {
/* Your code goes here */

    mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
	$textarea.wikiEditor( 'addToToolbar', {
		// Configuration object here
$textarea.wikiEditor( 'addToToolbar', {
	section: 'emoticons',
	groups: {
		faces: {
			label: 'Faces' // or use labelMsg for a localized label, see above
		}
	}
} );
		// Configuration object here
	} );
} );	

/* Your code goes here */
		} );
	} );
}