MediaWiki:Common.js: различия между версиями
User (обсуждение | вклад) Нет описания правки |
User (обсуждение | вклад) Нет описания правки |
||
| Строка 7: | Строка 7: | ||
$textarea.wikiEditor( 'addToToolbar', { | $textarea.wikiEditor( 'addToToolbar', { | ||
section: 'main', | section: 'main', | ||
groups: { | |||
list: { | |||
tools: { | |||
templates: { | |||
label: 'Templates', | |||
type: 'select', | |||
list: { | |||
'Ping-button': { | |||
label: '{{Ping}}', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: '{{Ping|', | |||
post: '}}' | |||
} | |||
} | |||
}, | |||
'Clear-button': { | |||
label: 'Clear', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: '{{Clear}}' | |||
} | |||
} | |||
}, | |||
'Done-button': { | |||
label: 'Done', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: '{{Done}}' | |||
} | |||
} | |||
} | |||
} | } | ||
} | } | ||
} | } | ||
} | } | ||
Версия от 11:21, 13 мая 2024
/* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой странице */
// Check if we're editing a page.
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
// Add a hook handler.
mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
// Configure a new toolbar entry on the given $textarea jQuery object.
$textarea.wikiEditor( 'addToToolbar', {
section: 'main',
groups: {
list: {
tools: {
templates: {
label: 'Templates',
type: 'select',
list: {
'Ping-button': {
label: '{{Ping}}',
action: {
type: 'encapsulate',
options: {
pre: '{{Ping|',
post: '}}'
}
}
},
'Clear-button': {
label: 'Clear',
action: {
type: 'encapsulate',
options: {
pre: '{{Clear}}'
}
}
},
'Done-button': {
label: 'Done',
action: {
type: 'encapsulate',
options: {
pre: '{{Done}}'
}
}
}
}
}
}
}
}
} );
} );
}