Bruger:HP/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
var customizeToolbar = function () {

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'main',
	groups: {
		list: {
			tools: {
				templates: {
					label: 'Skabeloner',
					type: 'select',
					list: {
						'Wikipedia-opslag': {
							label: '{{w}}',
							action: {
								type: 'encapsulate',
								options: {
									pre: '{{w',
									post: '}}'
								}
							}
						},
						'Den Danske Ordbog': {
							label: 'DDO',
							action: {
								type: 'encapsulate',
								options: {
									pre: '{{ddo}}'
								}
							}
						},
						'Skib': {
							label: 'Done',
							action: {
								type: 'encapsulate',
								options: {
									pre: '{{sk'
								}
							}
						}
					}
				}
			}
		}
	}
} );

};

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