User:Nardog/IPAInput

This script adds a button to the editing toolbar that pops up an IPA key (e.g. Help:IPA/English) where you can pick symbols simply by clicking them in the key—so you don't have to go back and forth between the edit form and the key to figure out which symbols to use and repeat copying and pasting—and inserts the string into the edit form, wrapped in IPA or IPAc-en.

Installation
Add the following to your common.js:

Or you may enable the script installer in and click "Install" in the infobox on this page.

Usage
You have to have done one of the following in order to use this script:
 * Enable the WikiEditor toolbar:
 * Enable the 2017 wikitext editor:
 * Use VisualEditor

A "" icon appears in the editing toolbar (under "Insert" if you're using the 2017 wikitext editor or VisualEditor). It first opens a configuration form.

Configuration

 * Key
 * Choose a language-specific IPA key under "Help:IPA/...". If you select "(Full IPA chart)", it instead pulls tables from International Phonetic Alphabet chart.


 * Language
 * Determines the first argument to pass to IPA (except for English, in which case IPAc-en is used).


 * No template
 * If this is checked, the transcription will not be wrapped in IPA or IPAc-en.


 * Remember these for next time
 * If this is checked, the same combination of the key and language will be pre-selected next time you open it. The data is stored in your browser's web storage.

Transcription
Hitting "Transcribe" loads the selected key. Any element with the  class in the key becomes clickable.


 * Undo (OOjs UI icon arched-arrow-rtl.svg)
 * Since the system-native undo becomes unavailable every time a symbol is inserted by clicking inside the key, the script implements its own undo function and overrides Ctrl/⌘. There is no redo (sorry!).


 * Insert diacritics only (OOjs UI icon searchDiacritics.svg)
 * Some keys use placeholder letters for illustration of diacritics. This button is useful in such cases. For example, if you click ⟨ǎ⟩ while the button is pressed and the last character before the cursor in the textbox is ⟨e⟩, it becomes ⟨ě⟩ (instead of ⟨eǎ⟩). If the key uses the dotted circle ⟨◌⟩ as a placeholder, however, you don't need the button; clicking ⟨◌̌⟩ will turn ⟨e⟩ into ⟨ě⟩ even if the button isn't pressed.

If the English key is used, the input will be divided according to what is accepted by the IPAc-en template (even if it wasn't chosen in the configuration). Also remember the script doesn't take care of the rest of the template (label and audio).