Replace the default WikiEditor signature button with a custom signature button
From ProWiki - Demo and Test Wiki
JavaScript
- Add the following code to the "MediaWiki
- Common.js page
// <nowiki>
var customizeToolbar = function () {
/**
* Add the custom signature button to the existing "main" group
*/
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'main',
group: 'insert',
tools: {
"customSignature": {
label: 'Signatur einfügen',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/c0/OOjs_UI_icon_signature-ltr.svg/20px-OOjs_UI_icon_signature-ltr.svg.png',
action: {
type: 'encapsulate',
options: {
pre: ' --~~~~',
post: '',
ownline: false
}
}
}
}
});
};
/**
* Check if the view is in edit mode and the required modules are available. Then, customize the toolbar …
*/
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
mw.loader.using('user.options').then(function () {
if (mw.user.options.get('usebetatoolbar') == 1) {
$.when(
mw.loader.using('ext.wikiEditor'), $.ready
).then(customizeToolbar);
}
});
}
// </nowiki>
CSS
JavaScript
- Add the following code to the "MediaWiki
- Common.js page
/** WikiEditor
* Hide the custom signature button from the existing "main" group
*/
div#wikiEditor-ui-toolbar span[rel="signature"] {
display: none;
}