Utilisateur:Kghbln/vector.js

De Semantic MediaWiki - Sandbox

Note : après avoir publié vos modifications, il se peut que vous deviez forcer le rechargement complet du cache de votre navigateur pour voir les changements.

  • Firefox / Safari : maintenez la touche Maj (Shift) en cliquant sur le bouton Actualiser ou appuyez sur Ctrl + F5 ou Ctrl + R (⌘ + R sur un Mac).
  • Google Chrome : appuyez sur Ctrl + Maj + R (⌘ + Shift + R sur un Mac).
  • Internet Explorer / Edge : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl + F5.
  • Opera : appuyez sur Ctrl + F5.
// <nowiki>
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'main',
	groups: {
		list: {
			tools: {
				templates: {
					label: 'Templates',
					type: 'select',
					list: {
						'Ping-button': {
							label: '{{Ping}}',
							action: {
								type: 'encapsulate',
								options: {
									pre: '{{Ping|',
									post: '}}'
								}
							}
						},
						'Clear-button': {
							label: 'Clear',
							action: {
								type: 'encapsulate',
								options: {
									pre: '{{Clear}}'
								}
							}
						},
						'Done-button': {
							label: 'Done',
							action: {
								type: 'encapsulate',
								options: {
									pre: '{{Done}}'
								}
							}
						}
					}
				}
			}
		}
	}
} );

var customizeToolbar = function () {
	$('#wpTextbox1').wikiEditor('addToToolbar', {
		section: 'advanced',
		group: 'templates',
		tools: {
			"references": {
				label: 'Abschnitt Einzelnachweise hinzufügen',
				type: 'button',
				icon: '//upload.wikimedia.org/wikipedia/commons/thumb/3/32/OOjs_UI_icon_ref.svg/22px-OOjs_UI_icon_ref.svg.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: "==Einzelnachweise==\n<references />",
						'ownline': true
					}
				}
			},
			"templates": {
				label: 'Vorlagen',
				type: 'select',
				list: {
                    'youtube' : {
                        label: 'YouTube',
						action: {
							type: 'encapsulate',
							options: {
								pre: '{{YouTube |YouTube-Kennung }}'
							}
						}
					},
                    'videor' : {
                        label: 'Video (fremd)',
						action: {
							type: 'encapsulate',
							options: {
								pre: '{{Video |url=URL der Datei |width=425 |height=355 }}'
							}
						}
					},
                    'videol' : {
                        label: 'Video (eigen)',
						action: {
							type: 'encapsulate',
							options: {
								pre: '{{Video |name=Name URL der Datei |width=425 |height=355 }}'
							}
						}
					},
                    'audior' : {
                        label: 'Audio (fremd)',
						action: {
							type: 'encapsulate',
							options: {
								pre: '{{Audio |url=URL der Datei }}'
							}
						}
					},
					'audiol' : {
                        label: 'Audio (eigen)',
						action: {
							type: 'encapsulate',
							options: {
								pre: '{{Audio |name=Name der Datei }}'
							}
						}
					},
				}
			}
		}
	});
};

/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -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 );
		}
	} );
}

// </nowiki>

//  </nowiki>
Les cookies nous aident à fournir nos services. En utilisant nos services, vous acceptez notre utilisation de cookies.