Brukar:Sigmund/common.js: Skilnad mellom versjonar
Utsjånad
Inkje endringssamandrag |
Inkje endringssamandrag |
||
| Line 5: | Line 5: | ||
// Configure a new toolbar entry on the given $textarea jQuery object. | // Configure a new toolbar entry on the given $textarea jQuery object. | ||
$textarea.wikiEditor( 'addToToolbar', { | $textarea.wikiEditor( 'addToToolbar', { | ||
'section': 'main', | |||
'group': 'format', | |||
'tools': { | |||
'quote': { | |||
label: 'Anførselstegn', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/a/ac/Norwegian_quote_sign.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "«", | |||
//peri: "«»", | |||
post: "»" | |||
} | |||
} | |||
} | |||
} | |||
}); | |||
$textarea.wikiEditor( 'addToToolbar', { | |||
'section': 'main', | 'section': 'main', | ||
Versjonen frå 26. mars 2023 kl. 01:14
// 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',
'group': 'format',
'tools': {
'quote': {
label: 'Anførselstegn',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/a/ac/Norwegian_quote_sign.png',
action: {
type: 'encapsulate',
options: {
pre: "«",
//peri: "«»",
post: "»"
}
}
}
}
});
$textarea.wikiEditor( 'addToToolbar', {
'section': 'main',
'group': 'format',
'tools': {
'link': {
label: 'Lenkeparenteser',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/b/ba/Norwegian_link_sign.png',
action: {
type: 'encapsulate',
options: {
pre: "[[",
//peri: "[[]]",
post: "]]"
}
}
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
'section': 'main',
'group': 'format',
'tools': {
'link': {
label: 'Malparenteser',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/4/4a/Norwegian_template_sign.png',
action: {
type: 'encapsulate',
options: {
pre: "{{",
//peri: "{{}}",
post: "}}"
}
}
}
}
});
} );
}