MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus Sandboxgamer
(Die Seite wurde neu angelegt: „if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) { // Add a hook handler. mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) { // Configure a new toolbar entry on the given $textarea jQuery object. $textarea.wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "strikethrough": { label: 'Strike', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commo…“)
 
 
(17 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 4: Zeile 4:
// Configure a new toolbar entry on the given $textarea jQuery object.
// Configure a new toolbar entry on the given $textarea jQuery object.
$textarea.wikiEditor( 'addToToolbar', {
$textarea.wikiEditor( 'addToToolbar', {
section: 'main',
group: 'format',
tools: {
"Underline": {
label: 'Underline',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/f/fd/Button_underline.png',
action: {
type: 'encapsulate',
options: {
pre: "<u>",
post: "</u>"
}
}
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
section: 'advanced',
section: 'advanced',
group: 'format',
group: 'format',
Zeile 17: Zeile 34:
pre: "<s>",
pre: "<s>",
post: "</s>"
post: "</s>"
}
}
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"Break": {
label: 'Break',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/c/c5/Button_br.png',
action: {
type: 'encapsulate',
options: {
pre: "<br>",
}
}
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"code": {
label: 'Code',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/2/23/Button_code.png',
action: {
type: 'encapsulate',
options: {
pre: "<code>",
post: "</code>"
}
}
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"Category": {
label: 'Category',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/b/b4/Button_category03.png',
action: {
type: 'encapsulate',
options: {
pre: "[[Category:",
post: "]]"
}
}
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"Blockquotes": {
label: 'Blockquotes',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/2/23/Quotes-Lithuanian.png',
action: {
type: 'encapsulate',
options: {
pre: "<blockquote>",
post: "</blockquote>"
}
}
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"span": {
label: 'Span',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/7/72/Button_span_2.png',
action: {
type: 'encapsulate',
options: {
pre: "<span>",
post: "</span>"
}
}
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"pre": {
label: 'Pre',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/3/3c/Button_pre.png',
action: {
type: 'encapsulate',
options: {
pre: "<pre>",
post: "</pre>"
}
}
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"ref": {
label: 'Ref',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/2/2b/Button_ref_inscription.png',
action: {
type: 'encapsulate',
options: {
pre: "<ref>",
post: "</ref>"
}
}
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"Line": {
label: 'Line',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/0/0d/Button_hr.png',
action: {
type: 'encapsulate',
options: {
pre: "----",
}
}
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"comment": {
label: 'Comment',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/1/1b/Button_hide_wiki_tag.png',
action: {
type: 'encapsulate',
options: {
pre: "<!-- ",
post: " -->"
}
}
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"MagicWords": {
label: 'MagicWords',
type: 'select',
list: {
'NOTOC': {
label: 'Kein Inhaltsverzeichniss (Iv)',
action: {
type: 'encapsulate',
options: {
pre: '__NOTOC__'
}
}
},
'FORCETOC': {
label: 'Iv normale Position erzwingen',
action: {
type: 'encapsulate',
options: {
pre: '__FORCETOC__'
}
}
},
'TOC': {
label: 'Iv hier plazieren',
action: {
type: 'encapsulate',
options: {
pre: '__TOC__'
}
}
},
'NOEDITSECTION': {
label: 'Abschnitt bearbeiten aus',
action: {
type: 'encapsulate',
options: {
pre: '__NOEDITSECTION__'
}
}
},
'NEWSECTIONLINK': {
label: 'Link "Neuer Abschnitt"',
action: {
type: 'encapsulate',
options: {
pre: '__NEWSECTIONLINK__'
}
}
},
'NONEWSECTIONLINK': {
label: 'Link "Neuer Abschnitt" löschen',
action: {
type: 'encapsulate',
options: {
pre: '__NONEWSECTIONLINK__'
}
}
}
}
}
}

Aktuelle Version vom 16. Februar 2022, 15:00 Uhr

if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
	// Add a hook handler.
	mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
		// Configure a new toolbar entry on the given $textarea jQuery object.
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'main',
			group: 'format',
			tools: {
				"Underline": {
					label: 'Underline',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/f/fd/Button_underline.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "<u>",
							post: "</u>"
						}
					}
				}
			}
		} );
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
				"strikethrough": {
					label: 'Strike',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "<s>",
							post: "</s>"
						}
					}
				}
			}
		} );
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'insert',
			tools: {
				"Break": {
					label: 'Break',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/c/c5/Button_br.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "<br>",
						}
					}
				}
			}
		} );
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'insert',
			tools: {
				"code": {
					label: 'Code',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/2/23/Button_code.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "<code>",
							post: "</code>"
						}
					}
				}
			}
		} );
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'insert',
			tools: {
				"Category": {
					label: 'Category',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/b/b4/Button_category03.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "[[Category:",
							post: "]]"
						}
					}
				}
			}
		} );
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'insert',
			tools: {
				"Blockquotes": {
					label: 'Blockquotes',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/2/23/Quotes-Lithuanian.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "<blockquote>",
							post: "</blockquote>"
						}
					}
				}
			}
		} );
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'insert',
			tools: {
				"span": {
					label: 'Span',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/7/72/Button_span_2.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "<span>",
							post: "</span>"
						}
					}
				}
			}
		} );
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'insert',
			tools: {
				"pre": {
					label: 'Pre',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/3/3c/Button_pre.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "<pre>",
							post: "</pre>"
						}
					}
				}
			}
		} );
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'insert',
			tools: {
				"ref": {
					label: 'Ref',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/2/2b/Button_ref_inscription.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "<ref>",
							post: "</ref>"
						}
					}
				}
			}
		} );
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'insert',
			tools: {
				"Line": {
					label: 'Line',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/0/0d/Button_hr.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "----",
						}
					}
				}
			}
		} );
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'insert',
			tools: {
				"comment": {
					label: 'Comment',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/1/1b/Button_hide_wiki_tag.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "<!-- ",
							post: " -->"
						}
					}
				}
			}
		} );
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'insert',
			tools: {
				"MagicWords": {
					label: 'MagicWords',
					type: 'select',
					list: {
						'NOTOC': {
							label: 'Kein Inhaltsverzeichniss (Iv)',
							action: {
								type: 'encapsulate',
								options: {
									pre: '__NOTOC__'
								}
							}
						},
						'FORCETOC': {
							label: 'Iv normale Position erzwingen',
							action: {
								type: 'encapsulate',
								options: {
									pre: '__FORCETOC__'
								}
							}
						},
						'TOC': {
							label: 'Iv hier plazieren',
							action: {
								type: 'encapsulate',
								options: {
									pre: '__TOC__'
								}
							}
						},
						'NOEDITSECTION': {
							label: 'Abschnitt bearbeiten aus',
							action: {
								type: 'encapsulate',
								options: {
									pre: '__NOEDITSECTION__'
								}
							}
						},
						'NEWSECTIONLINK': {
							label: 'Link "Neuer Abschnitt"',
							action: {
								type: 'encapsulate',
								options: {
									pre: '__NEWSECTIONLINK__'
								}
							}
						},
						'NONEWSECTIONLINK': {
							label: 'Link "Neuer Abschnitt" löschen',
							action: {
								type: 'encapsulate',
								options: {
									pre: '__NONEWSECTIONLINK__'
								}
							}
						}
					}
				}
			}
		} );
	} );
}