MediaWiki:Common.js : Différence entre versions
Sauter à la navigation
Sauter à la recherche
Ligne 7 : | Ligne 7 : | ||
label: 'youtube', | label: 'youtube', | ||
type: 'button', | type: 'button', | ||
− | icon: '// | + | icon: '//icons.iconarchive.com/icons/dakirby309/simply-styled/128/YouTube-icon.png', |
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', |
Version du 25 mars 2018 à 12:18
var customizeToolbar = function () {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"youtube": {
label: 'youtube',
type: 'button',
icon: '//icons.iconarchive.com/icons/dakirby309/simply-styled/128/YouTube-icon.png',
action: {
type: 'encapsulate',
options: {
pre: "<youtube> ",
post: " </youtube>"
}
}
}
}
} );
};
/* 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 );
}
} );
}