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>"
                                }
                        }
                }
        }
});




};

/* 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 );
		}
	} );
}