|
|||||||||
| PREV CLASS NEXT CLASS | |||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Object | +--PramukhPhoneticHandler
PramukhPhoneticHandler is the highly customizable javascript class required for converting any HTML element like textbox, textarea, iframe into Indic IME. It currently supports 9 Indian scripts named Bengali(Assamese, Bengali, Manipuri), Devanagari(Hindi, Marathi, Sanskrit), Gujarati, Gurmukhi(Punjabi), Kannada, Malaylam, Oriya, Tamil and Telugu.
Using 3 lines of code you can enable any Webpage to have Indic IME enabled on it.
<html>Features
<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.convertPageToIndicIME('devanagari');
</script>
</body>
</html>
| Constructor Summary | |
PramukhPhoneticHandler()
|
|
| Method Summary | |
void
|
convertPageToDefault()
Turns off the global mode and converts all textbox/textarea elements on Web page back to normal and removes Indic IME functionlity. |
void
|
convertPageToIndicIME(<String> ScriptName, <Function> Callback, <String> ExceptionList, <Boolean> DefaultEvent)
Turns on the global mode to converts all textbox/textarea elements on a Web page into Indic IME. |
void
|
convertToDefault(<String> ElementName)
Converts single element on Web page back to normal and removes Indic IME functionlity. |
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 method returns the Event Object. |
Object
|
getScript(<String> ElementName)
Gets the currently set script name for an element. |
Object
|
keydownHandler(<String> ElementName, <Event> Evt)
Manually assign the keyown event of HTML element. |
Object
|
keypressHandler(<String> ElementName, <Event> Evt)
Manually assign the keypress event of HTML element. |
void
|
onScriptChange(<String> ElementName, <Function> cbName)
Specifies the callback method to call when script is toggled to and from English internally due to toggle key press. |
void
|
setGlobalScript(<String> ScriptName)
Sets specified script to all Indic IME elements. |
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 |
void convertPageToDefault()
void convertPageToIndicIME(<String> ScriptName, <Function> Callback, <String> ExceptionList, <Boolean> DefaultEvent)
ScriptName - (Optional) It can be one of 9 Indian script name. Default is English.
Callback - (Optional) Callback method
ExceptionList - (Optional) Comma separated list of ids which you don't want to convert
DefaultEvent - If True, library will itself attach the keypress and keydown event to document object. If False, developer has to manually handle keypress and keydown event and call PramukhPhoneticHandler.keypressHandler() and PramukhPhoneticHandler.keydownHandler() methods with ElementName as "_globalIndicIME"
void convertToDefault(<String> ElementName)
ElementName - Element's name which you want to remove
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'),'devanagari');
pph.convertToIndicIME('My_name',document.getElementById('first_name'),'devanagari',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() methods 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> Evt)
ElementName - Element's name
Evt - Event object
Object keypressHandler(<String> ElementName, <Event> Evt)
ElementName - Element's name
Evt - Event object
void onScriptChange(<String> ElementName, <Function> cbName)
ElementName - Element's name
cbName - Callback method
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.
|
|||||||||
| PREV CLASS NEXT CLASS | |||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||