User:Speravir/config-WikiEditor.js: Difference between revisions
Content deleted Content added
No edit summary Tag: Reverted |
Undo own revision 24338331 Tag: Undo |
||
Line 10: | Line 10: | ||
tool: 'signature' // Remove default signature button |
tool: 'signature' // Remove default signature button |
||
}); |
}); |
||
/* |
|||
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { |
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { |
||
section: 'advanced', |
section: 'advanced', |
||
Line 21: | Line 20: | ||
tool: 'small' // just for consistency |
tool: 'small' // just for consistency |
||
}); |
}); |
||
*/ |
|||
// End of removeFromToolbar |
// End of removeFromToolbar |
||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { |
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { |
||
Line 73: | Line 71: | ||
} |
} |
||
}); // addToToolbar: strikethrough/comment |
}); // addToToolbar: strikethrough/comment |
||
/* |
|||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { |
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { |
||
section: 'advanced', |
section: 'advanced', |
||
Line 106: | Line 103: | ||
} |
} |
||
}); // addToToolbar: bigger/smaller |
}); // addToToolbar: bigger/smaller |
||
*/ |
|||
}; // var customizeToolbar |
}; // var customizeToolbar |
||
Revision as of 23:37, 7 January 2023
// <nowiki>
/* [[:mw:Extension:WikiEditor]] / [[:mw:Extension:WikiEditor/Toolbar customization]] and
* https://github.com/wikimedia/mediawiki-extensions-WikiEditor/blob/master/modules/jquery.wikiEditor.toolbar.config.js
*/
var userSig = '— ~~~ <span style="font-size:80%;color:#555;">– ~~~~~</span>', // signature
customizeToolbar = function () {
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
section: 'main',
group: 'insert',
tool: 'signature' // Remove default signature button
});
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
section: 'advanced',
group: 'size',
tool: 'big' // inserts obsolete HTML element "<big>"
});
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
section: 'advanced',
group: 'size',
tool: 'small' // just for consistency
});
// End of removeFromToolbar
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'main',
group: 'insert',
tools: {
'customsig': { // Custom signature
label: 'Signatur & Datum',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Insert-signature2.svg/22px-Insert-signature2.svg.png',
// [[:commons:File:Insert-signature2.svg]]
action: {
type: 'encapsulate',
options: {
pre: userSig
}
}
}
}
}); // addToToolbar: customsig
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
'strikethrough': {
label: 'Durchgestrichen',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/f/f9/Toolbaricon_regular_S_stroke.png',
// [[:commons:File:Toolbaricon regular S stroke.png]]
action: {
type: 'encapsulate',
options: {
pre: '<s>',
post: '</s>'
}
}
},
'comment': {
label: 'Kommentar',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/9/93/Toolbaricon_decomment.png',
// [[:commons:File:Toolbaricon decomment.png]]
action: {
type: 'encapsulate',
options: {
pre: '<!-- ',
post: ' -->'
}
}
} // 'comment'
}
}); // addToToolbar: strikethrough/comment
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'size',
tools: {
'bigger': {
label: 'Größer',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/0/0d/OOjs_UI_icon_bigger-ltr.svg',
// [[:commons:File:OOjs UI icon bigger-ltr.svg]]
action: {
type: 'encapsulate',
options: {
pre: '<span style="font-size:larger;">', // clean with CSS
post: '</span>'
}
}
},
'smaller': {
label: 'Kleiner',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/d/dc/OOjs_UI_icon_smaller-ltr.svg',
// [[:commons:File:OOjs UI icon smaller-ltr.svg]]
action: {
type: 'encapsulate',
options: {
pre: '<small>',
post: '</small>'
}
}
}
}
}); // addToToolbar: bigger/smaller
}; // var customizeToolbar
/* Check if view is in edit mode and that 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 () {
// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
$.when(
mw.loader.using( 'ext.wikiEditor' ), $.ready
).then( customizeToolbar );
}
} );
} // end of edit check
// </nowiki>