MediaWiki:Common.js

Spring til navigation Spring til søgning

Bemærk: Efter at have gemt er du måske nødt til at tømme din browsers cache for at kunne se ændringerne.

  • Firefox / Safari: Hold Shift nede og klik på Reload, eller tryk enten Ctrl-F5 eller Ctrl-R (⌘-R på en Mac).
  • Google Chrome: Tryk Ctrl-Shift-R (⌘-Shift-R på en Mac).
  • Internet Explorer / Edge: Hold Ctrl nede og klik på Refresh, eller tryk på Ctrl-F5.
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files
/* 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"
                                }
                        }
                }
        }
} );

$( '#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 );
		}
	} );
}