Thursday, February 14. 2008
Javascript Unicode Keyboard Handler for Thaana
Here's something that is probably going to be very useful to the Maldivian web developers working on Unicode-based Thaana web pages. It is a Javascript utility function that translates keystrokes into the appropriate Unicode Thaana characters. Hence, it makes it possible for HTML text input and textarea fields (and similar) to accept Thaana without having to require the user to switch the keyboard language on their computer. Such a feature contributes for a better user experience as the user can simply enter Dhivehi without the extra hassle. The code has been tested with no problems found on Firefox 1/2/3 and Internet Explorer 5/6/7.
If you would like a demo, I recommend you check out the text entry box at Radheef.com and see the HTML behind it. A few developers seem to have already adopted my code as at Radheef.com and utilized it in their work - haamadaily.com, sangudaily.com and jazeera.com.mv and haveeru.com.mv is using the code far as I know.
I originally wrote this around 2002 while experimenting with different methods of Thaana entry for the web. The version I'm releasing here, marked as version 2.0, is a modified version from 2006. It is being released under the MIT License.
- Download unicodehandler-2.0.js
2. Attach the handler to any text INPUT, TEXTAREA or editable DIV tag:
3. Set any Unicode-compatible Dhivehi font to be used for the field using CSS.
4. That's it!
Drop a line here if you use it and/or have problems. Enjoy.
Update (16-Aug-2008): This version is now superseded by the new and improved v3.0.
If you would like a demo, I recommend you check out the text entry box at Radheef.com and see the HTML behind it. A few developers seem to have already adopted my code as at Radheef.com and utilized it in their work - haamadaily.com, sangudaily.com and jazeera.com.mv and haveeru.com.mv is using the code far as I know.
I originally wrote this around 2002 while experimenting with different methods of Thaana entry for the web. The version I'm releasing here, marked as version 2.0, is a modified version from 2006. It is being released under the MIT License.
- Download unicodehandler-2.0.js
Usage
1. Link the file in the HEAD section of the page:<script type="text/javascript" src="/unicodehandler.js"></script>
2. Attach the handler to any text INPUT, TEXTAREA or editable DIV tag:
<textarea rows="1" onkeypress="return juk_HandleKeyPress(event);"></textarea>
3. Set any Unicode-compatible Dhivehi font to be used for the field using CSS.
4. That's it!
Drop a line here if you use it and/or have problems. Enjoy.
Update (16-Aug-2008): This version is now superseded by the new and improved v3.0.