MediaWiki:Common.js: Difference between revisions

From JJSWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 48: Line 48:
$textarea.wikiEditor( 'addToToolbar', {
$textarea.wikiEditor( 'addToToolbar', {
sections: {
sections: {
emoticons: {
templates: {
type: 'booklet', // Can also be 'booklet',
type: 'booklet', // Can also be 'toolbar',
label: 'Emoticons'
label: 'Templates'
// or labelMsg: 'section-emoticons-label' for a localized label
// or labelMsg: 'section-templates-label' for a localized label
}
}
}
}
Line 66: Line 66:
mfaces: {
mfaces: {
label: 'mFaces' // or use labelMsg for a localized label, see above
label: 'mFaces' // or use labelMsg for a localized label, see above
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
section: 'emoticons',
group: 'faces',
tools: {
smile: {
label: 'Smile!', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'encapsulate',
options: {
pre: ":)" // text to be inserted
}
}
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
section: 'emoticons',
group: 'lfaces',
tools: {
smile: {
label: 'Emile!', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'encapsulate',
options: {
pre: ":)" // text to be inserted
}
}
}
}
}
}

Revision as of 21:49, 17 April 2023

/* Any JavaScript here will be loaded for all users on every page load. */

// Check if we're editing a page.
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.
		//Begin all the $textarea.wikiEditor stuff
		
$textarea.wikiEditor( 'addToToolbar', {
		section: 'advanced',
		group: 'format',
		tools: {
			comment: {
				label: 'Comment',
				type: 'button',
				icon: 'https://upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<!-- ',
						post: ' -->'
					}
				}
			}
		}
	} );

$textarea.wikiEditor( 'addToToolbar', {
		section: 'advanced',
		group: 'format',
		tools: {
			hline: {
				label: 'Horizontal line',
				type: 'button',
				icon: 'https://upload.wikimedia.org/wikipedia/commons/a/a4/H-line_icon.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '----',
						ownline: true
					}
				}
			}
		}
	} );
	
$textarea.wikiEditor( 'addToToolbar', {
	sections: {
		templates: {
			type: 'booklet', // Can also be 'toolbar',
			label: 'Templates'
			// or labelMsg: 'section-templates-label' for a localized label
		}
	}
} );
$textarea.wikiEditor( 'addToToolbar', {
	section: 'emoticons',
	groups: {
		faces: {
			label: 'Faces' // or use labelMsg for a localized label, see above
		},
		lfaces: {
			label: 'lFaces' // or use labelMsg for a localized label, see above
		},
		mfaces: {
			label: 'mFaces' // or use labelMsg for a localized label, see above
		}
	}
} );
$textarea.wikiEditor( 'addToToolbar', {
	section: 'emoticons',
	group: 'mfaces',
	pages: {
		katakana: {
			layout: 'characters',
			label: 'Katakana',
			characters: [  '{{dsa|birth=|death=}}', '{{dsa|birth=|birthphrase=|death=|deathphrase=}}', 'ァ', 'ア', 'ィ', 'イ', 'ゥ', 'ウ', 'ェ', 'エ', 'ォ', 'オ', 'カ', 'ガ', 'キ', 'ギ', 'ク', 'グ', 'ケ', 'ゲ', 'コ', 'ゴ', 'サ', 'ザ', 'シ', 'ジ', 'ス', 'ズ', 'セ', 'ゼ', 'ソ', 'ゾ', 'タ', 'ダ', 'チ', 'ヂ', 'ッ', 'ツ', 'ヅ', 'テ', 'デ', 'ト', 'ド', 'ナ', 'ニ', 'ヌ', 'ネ', 'ノ', 'ハ', 'バ', 'パ', 'ヒ', 'ビ', 'ピ', 'フ', 'ブ', 'プ', 'ヘ', 'ベ', 'ペ', 'ホ', 'ボ', 'ポ', 'マ', 'ミ', 'ム', 'メ', 'モ', 'ャ', 'ヤ', 'ュ', 'ユ', 'ョ', 'ヨ', 'ラ', 'リ', 'ル', 'レ', 'ロ', 'ヮ', 'ワ', 'ヰ', 'ヱ', 'ヲ', 'ン', 'ヴ', 'ヵ', 'ヶ', '゛', '゜', 'ー' ]
		}
	}
} );

$textarea.wikiEditor( 'addToToolbar', {
	section: 'emoticons',
	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}}'
								}
							}
						}
					}
				}
			}
		}
	}
} );

