Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
m |
m |
||
Line 274: | Line 274: | ||
'section': 'WICA', | 'section': 'WICA', | ||
'group': 'icons', | 'group': 'icons', | ||
'tools': { | 'tools': { | ||
'calendar': { | |||
label: 'calendar', | |||
type: 'button', | |||
icon: '//wikicarpedia.com/images/9/9e/Toolbar_calendar.png', | |||
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', | ||
options: { | options: { | ||
Line 283: | Line 286: | ||
post: "}}" | post: "}}" | ||
} | } | ||
} | |||
} | } | ||
} | } | ||
} ); | } ); | ||
Revision as of 13:17, 10 October 2018
var customizeToolbar = function () {
/* --------------------------------------------------------------------------- */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'WICA': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'WICA'
// or 'labelMsg': 'section-emoticons-label' for a localized label
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'WICA',
'groups': {
'icons': {
'label': '' // or use labelMsg for a localized label, see above
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'WICA',
'group': 'icons',
'tools': {
'smile': {
label: 'Padlock',
type: 'button',
icon: '//wikicarpedia.com/images/thumb/7/7b/Icon_Locked_Red.png/16px-Icon_Locked_Red.png',
action: {
type: 'encapsulate',
options: {
pre: "{{IconPadlock}}" // text to be inserted
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'WICA',
'group': 'icons',
'tools': {
'houserule': {
label: 'House rule',
type: 'button',
icon: '//wikicarpedia.com/images/thumb/f/fb/Icon_House_Black.png/16px-Icon_House_Black.png',
action: {
type: 'encapsulate',
options: {
pre: "{{IconHouse}}" // text to be inserted
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'WICA',
'group': 'icons',
'tools': {
'arrow': {
label: 'arrow',
type: 'button',
icon: '//wikicarpedia.com/images/thumb/6/6d/Icon_Double_Arrow_Black.png/16px-Icon_Double_Arrow_Black.png',
action: {
type: 'encapsulate',
options: {
pre: "{{IconArrow}}" // text to be inserted
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'WICA',
'group': 'icons',
'tools': {
'book': {
label: 'book',
type: 'button',
icon: '//wikicarpedia.com/images/thumb/e/ea/Icon_Open_Book.png/16px-Icon_Open_Book.png',
action: {
type: 'encapsulate',
options: {
pre: "{{IconBook}}" // text to be inserted
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'WICA',
'group': 'icons',
'tools': {
'world': {
label: 'World',
type: 'button',
icon: '//wikicarpedia.com/images/thumb/7/73/Icon_World_Black.png/16px-Icon_World_Black.png',
action: {
type: 'encapsulate',
options: {
pre: "{{IconWorld}}" // text to be inserted
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'WICA',
'group': 'icons',
'tools': {
'yellow': {
label: 'yellow',
type: 'button',
icon: '//wikicarpedia.com/images/2/2d/Toolbar_yellow.png',
action: {
type: 'encapsulate',
options: {
pre: "{{ColorYellow|",
peri: "",
post: "}}"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'WICA',
'group': 'icons',
'tools': {
'red': {
label: 'red',
type: 'button',
icon: '//wikicarpedia.com/images/1/1b/Toolbar_red.png',
action: {
type: 'encapsulate',
options: {
pre: "{{ColorRed|",
peri: "",
post: "}}"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'WICA',
'group': 'icons',
'tools': {
'blue': {
label: 'blue',
type: 'button',
icon: '//wikicarpedia.com/images/e/e2/Toolbar_blue.png',
action: {
type: 'encapsulate',
options: {
pre: "{{ColorBlue|",
peri: "",
post: "}}"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'WICA',
'group': 'icons',
'tools': {
'black': {
label: 'black',
type: 'button',
icon: '//wikicarpedia.com/images/8/8b/Toolbar_black.png',
action: {
type: 'encapsulate',
options: {
pre: "{{ColorBlack|",
peri: "",
post: "}}"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'WICA',
'group': 'icons',
'tools': {
'green': {
label: 'green',
type: 'button',
icon: '//wikicarpedia.com/images/5/55/Toolbar_green.png',
action: {
type: 'encapsulate',
options: {
pre: "{{ColorGreen|",
peri: "",
post: "}}"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'WICA',
'group': 'icons',
'tools': {
'gray': {
label: 'gray',
type: 'button',
icon: '//wikicarpedia.com/images/4/41/Toolbar_grey.png',
action: {
type: 'encapsulate',
options: {
pre: "{{ColorGray|",
peri: "",
post: "}}"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'WICA',
'group': 'icons',
'tools': {
'white': {
label: 'white',
type: 'button',
icon: '//wikicarpedia.com/images/7/7a/Toolbar_white.png',
action: {
type: 'encapsulate',
options: {
pre: "{{ColorWhite|",
peri: "",
post: "}}"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'WICA',
'group': 'icons',
'tools': {
'pink': {
label: 'pink',
type: 'button',
icon: '//wikicarpedia.com/images/1/15/Toolbar_pink.png',
action: {
type: 'encapsulate',
options: {
pre: "{{ColorPink|",
peri: "",
post: "}}"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'WICA',
'group': 'icons',
'tools': {
'calendar': {
label: 'calendar',
type: 'button',
icon: '//wikicarpedia.com/images/9/9e/Toolbar_calendar.png',
action: {
type: 'encapsulate',
options: {
pre: "{{Year|",
peri: "",
post: "}}"
}
}
}
}
} );
/* --------------------------------------------------------------------------- */
};
/* 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 );
}
} );
}