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 226: | Linje 226: | ||
tools: { | tools: { | ||
"comment": { | "comment": { | ||
label: ' | label: 'Citat-afsnit', | ||
type: 'button', | type: 'button', | ||
icon: '//upload.wikimedia.org/wikipedia/commons/ | icon: '//upload.wikimedia.org/wikipedia/commons/2/2f/Toolbaricon_quote_1.png', | ||
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', | ||
options: { | options: { | ||
pre: "< | pre: "<blockquote>", | ||
post: " | post: "</blockquote>\n" | ||
} | } | ||
} | } | ||
Linje 246: | Linje 246: | ||
tools: { | tools: { | ||
"comment": { | "comment": { | ||
label: ' | label: 'Opdel i 2 kolonner', | ||
type: 'button', | type: 'button', | ||
icon: '//upload.wikimedia.org/wikipedia/commons/ | icon: '//upload.wikimedia.org/wikipedia/commons/4/4f/Trigramme2637_☷.svg', | ||
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', | ||
options: { | options: { | ||
pre: "< | pre: "<table width=100%>\n<tr valign=top>\n<td width=50%>\n", | ||
post: "</ | post: "\n<td>\n\n</tr>\n</table>" | ||
} | |||
} | |||
} | |||
} | |||
} ); | |||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
section: 'advanced', | |||
group: 'format', | |||
tools: { | |||
"comment": { | |||
label: 'Fold ud', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/9/9c/A_pair_of_braces_with_a_vertical_line_between.png', | |||
action: { | |||
type: 'replace', | |||
options: { | |||
pre: "| liste1 = {{q|{{{1|}}}|", | |||
post: "" | |||
} | } | ||
} | } | ||
Linje 259: | Linje 278: | ||
} | } | ||
} ); | } ); | ||
Versionen fra 3. sep. 2021, 09:16
/* 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: '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" } } } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "comment": { label: 'Opdel i 2 kolonner', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/4/4f/Trigramme2637_☷.svg', action: { type: 'encapsulate', options: { pre: "<table width=100%>\n<tr valign=top>\n<td width=50%>\n", post: "\n<td>\n\n</tr>\n</table>" } } } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "comment": { label: 'Fold ud', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/9/9c/A_pair_of_braces_with_a_vertical_line_between.png', action: { type: 'replace', options: { pre: "| liste1 = {{q|{{{1|}}}|", post: "" } } } } } ); }; /* 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 ); } } ); }