MediaWiki:Common.js: Unterschied zwischen den Versionen
Aus Sandboxgamer
Admin (Diskussion | Beiträge) Markierung: Manuelle Zurücksetzung |
Admin (Diskussion | Beiträge) |
||
Zeile 3: | Zeile 3: | ||
mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) { | mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) { | ||
// Configure a new toolbar entry on the given $textarea jQuery object. | // Configure a new toolbar entry on the given $textarea jQuery object. | ||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
'section': 'advanced', | |||
'groups': { | |||
'add': { | |||
'label': 'Add' // or use labelMsg for a localized label, see above | |||
} | |||
} | |||
} ); | |||
$textarea.wikiEditor( 'addToToolbar', { | $textarea.wikiEditor( 'addToToolbar', { | ||
Zeile 17: | Zeile 25: | ||
pre: "<s>", | pre: "<s>", | ||
post: "</s>" | post: "</s>" | ||
} | |||
} | |||
} | |||
} | |||
} ); | |||
$textarea.wikiEditor( 'addToToolbar', { | |||
section: 'advanced', | |||
group: 'add', | |||
tools: { | |||
"strikethrough": { | |||
label: 'Code', | |||
type: 'button', | |||
icon: 'https://upload.wikimedia.org/wikipedia/commons/2/23/Button_code.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<code>", | |||
post: "</code>" | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
$textarea.wikiEditor( 'addToToolbar', { | |||
section: 'advanced', | |||
group: 'add', | |||
tools: { | |||
"strikethrough": { | |||
label: 'Ref', | |||
type: 'button', | |||
icon: 'https://upload.wikimedia.org/wikipedia/commons/2/2b/Button_ref_inscription.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<ref>", | |||
post: "</ref>" | |||
} | } | ||
} | } |
Version vom 16. Februar 2022, 09:09 Uhr
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. $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'advanced', 'groups': { 'add': { 'label': 'Add' // or use labelMsg for a localized label, see above } } } ); $textarea.wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "strikethrough": { label: 'Strike', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png', action: { type: 'encapsulate', options: { pre: "<s>", post: "</s>" } } } } } ); $textarea.wikiEditor( 'addToToolbar', { section: 'advanced', group: 'add', tools: { "strikethrough": { label: 'Code', type: 'button', icon: 'https://upload.wikimedia.org/wikipedia/commons/2/23/Button_code.png', action: { type: 'encapsulate', options: { pre: "<code>", post: "</code>" } } } } } ); $textarea.wikiEditor( 'addToToolbar', { section: 'advanced', group: 'add', tools: { "strikethrough": { label: 'Ref', type: 'button', icon: 'https://upload.wikimedia.org/wikipedia/commons/2/2b/Button_ref_inscription.png', action: { type: 'encapsulate', options: { pre: "<ref>", post: "</ref>" } } } } } ); } ); }