User talk:Alex Smotrov/createEditTools
Latest comment: 17 years ago by Alex Smotrov in topic Discussion
Documentation
editThis 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
edit- 1st method:
- go to any edit page
- paste this into your browser address field and press Enter
javascript:importScript('User:Alex Smotrov/createEditTools');
- 2nd method:
- start editing your monobook.js file
- remove all code, paste this, then press Show Preview button
importScript('User:Alex Smotrov/createEditTools');
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
editAll the characters and tags are defined in charinsert
string.
With monobook.js
a registered user can:
- set
noAdditionalChars = true
to disable everything below «Symbols:» - add additional characters and tags to existing
charinsert
- create his/her own custom
charinsert
from the scratch
charinsert
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
- __ → <br>
- ___ → <hr>
- 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
editAny comments and suggestions are welcome — Alex Smotrov 20:26, 8 March 2007 (UTC)