MediaWiki:Common.js: Forskelle mellem versioner
Spring til navigation
Spring til søgning
HP (diskussion | bidrag) mNo edit summary |
HP (diskussion | bidrag) mNo edit summary |
||
Linje 181: | Linje 181: | ||
} ); | } ); | ||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
section: 'advanced', | |||
group: 'format', | |||
tools: { | |||
"comment": { | |||
label: 'Centrér tekst', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/7/76/Format-justify-center.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<center>", | |||
post: "</center>" | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
section: 'advanced', | |||
group: 'format', | |||
tools: { | |||
"comment": { | |||
label: 'Højrestil tekst', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/6/6e/Toolbaricon_justify-right.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<div align=right>", | |||
post: "</div>" | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
section: 'advanced', | |||
group: 'format', | |||
tools: { | |||
"comment": { | |||
label: 'Centrer kursiv tekst med mellemrum', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/8/8a/Toolbar_user.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<center style='white-space:pre'>''", | |||
post: "''</center>" | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
section: 'advanced', | |||
group: 'format', | |||
tools: { | |||
"comment": { | |||
label: 'Citat-afsnit', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/2/2f/Toolbaricon_quote_1.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<blockquote>", | |||
post: "</blockquote>\n" | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
Versionen fra 3. sep. 2021, 09:14
/* Javascript inkluderet her vil være aktivt for alle brugere. */ var customizeToolbar = function () { $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'characters', 'page': 'symbols', }); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'characters', 'pages': { 'nyttig': { 'layout': 'characters', 'label': 'Symbolik', 'characters': [ '„“', '»«', '«»', '№', '⅓', '⅔', '¼', '¾', '⅛', '⅜', '⅝', '⅞', '’‘', '”', 'm²', 'm³', '°', '²', '³', '‰', '–', '—', '…', '≈', '×', '·', '•', '□', '☹', '†', '✝', '✠' ] } } } ); /* Indsæt knapper i topbjælke sektion (main) */ $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'main', group: 'insert', tools: { "template": { label: 'Indsæt skabelon', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/4/4a/Norwegian_template_sign.png', action: { type: 'encapsulate', options: { pre: "{{", post: "}}\n" } } } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'main', group: 'insert', tools: { "redirect to category": { label: 'Bøjnings-link til et kategoriord', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/c/c4/Toolbar_category.png', action: { type: 'encapsulate', options: { pre: "#REDIRECT[[:kategori:", peri: "Indsæt", post: "]]\n[[kategori:kategoriord]]" } } } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'main', group: 'insert', tools: { "catego": { label: 'Link til en kategori', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/b/bb/Toolbaricon_italic_C.png', action: { type: 'encapsulate', options: { pre: "#REDIRECT[[:kategori:", periMsg: 'wikieditor-toolbar-tool-redirect-example', post: "]]\n[[kategori:]]" } } } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'main', group: 'insert', tools: { "new category": { label: 'Indsæt skabelon og kategori', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/e/eb/Toolbaricon_regular_C.png', action: { type: 'encapsulate', options: { pre: "{{", post: "|-|}}\n\n[[kategori:]]" } } } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'main', group: 'insert', tools: { "category": { label: 'Indsæt kategori', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/2/28/Toolbaricon_category.png', action: { type: 'encapsulate', options: { pre: "[[kategori:", post: "]]\n" } } } } } ); /* Indsæt knapper i Avanceret-'Format' (advanced) */ $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'advanced', group: 'format', tools: { "strikethrough": { label: 'Gennemstreget', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/6/6d/Vector_strikeout.png', action: { type: 'encapsulate', options: { pre: "<s>", post: "</s>" } } } } }); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "på dansk": { label: 'Understreget', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/1/13/Toolbaricon_regular_U_underline.png', action: { type: 'encapsulate', options: { pre: "<u>", post: "</u>" } } } } }); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "comment": { label: 'Venstrestil kursiv tekst med mellemrum', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/8/81/Toolbaricon_justify-left.png', action: { type: 'encapsulate', options: { pre: "<div style='white-space:pre'>''", post: "''</div>" } } } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "comment": { label: 'Centrér tekst', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/7/76/Format-justify-center.png', action: { type: 'encapsulate', options: { pre: "<center>", post: "</center>" } } } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "comment": { label: 'Højrestil tekst', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/6/6e/Toolbaricon_justify-right.png', action: { type: 'encapsulate', options: { pre: "<div align=right>", post: "</div>" } } } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "comment": { label: 'Centrer kursiv tekst med mellemrum', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/8/8a/Toolbar_user.png', action: { type: 'encapsulate', options: { pre: "<center style='white-space:pre'>''", post: "''</center>" } } } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "comment": { label: 'Citat-afsnit', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/2/2f/Toolbaricon_quote_1.png', action: { type: 'encapsulate', options: { pre: "<blockquote>", post: "</blockquote>\n" } } } } } ); }; /* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */ if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -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 ); } } ); }