User:Robinr78/common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Replaced content with "var customizeToolbar = function () { →2020-0830: →Enable section:SM-201: $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'sections': { 'SM-201': { 'type': 'toolbar', // Can also be 'booklet' 'label': 'SM-201' } } } ); →Enable section:Other: $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'sections': { 'Other': { 'type': 'toolbar', // Can also be 'booklet' 'label': 'Other' } } } ); →Enable Group:Format:: $( '#wpTextbox1'...") Tag: Replaced |
||
| Line 115: | Line 115: | ||
}); | }); | ||
Revision as of 17:46, 6 January 2023
var customizeToolbar = function () {
/* 2020-0830 */
/* Enable section:SM-201 */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'SM-201': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'SM-201'
}
}
} );
/* Enable section:Other */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'Other': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'Other'
}
}
} );
/* Enable Group:Format: */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'SM-201',
'groups': {
'Format': {
'label': 'Format'
}
}
} );
/* --- Enable Format:Comment */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'SM-201',
group: 'Format',
tools: {
"Comment": {
label: 'Comment',
type: 'button',
icon: 'http://www.sm-201.org/a/images/6/66/Editor_!.png',
action: {
type: 'encapsulate',
options: {
pre: '<!-- ',
post: ' -->'
}
}
}
}
} );
/* --- Enable Format:Apostrophe */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'SM-201',
group: 'Format',
tools: {
"Apostrope": {
label: 'Apostrophe',
type: 'button',
icon: 'http://www.sm-201.org/a/images/3/39/Editor_apos.png',
action: {
type: 'encapsulate',
options: {
pre: "'",
post: "'"
}
}
}
}
} );
/* --- Enable Format:<clear /> */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'SM-201',
group: 'Format',
tools: {
"Clear": {
label: 'Clear',
type: 'button',
icon: 'http://sm-201.org/a/images/b/be/Editor_c.png',
action: {
type: 'encapsulate',
options: {
pre: '<br clear="all"> ',
post: ''
}
}
}
}
});
/* --- Enable Format:List Item */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'SM-201',
group: 'Format',
tools: {
"Item2": {
label: 'Item2',
type: 'button',
icon: 'http://sm-201.org/a/images/7/79/Button_item.jpg',
action: {
type: 'encapsulate',
options: {
pre: '* [[',
post: ']]'
}
}
}
}
});
/* Leave everything below this line alone ===================== */
};
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -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 );
}
} );
}