$textarea.wikiEditor( 'addToToolbar', {
	section: 'characters',
	pages: {
		emoticons: {
			layout: 'characters',
			label: 'Emoticons',
			characters: [ ':)', ':))', ':(', '<3', ';)' ]
		}
	}
} );

$textarea.wikiEditor( 'addToToolbar', {
	section: 'characters',
	pages: {
		hiragana: {
			layout: 'characters',
			label: 'Hiragana',
			characters: [ 'ぁ', 'あ', 'ぃ', 'い', 'ぅ', 'う', 'ぇ', 'え', 'ぉ', 'お', 'か', 'が', 'き', 'ぎ', 'く', 'ぐ', 'け', 'げ', 'こ', 'ご', 'さ', 'ざ', 'し', 'じ', 'す', 'ず', 'せ', 'ぜ', 'そ', 'ぞ', 'た', 'だ', 'ち', 'ぢ', 'っ', 'つ', 'づ', 'て', 'で', 'と', 'ど', 'な', 'に', 'ぬ', 'ね', 'の', 'は', 'ば', 'ぱ', 'ひ', 'び', 'ぴ', 'ふ', 'ぶ', 'ぷ', 'へ', 'べ', 'ぺ', 'ほ', 'ぼ', 'ぽ', 'ま', 'み', 'む', 'め', 'も', 'ゃ', 'や', 'ゅ', 'ゆ', 'ょ', 'よ', 'ら', 'り', 'る', 'れ', 'ろ', 'ゎ', 'わ', 'ゐ', 'ゑ', 'を', 'ん', '゛', '゜', 'ー' ]
		}
	}
} );

$textarea.wikiEditor( 'addToToolbar', {
	section: 'characters',
	pages: {
		katakana: {
			layout: 'characters',
			label: 'Katakana',
			characters: [  'ァ', 'ア', 'ィ', 'イ', 'ゥ', 'ウ', 'ェ', 'エ', 'ォ', 'オ', 'カ', 'ガ', 'キ', 'ギ', 'ク', 'グ', 'ケ', 'ゲ', 'コ', 'ゴ', 'サ', 'ザ', 'シ', 'ジ', 'ス', 'ズ', 'セ', 'ゼ', 'ソ', 'ゾ', 'タ', 'ダ', 'チ', 'ヂ', 'ッ', 'ツ', 'ヅ', 'テ', 'デ', 'ト', 'ド', 'ナ', 'ニ', 'ヌ', 'ネ', 'ノ', 'ハ', 'バ', 'パ', 'ヒ', 'ビ', 'ピ', 'フ', 'ブ', 'プ', 'ヘ', 'ベ', 'ペ', 'ホ', 'ボ', 'ポ', 'マ', 'ミ', 'ム', 'メ', 'モ', 'ャ', 'ヤ', 'ュ', 'ユ', 'ョ', 'ヨ', 'ラ', 'リ', 'ル', 'レ', 'ロ', 'ヮ', 'ワ', 'ヰ', 'ヱ', 'ヲ', 'ン', 'ヴ', 'ヵ', 'ヶ', '゛', '゜', 'ー' ]
		}
	}
} );

$textarea.wikiEditor( 'addToToolbar', {
	section: 'templatessection',
	pages: {
		katakana: {
			layout: 'characters',
			label: 'Katakana',
			characters: [  'ァ', 'ア', 'ィ', 'イ', 'ゥ', 'ウ', 'ェ', 'エ', 'ォ', 'オ', 'カ', 'ガ', 'キ', 'ギ', 'ク', 'グ', 'ケ', 'ゲ', 'コ', 'ゴ', 'サ', 'ザ', 'シ', 'ジ', 'ス', 'ズ', 'セ', 'ゼ', 'ソ', 'ゾ', 'タ', 'ダ', 'チ', 'ヂ', 'ッ', 'ツ', 'ヅ', 'テ', 'デ', 'ト', 'ド', 'ナ', 'ニ', 'ヌ', 'ネ', 'ノ', 'ハ', 'バ', 'パ', 'ヒ', 'ビ', 'ピ', 'フ', 'ブ', 'プ', 'ヘ', 'ベ', 'ペ', 'ホ', 'ボ', 'ポ', 'マ', 'ミ', 'ム', 'メ', 'モ', 'ャ', 'ヤ', 'ュ', 'ユ', 'ョ', 'ヨ', 'ラ', 'リ', 'ル', 'レ', 'ロ', 'ヮ', 'ワ', 'ヰ', 'ヱ', 'ヲ', 'ン', 'ヴ', 'ヵ', 'ヶ', '゛', '゜', 'ー' ]
		}
	}
} );


		//End all the $textarea.wikiEditor stuff-->
	} );
}