Jump to content

WikiEditor

WikiEditor

It seems WikiEditor has recently undergone a change (at least that’s how it feels on Wiktionary.fr). Under "Special Characters", on Wiktionary.fr we used to have two small sets of characters for French and French API. Now "Special Characters" shows several scripts (Latin, Greek, Arabic, Tamil, etc.) and our character subsets are drowned in the Latin and API listings. How can one add customised subsets to WikiEditor (like one can with Edittools)?

Urhixidur (talk)17:43, 15 May 2012

The Vietnamese wikis add a consolidated Vietnamese character page using this code (specifically the functions addVietCharPage() and bindVietCharPage()).

Minh Nguyễn (talk, contribs)10:38, 16 May 2012

Nice try, but I wasn't able to get it to work (mostly because of my cluelessness). I eventually found and adapted another user's custom js as follows:

// Listes de caractères
var api_liste_fr = ["ɑ","ɑ̃","ə","ɛ","œ","ø","ɛ̃","ɔ","ɔ̃","œ̃","ʃ","ɡ","ɥ","ʒ","ɲ","ŋ","ʁ","‿","ː","ˈ","ˌ"] ;
var caracteres_liste_fr = ["’","æ","Æ","€","ñ","œ","Œ","–","—","…"] ;

// Ajout de la section Caractères du Wiktionnaire > API français
hookEvent( 'load', function() {
	$j( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
		'sections': {
			'caracteres': {
				label:'Mes outils',
				type:'booklet',
				deferLoad:true,
				pages: {
					'API_fr': {
						'label':'API français',
						'layout':'characters',
						'characters': api_liste_fr
					},
					'car_fr': {
						'label':'Caractères spéciaux',
						'layout':'characters',
						'characters': caracteres_liste_fr
					}
				}
			}
		}
	} );
} );
Urhixidur (talk)16:40, 17 May 2012

That’ll get you a separate booklet, while the code I suggested adds pages to the existing Special Characters booklet. It probably only works when you put it in a site-wide script like MediaWiki:Common.js/edit.js, rather than in one of your user scripts.

Unfortunately, I can’t test either version at the French Wiktionary because the use of mw.toolbar.insertButton() in MediaWiki:Common.js/edit.js (under “Boutons depuis MW 1.18”) has completely broken the WikiEditor toolbar.

Minh Nguyễn (talk, contribs)16:59, 17 May 2012