Benutzer:Taurec/common.js: Unterschied zwischen den Versionen

Aus Schauungen, Visionen & Prophezeiungen
Keine Bearbeitungszusammenfassung
 
(kein Unterschied)

Aktuelle Version vom 12. November 2017, 10:45 Uhr

var customizeToolbar = function() {
	/* Your code goes here */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'main',
	'groups': {
		'custom': {
			'label': 'Eigene' // or use labelMsg for a localized label, see above
		}
	}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'main',
	'group': 'custom',
	'tools': {
		'firstquotation': {
			label: '„“',
			type: 'button',
			icon: 'https://schauungen.de/wiki/extensions/WikiEditor/modules/images/toolbar/quote1.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "„",
					post: "“"
				}
			}
		},
		'secondquotation': {
			label: '‚‘',
			type: 'button',
			icon: 'https://schauungen.de/wiki/extensions/WikiEditor/modules/images/toolbar/quote2.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "‚",
					post: "‘"
				}
			}
		},
		'gedankenstrich': {
			label: 'Gedankenstrich',
			type: 'button',
			icon: 'https://schauungen.de/wiki/extensions/WikiEditor/modules/images/toolbar/gedankenstrich.png',
			action: {
				type: 'replace',
				options: {
					peri: " – "
				}
			}
		},
		'apostroph': {
			label: 'Apostroph',
			type: 'button',
			icon: 'https://schauungen.de/wiki/extensions/WikiEditor/modules/images/toolbar/apostroph.png',
			action: {
				type: 'replace',
				options: {
					peri: "’"
				}
			}
		},
		'dots': {
			label: '…',
			type: 'button',
			icon: 'https://schauungen.de/wiki/extensions/WikiEditor/modules/images/toolbar/dots.png',
			action: {
				type: 'replace',
				options: {
					peri: "…"
				}
			}
		},
		'break': {
			label: 'Zeilenumbruch',
			type: 'button',
			icon: 'https://schauungen.de/wiki/extensions/WikiEditor/modules/images/toolbar/break.png',
			action: {
				type: 'replace',
				options: {
					peri: "<br>"
				}
			}
		},
		'blockquote': {
			label: 'Blockzitat',
			type: 'button',
			icon: 'https://schauungen.de/wiki/extensions/WikiEditor/modules/images/toolbar/blockzitat.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "<blockquote><poem>",
					post: "</poem></blockquote>"
				}
			}
		}
	}
} );
};

/* 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', 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.toolbar' ), $.ready
			).then( customizeToolbar );
		}
	} );
}
// Add the customizations to LiquidThreads' edit toolbar, if available
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );