User:Robinr78/common.js
Jump to navigation
Jump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
var customizeToolbar = function () {
/* stable as of 2023-0107 */
/* ================================================== */
/* Enable section:SM-201 */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'SM-201': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'SM-201'
}
}
} );
/* Enable Group:Format: */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'SM-201',
'groups': {
'Format': {
'label': 'Format'
}
}
} );
$( '#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: ']]'
}
}
}
}
});
/* --- Enable Format:Template Dot */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'SM-201',
group: 'Format',
tools: {
"Dot": {
label: 'Dot',
type: 'button',
icon: 'http://sm-201.org/a/images/0/02/Button_dot.png',
action: {
type: 'encapsulate',
options: {
pre: ' • [[',
post: ']]'
}
}
}
}
});
/* --- Enable Format:Tempate:BC */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'SM-201',
group: 'Format',
tools: {
"{{bc": {
label: '{{bc',
type: 'button',
icon: 'http://www.sm-201.org/a/images/b/b4/Editor_b.png',
action: {
type: 'encapsulate',
options: {
pre: "{{bc|",
post:"}}"
}
}
}
}
});
/* --- Enable Format:Book title */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'SM-201',
group: 'Format',
tools: {
"{{Titles": {
label: 'Titles',
type: 'button',
icon: 'http://www.sm-201.org/a/images/f/f4/Button_ititle.jpg',
action: {
type: 'encapsulate',
options: {
pre: "{{Titles|",
post:"}}"
}
}
}
}
});
/* --- Enable Format:Underline */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'SM-201',
group: 'Format',
tools: {
"Underline": {
label: 'Underline',
type: 'button',
icon: 'http://www.sm-201.org/a/images/7/73/Editor_ul.png',
action: {
type: 'encapsulate',
options: {
pre: "<u>",
post: "</u>",
}
}
}
}
});
/* --- Enable Format:Strike through*/
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'SM-201',
group: 'Format',
tools: {
"Strike": {
label: 'Strike',
type: 'button',
icon: 'http://www.sm-201.org/a/images/c/c9/Button_strike.png',
action: {
type: 'encapsulate',
options: {
pre: '<s>',
post: '</s>',
}
}
}
}
});
/* --- Enable Format:button [[ link ]] */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'SM-201',
group: 'Format',
tools: {
"Template": {
label: 'Link',
type: 'button',
icon: 'http://www.sm-201.org/a/images/c/c0/Button_link.png',
action: {
type: 'encapsulate',
options: {
pre: '[[',
post: ']]'
}
}
}
}
} );
/* --- Enable Format:button {{ }} */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'SM-201',
group: 'format',
tools: {
"Template": {
label: 'Template',
type: 'button',
icon: 'http://www.sm-201.org/a/images/5/5f/Button_temp.png',
action: {
type: 'encapsulate',
options: {
pre: "{{",
post: "}}"
}
}
}
}
} );
/* --- Enable Format:button Quotes */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'SM-201',
group: 'Format',
tools: {
"Quotes": {
label: 'Quotes',
type: 'button',
icon: 'http://www.sm-201.org/a/images/7/7d/Button_quot.png',
action: {
type: 'encapsulate',
options: {
pre: '"',
post: '"',
}
}
}
}
});
/* --- Enable Format:button moz-column */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'SM-201',
group: 'Format',
tools: {
"Columns": {
label: 'Columns',
type: 'button',
icon: 'http://www.sm-201.org/a/images/0/04/Button_multicol.png',
action: {
type: 'encapsulate',
options: {
pre: "<div style='-moz-column-count:2; column-count:2;'>",
post: "</div>",
}
}
}
}
});
/* --- Enable Format:button Center */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'SM-201',
group: 'Format',
tools: {
"Center": {
label: 'Center',
type: 'button',
icon: 'http://www.sm-201.org/a/images/5/5f/Button_center.png',
action: {
type: 'encapsulate',
options: {
pre: '<center>',
post: '</center>',
}
}
}
}
});
/* --- Enable Format:button Justify */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'SM-201',
group: 'Format',
tools: {
"Justify": {
label: 'Justify',
type: 'button',
icon: 'http://www.sm-201.org/a/images/0/0f/Button_just.png',
action: {
type: 'encapsulate',
options: {
pre: '<p align="justify">',
post: '</p>',
}
}
}
}
});
/* Enable Group:Inc: ================================== */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'SM-201',
'groups': {
'Inc': {
'label': 'Inc'
}
}
} );
/* --- Enable button Inc:Includeonly */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'SM-201',
group: 'Inc',
tools: {
"Incl": {
label: 'Incl',
type: 'button',
icon: 'http://www.sm-201.org/a/images/3/3b/Button_in.jpg',
action: {
type: 'encapsulate',
options: {
pre: "<includeonly>",
post:"</includeonly>"
}
}
}
}
});
/* --- Enable button Inc:Noinclude */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'SM-201',
group: 'Inc',
tools: {
"Noinclude": {
label: 'Noinclude',
type: 'button',
icon: 'http://www.sm-201.org/a/images/1/1b/Button_no.jpg',
action: {
type: 'encapsulate',
options: {
pre: "<noinclude>",
post:"</noinclude>"
}
}
}
}
});
/* --- Enable button Inc:Nowiki */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'SM-201',
group: 'Inc',
tools: {
"Nowiki": {
label: 'Nowiki',
type: 'button',
icon: 'http://www.sm-201.org/a/images/a/a6/Button_quiet.jpg',
action: {
type: 'encapsulate',
options: {
pre: "<nowiki>",
post:"</nowiki>"
}
}
}
}
});
/* Enable group:SM-201:Cats ============================ */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'SM-201',
'groups': {
'Cats': {
'label': 'Cats'
}
}
} );
/* --- Enable button Cats:Category */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'SM-201',
group: 'Cats',
tools: {
"Cats": {
label: 'Category',
type: 'button',
icon: 'http://www.sm-201.org/a/images/d/d0/Button_Cat.Png',
action: {
type: 'encapsulate',
options: {
pre: '[[Category:',
post: ']]'
}
}
}
}
} );
/* --- Enable button Cats:Category2 */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'SM-201',
group: 'Cats',
tools: {
"Cats": {
label: 'Category',
type: 'button',
icon: 'http://www.sm-201.org/a/images/d/d0/Button_Cat.Png',
action: {
type: 'encapsulate',
options: {
pre: '{{cat|',
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 );
}
} );
}