User:PerfektesChaos/js/editToolStrIns
mw-editTools: Insert characters and strings.
Script to facilitate input of special characters and strings into wiki edit field.
Main target is easy insertion of characters not present on the keyboard, but strings are also subject of desire, like Wiki syntax, HTML tags, template collections or TeX.
The script has been designed to be used on any WMF project in any language environment for any user language skills. Local administration shall benefit from collected wisdom and is able to reuse previous work automatically.
Functionality
editA tool region, usually below the text edit area, is equipped with a gadget for selection of particular character sets or other collections. A menu presents the selected compilation. Each token may be inserted into page when clicked, either as single string at cursor position or enclosing the current selection with a kind of begin and end tags. The target is wpTextbox1, but also wpSummary or text input on forms, depending on which got last focus.
By default text will be inserted only, avoiding text loss. If user presses Ctrl simultaneously, a selected region will be replaced. User defined elements may be equipped to replace something.
Multilingual support
editWithin one project several languages may be supported. The native language of Commons and Meta is English, but users may edit in areas where they are more comfortable with GUI elements in their own language. Users may visit a project as a guest for some reasons; perhaps they even cannot read the foreign script without difficulties.
However, insertion of data is based on the native language of the current project.
Definitions which might be useful for other projects are supposed to be collected and distributed by a unique world wide version of the code. This goes for both character sets and language related GUI translation.
User customization and project adaption
editThe standard appearance may be modified by the user, removing, changing or appending elements. The basic configuration may be adopted by the local project, using a global repository.
Predecessors, Authors, Credits
editProcedural Part
editThe earliest implementation digged out has been
- mw:User:Alex Smotrov/edittools.js February 2008
Various copies and clones have been adopted by users on English Wikipedia.
Further progress was made by
- w:de:User:Revolus from October 2008 until March 2009
That has been adopted by German Wikipedia 2009-02-27:
- de:MediaWiki:Onlyifediting.js
- Improved by w:de:User:WIKImaniac 2009-03-01
Data
editWhile authors of the functional part added some character set collections, many users provided further insertion material.
Other Approaches
edit- MediaWiki
- mw:Extension:CharInsert
- mw:Extension:WikiEditor (mainly single/double characters in square buttons)
- English wikipedia
- commons:MediaWiki:Edittools.js
The WikiEditor style is nice for a limited number of single characters. However, for languages with 100 distinct characters scrolling is required, and the square tiles are too small for strings like template names or syntax elements. The suggested but older approach presents even a large number of characters at one glance, ready for click, and permits grouping and styling.
Further usage
editThe code has been developed and tailored for WMF projects, but the basic functionality may be cut off and could be used anywhere under correct license and origin attribution.
Technical
edit- Details – Reference with glossary and data structures
- Notes for developers
Source code |
|
ResourceLoader |
|
Namespaces | any |
mw.libs
|
editToolStrIns
|
mw.hook
|
editToolStrIns.ready — when gadget loading completedReceiving the application object. |
MediaWiki | ≥ 1.18 |