|
|||||||||
| PREV CLASS NEXT CLASS | |||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Object | +--PramukhPhoneticHandler
PramukhPhoneticHandler is the class required for converting any HTML element
like textbox, textarea, iframe into Indic IME. It currently supports 9 Indian
scripts named Bengali, Devnagari, Gujarati, Gurmukhi, Kannada, Malayalam,
Oriya, Tamil and Telugu. Using 3 lines of code you can enable any Webpage to
have Indic IME enabled on it.
<html>
<head>
<script type="text/javascript" src="js/pramukhlib.js"></script>
</head>
<body>
<input type="text" id="first_name">
<script language="javascript">
var pph = new PramukhPhoneticHandler();
pph.convertAllToIndicIME('devnagari');
</script>
</body>
</html>
| Constructor Summary | |
PramukhPhoneticHandler()
|
|
| Method Summary | |
Object
|
convertAllToIndicIME(<String>
ScriptName, <Function> Callback)
Converts all textbox and textarea elements into Indic IME. |
void
|
convertToIndicIME(<String>
ElementName, <Object> ElementObject, <String> ScriptName,
<Boolean> DefaultEvent)
Convert a specified element into Indic IME. |
Object
|
getEventObject(<String>
ElementName, <Event> DefaultEventObject)
Depending on the browser and type of HTML element, this function returns the Event Object |
Object
|
getScript(<String> ElementName)
Gets the currently set script name for an element |
Object
|
keydownHandler(<String>
ElementNam<Event> e, e)
Manually assign the keyown event of HTML element. |
Object
|
keypressHandler(<String>
ElementNam<Event> e, e)
Manually assign the keypress event of HTML element. |
void
|
onScriptChange(<String>
ElementName, <Function> cbName)
Specifies the callback function to call when script is changed internally due to toggle key press. |
void
|
setGlobalScript(<String>
ScriptName)
Sets specified script to all elements added in the objects |
void
|
setScript(<String> ElementName,
<String> ScriptName)
Sets new script for the specified element |
void
|
setToggleKey(<int> Key)
Sets the shortcut key to switch between Indic script and English. |
| Constructor Detail |
PramukhPhoneticHandler()
| Method Detail |
Object convertAllToIndicIME(<String> ScriptName, <Function> Callback)
ScriptName - (Optional) It can be one of 9 Indian script name.
Default is English.
Callback - (Optional) Callback function
void convertToIndicIME(<String> ElementName, <Object> ElementObject, <String> ScriptName, <Boolean> DefaultEvent)
pph.convertToIndicIME('first_name'); OR
pph.convertToIndicIME('My_name',document.getElementById('first_name')); OR
pph.convertToIndicIME('My_name',document.getElementById('first_name'),'devnagari');
pph.convertToIndicIME('My_name',document.getElementById('first_name'),'devnagari',false);
if (Internet Explorer)
{
document.getElementById('first_name').onkeypress = function (e) { pph.keypressHandler('My_name',e);}
document.getElementById('first_name').onkeydown = function (e) { pph.keydownHandler('My_name',e);}
}
else
{
document.getElementById('first_name').addEventListener("keypress",function (e) { pph.keypressHandler('My_name',e);}, true);
document.getElementById('first_name').addEventListener("keydown",function (e) { pph.keydownHandler('My_name',e);}, true);
}
ElementName - Element's name. You may pass element id/string of
your choice/null(random name starting with "indicime_" will be generated). If
ElementObject is not provided, ElementObject is assumed to be existing in DOM
with id as ElementName
ElementObject - (Optional) Element's actual object. You can get
this object by executing document.getElementById('ElementID')
ScriptName - (Optional) It can be one of 9 Indian script name.
Default is English.
DefaultEvent - If True, library will itself attach the keypress
and keydown event to ElementObject. If False, developer has to manually handle
keypress and keydown event and call
PramukhPhoneticHandler.keypressHandler() and
PramukhPhoneticHandler.keydownHandler() functions with necessary
arguments
Object getEventObject(<String> ElementName, <Event> DefaultEventObject)
ElementName - Element's name
DefaultEventObject - Default event object resulting from a
keyboard event
Object getScript(<String> ElementName)
ElementName - Element's name whose current script you want to get
Object keydownHandler(<String> ElementName, <Event> e)
ElementName - Element's name
e - Event object
Object keypressHandler(<String> ElementName, <Event> e)
ElementName - Element's name
e - Event object
void onScriptChange(<String> ElementName, <Function> cbName)
ElementName - Element's name
cbName - Callback function
void setGlobalScript(<String> ScriptName)
ScriptName - It can be one of 9 Indian script name. Default is
English.
void setScript(<String> ElementName, <String> ScriptName)
ElementName - Name of the element for which you want to change
script
ScriptName - New script name. It must be one of the 9 Indian
script name otherwise it will set to English.
void setToggleKey(<int> Key)
Key - Key Code in KeyDown event. Default value is 123 (F12 Key)
|
|||||||||
| PREV CLASS NEXT CLASS | |||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||