User talk:Alex Smotrov/createEditTools

Documentation
This sample Javascript code creates «Edittools», it is proposed as a replacement for the current Mediawiki:Edittools.

Tested in IE6, FireFox 1.5, Opera 9.

How to test the code
javascript:importScript('User:Alex Smotrov/createEditTools');
 * 1st method:
 * go to any edit page
 * paste this into your browser address field and press Enter

importScript('User:Alex Smotrov/createEditTools');
 * 2nd method:
 * start [/index.php?title=Special:Mypage/monobook.js&action=edit editing your monobook.js] file
 * remove all code, paste this, then press Show Preview button

The script should remove all existing Edittols and then recreate them. The new Edittols should look almost identical to the old ones, except first line will be smaller and (polytonic list) link will be misssing.

Some notes on the code
All the characters and tags are defined in  string.

With monobook.js a registered user can:
 * set  to disable everything below «Symbols:»
 * add additional characters and tags to existing
 * create his/her own custom  from the scratch

string consists of tokens which are divided by spaces. Each token is:
 * simple bold text if it starts with _ or ends with :
 * a tag (usually paired) if it contains +
 * a special token:
 * _ → extra &amp;nbsp;
 * __ → &lt;br&gt;
 * ___ → &lt;hr&gt;
 * a string of characters

Tags and characters are converted into «insertable» links.

Known problems:
 * makes first line as small as all other text
 * currently there is no way to insert simple links (like (polytonic list)), but I strongly beilive these links should not be mixed in here because they make browser go to another page
 * some troubles with first two characetrs in «IPA:», the code treats them like 2 separate characters each (are they 4-byte Unicode?), soI had to pretend that they are tags by adding +

Discussion
Any comments and suggestions are welcome — Alex Smotrov 20:26, 8 March 2007 (UTC)