Resources » TypeScript » Scripting Languages » Javascript

Punjabi Editor


Posted Date: 20-Apr-2009  Last Updated:   Category: Javascript    
Author: Member Level: Gold    Points: 30



Punjabi Editor

In Today’s scenario the web is changing its meaning and the web are also offered in the regional languages also… so is the your question
Well the characters are based on Unicode so we need two js files here one I will call as common.js and other will be Punjabi.js

This will be common.js

var isIE = document.all?true:false;
var myimg = new Image();
var sPos = 0;
var isTh = false;
var isNg = false;
var kbmode = "roman";
var pkbmode = "roman";
var SplKeys = new Array();
var toShowHelp = true;
var webhome = "http://www.msdotnetmentor.com";

SplKeys["ZR"] = 0;
SplKeys["BS"] = 8;
SplKeys["CR"] = 13;

function incfont(fontname, fontfile)
{
if(isIE)
document.write(" < STY"+"LE TYPE='text/css' > \n < !--\n@font-face {\n"
+ "font-family: "+fontname+";\nsrc:url("+fontfile+".eot);\n"
+ "}\n-- > \n < /ST"+"YLE > ")
}

function getStyleObject(objectId)
{
// cross-browser function to get an object's style object given its
if(document.getElementById && document.getElementById(objectId)) {
// W3C DOM
return document.getElementById(objectId).style;
} else if (document.all && document.all(objectId)) {
// MSIE 4 DOM
return document.all(objectId).style;
} else if (document.layers && document.layers[objectId]) {
// NN 4 DOM.. note: this won't find nested layers
return document.layers[objectId];
} else {
return false;
}
} // getStyleObject


function showMap(obj)
{
if(!obj.checked)
{ hideMap(); return; }

if(document.getElementById('KeyMapDiv') == null)
{
mapdiv = document.createElement('div');
mapdiv.setAttribute('id','KeyMapDiv');
mapdiv.setAttribute('align','left');
mapdiv.onmousedown = downMap;
mapdiv.onmouseup = upMap;
bdy = document.getElementsByTagName('BODY')[0];
bdy.appendChild(mapdiv);

mapstyle = getStyleObject('KeyMapDiv');
mapstyle.width = '140px';
mapstyle.backgroundColor= '#FFFFFF';
mapstyle.position = 'absolute';
mapstyle.cursor = 'move';
}
else
{
mapdiv = document.getElementById('KeyMapDiv');
mapstyle = getStyleObject('KeyMapDiv');
}
mapdiv.innerHTML = ' < table border="0" cellpadding="0" cellspacing="0" style="border:3px solid #0e88af;background-color:#ffffff;width:100%;" > < tr > '
+' < td style="background-color:#0e88af;color:#ffffff;" nowrap="nowrap" > < b >  Keypad Map - '
+lang.substring(0,1).toUpperCase() + lang.substring(1)+' < /b > < /td > < td bgcolor="#0e88af" nowrap="nowrap" width="20" align="right" > '
+' < div align="right" onclick="hideMap()" style="padding:2px;width:20px;text-align:right;background-color:#0e88af;color:#ffffff;cursor:default" > '
+' < b >   X   < /b > < /div > < /td > < /tr > < tr > < td colspan="2" align="center" > < img name="KeyMap" src='+myimg.src
+' style="display:block" > < /td > < /tr > < /table > ';
mapstyle.left = '100px';
if(isIE)
{ mapstyle.pixelTop = document.body.scrollTop+100; }
else
{ mapstyle.top = window.pageYOffset+100+"px"; }
mapstyle.display = 'inline';
}

function moveMap(e)
{
mapdiv = document.getElementById('KeyMapDiv');
mapstyle = getStyleObject('KeyMapDiv');

if (!e) e = window.event;
if (dragok)
{
if (isIE) { mapstyle.left = dx + e.clientX - tempX + "px"; mapstyle.top = dy + e.clientY - tempY + "px"; }
else { mapstyle.left = dx + e.pageX - tempX + "px"; mapstyle.top = dy + e.pageY - tempY + "px"; }
return false;
}
}

var dx,dy,tempX,tempY;
var dragok = false;
var n = 500;

function downMap(e)
{
mapdiv = document.getElementById('KeyMapDiv');
mapstyle = getStyleObject('KeyMapDiv');
dragok = true;
mapstyle.zIndex = n++;
dx = parseInt(mapstyle.left+0);
dy = parseInt(mapstyle.top+0);
if (!e) e = window.event;
if (isIE) { tempX = e.clientX; tempY = e.clientY;}
else { tempX = e.pageX; tempY = e.pageY; }

document.onmousemove = moveMap;

return false;
}

function upMap()
{
dragok = false;
document.onmousemove = null;
}

function hideMap()
{
mapstyle = getStyleObject('KeyMapDiv');
mapstyle.display = 'none';
}

function convertThis(e,numchar)
{
if (!isIE)
Key = e.which;
else
Key = e.keyCode;

Char = String.fromCharCode(Key);
if(typeof numchar == "undefined")
numchar = 4;
if( isIE )
{
myField = e.srcElement;
myField.caretPos = document.selection.createRange().duplicate();
prevChar = myField.caretPos.text;
diff = 0;
cpos = getCursorPosition(myField);
if(prevChar.length != 0)
document.selection.clear();
if(myField.value.length != 0 && cpos != "1,1" )
{
myField.caretPos.moveStart('character',-1);
prevChar = myField.caretPos.text;
diff ++;
}
if(prevChar == chnbin)
{
myField.caretPos.moveStart('character',-1);
prevChar = myField.caretPos.text;
diff ++;
}

if(cpos[1] > numchar )
{
myField.caretPos.moveStart('character', diff - numchar);
prevChar = myField.caretPos.text;
}
if(prevChar == "" && cpos != "1,1")
prevChar = "\u000A";
if(Key == 13)
Char = "\u000A";
myField.caretPos.text = getLang(prevChar,Char, 0)
e.cancelBubble = true;
e.returnValue = false;
}
else
{
myField = e.target;
if( myField.selectionStart > = 0)
{
if(isSplKey(Key) || e.ctrlKey )
return true;
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
txtTop = myField.scrollTop;
if(myField.value.length == 0)
{
prevChar = "";
myField.value = getLang(prevChar,Char, startPos)
}
else
{
prevChar = myField.value.substring(startPos - 1,startPos);
prevStr = myField.value.substring(0,startPos - 1);
if(prevChar == chnbin)
{
prevChar = myField.value.substring(startPos - 2,startPos);
prevStr = myField.value.substring(0,startPos - 2);
}
cpos = getCursorPosition(myField);
if(cpos[1] > = numchar)
{
prevChar = myField.value.substring(startPos - numchar,startPos);
prevStr = myField.value.substring(0,startPos - numchar);
}
myField.value = prevStr + getLang(prevChar,Char, myField.selectionStart)
+ myField.value.substring(endPos, myField.value.length);
}
myField.selectionStart = sPos ;
myField.selectionEnd = sPos;
if((myField.scrollHeight+4)+"px" != myField.style.height)
myField.scrollTop = txtTop;
e.stopPropagation();
e.preventDefault();
}
}
showCombi(e)
}

function toggleT(obj)
{
isTh = obj.checked;
if(isTh)
ta['t'] = "\u0BA4\u0BCD";
else
ta['t'] = "\u0B9F\u0BCD";
}

function toggleG(obj)
{
isNg = obj.checked;
if(isNg)
ta['g'] = "\u0B99\u0BCD";
else
ta['g'] = "\u0B95\u0BCD"
}

function toggleKBMode(e,obj)
{
if(obj != null)
{
pkbmode = kbmode;
kbmode = obj.value;
if(kbmode == "typewriter" && lang != 'english')
myimg.src = webhome+"/images/ucedit/"+lang+"tw.png";
else if(kbmode == "tamil99")
myimg.src = webhome+"/images/ucedit/tamil99.png";
else
myimg.src = webhome+"/images/ucedit/"+lang+".png";
}
else
{
if (!isIE)
key = e.which;
else
key = e.keyCode;
if (key == 123)
{
if(kbmode != "english")
{
pkbmode = kbmode;
kbmode = "english";
}
else
{
kbmode = pkbmode;
pkbmode = "english";
}
}

}
}

function isSplKey(keynum)
{
retVal = false;
for(i in SplKeys)
{
if(keynum == SplKeys[i])
retVal = true;
}
return retVal;
}

function getLang(prv, txt, sP)
{
sPos = sP;
if(kbmode == "english")
{
retTxt = prv+txt;
sPos ++;
}
else if(kbmode == "typewriter")
{
if(prv == ugar && mapLang(txt,sP,"tw") == uugar)
retTxt = mapLang(prv+txt,sP,"tw");
else
retTxt = prv+mapLang(txt,sP,"tw");
}
else if(kbmode == "tamil99")
{
retTxt = mapLang(prv+txt,sP,"t99");
}
else
{
if(pkbmode == "english")
{
retTxt = prv+mapLang(txt);
pkbmode = "roman";
}
else
retTxt = mapLang(prv+txt);
}
return retTxt;
}

function mapLang(txt,sP,mod)
{
if(sP != null)
sPos = sP;
prvlen = txt.length;
txtarr = eval(lang.substring(0,2));
if(mod != null && mod == "tw")
txtarr = eval(lang.substring(0,2)+"tw");
if(mod != null && mod == "t99")
txtarr = eval(lang.substring(0,2)+"99");
retTxt = "";
for(itm in txtarr)
{
rexp = new RegExp(itm,"g");
txt = txt.replace(rexp, txtarr[itm]);
}
sPos += (txt.length -prvlen +1);
return txt;
}

function getCursorPosition(textarea)
{
var txt = textarea.value;
var len = txt.length;
var erg = txt.split("\n");
var pos = -1;
if(typeof document.selection != "undefined")
{ // FOR MSIE
range_sel = document.selection.createRange();
range_obj = textarea.createTextRange();
range_obj.moveToBookmark(range_sel.getBookmark());
range_obj.moveEnd('character',textarea.value.length);
pos = len - range_obj.text.length;
}
else if(typeof textarea.selectionStart != "undefined")
{ // FOR MOZILLA
pos = textarea.selectionStart;
}
if(pos != -1)
{
for(ind = 0;ind < erg.length;ind++)
{
len = erg[ind].length + 1;
if(pos < len)
break;
pos -= len;
}
ind++; pos++;
return [ind, pos]; // ind = LINE, pos = COLUMN
}
}

function showCombi(e)
{
if(document.getElementById('HelpDiv') == null)
{
helpdiv = document.createElement('div');
helpdiv.setAttribute('id','HelpDiv');
helpdiv.setAttribute('align','left');
if(isIE)
{
bdy = e.srcElement.parentNode;
bdy.insertBefore(helpdiv, e.srcElement);
}
else
{
bdy = e.target.parentNode;
bdy.insertBefore(helpdiv, e.target);
}

}
else
{
helpdiv = document.getElementById('HelpDiv');
}
helpstyle = getStyleObject('HelpDiv');
if(!toShowHelp || kbmode != 'roman')
{ helpstyle.display = 'none'; return; }

prevWord = getLang(prevChar,Char,0)
if(isLangOtru(prevWord.substring(prevWord.length - 1)))
prevWord = prevWord.substring(prevWord.length - 2)
else
prevWord = prevWord.substring(prevWord.length - 1)

helptxt = "";
prevLet = getLang(prevWord,Char,0); prevLet = prevLet.substring(prevLet.length - 1);
if( prevWord != "" && !isLangOtru(prevWord) && prevLet != getLang('',Char,0) )
{
if(Char == 'a' || Char == 'i' ||Char == 'u' || Char == 'e' || Char == 'o' )
{
helptxt = ' < td style="font-size:12px;border:1px solid #0DE8E9;" > ' +prevWord+ ' + ' + Char+' = < b > ' + getLang(prevWord,Char,0) + " < /b > < /td > " ;
if(Char == 'a')
helptxt += ' < td style="font-size:12px;border:1px solid #0DE8E9;" > ' + prevWord + ' + i = < b > ' + getLang(prevWord,'i',0) + " < /b > < /td > < td style='font-size:12px;border:1px solid #0DE8E9;' > "
+ prevWord + ' + u = < b > ' + getLang(prevWord,'u',0) + " < /b > < /td > ";
}
else if( Char != getLang('',Char,0))
{
helptxt = ' < td style="font-size:12px;border:1px solid #0DE8E9;" > ' +prevWord + ' + a = < b > ' + getLang(prevWord,'a',0) + " < /b > < /td > < td style='font-size:12px;border:1px solid #0DE8E9;' > "
+ prevWord + ' + A = < b > ' + getLang(prevWord,'A',0) + " < /b > < /td > < td style='font-size:12px;border:1px solid #0DE8E9;' > "
+ prevWord + ' + i = < b > ' + getLang(prevWord,'i',0) + " < /b > < /td > < td style='font-size:12px;border:1px solid #0DE8E9;' > "
+ prevWord + ' + I = < b > ' + getLang(prevWord,'I',0) + " < /b > < /td > < td style='font-size:12px;border:1px solid #0DE8E9;' > "
+ prevWord + ' + u = < b > ' + getLang(prevWord,'u',0) + " < /b > < /td > < td style='font-size:12px;border:1px solid #0DE8E9;' > "
+ prevWord + ' + U = < b > ' + getLang(prevWord,'U',0) + " < /b > < /td > < td style='font-size:12px;border:1px solid #0DE8E9;' > "
+ prevWord + ' + e = < b > ' + getLang(prevWord,'e',0) + " < /b > < /td > < td style='font-size:12px;border:1px solid #0DE8E9;' > "
+ prevWord + ' + E = < b > ' + getLang(prevWord,'E',0) + " < /b > < /td > < td style='font-size:12px;border:1px solid #0DE8E9;' > "
+ prevWord + ' + a + i = < b > ' + getLang(getLang(prevWord,'a',0),'i',0) + " < /b > < /td > < td style='font-size:12px;border:1px solid #0DE8E9;' > "
+ prevWord + ' + o = < b > ' + getLang(prevWord,'o',0) + " < /b > < /td > < td style='font-size:12px;border:1px solid #0DE8E9;' > "
+ prevWord + ' + o = < b > ' + getLang(prevWord,'O',0) + " < /b > < /td > < td style='font-size:12px;border:1px solid #0DE8E9;' > "
+ prevWord + ' + a + u = < b > ' + getLang(getLang(prevWord,'a',0),'u',0) + " < /b > < /td > "
if(lang == 'tamil')
{
if(getLang('','t',0) == prevWord)
helptxt += ' < td style="font-size:12px;border:1px solid #0DE8E9;" > ' +prevWord + ' + h = < b > ' + getLang(prevWord,'h',0) + " < /b > < /td > ";
if(getLang('','s',0) == prevWord)
helptxt += ' < td style="font-size:12px;border:1px solid #0DE8E9;" > ' +prevWord + ' + h = < b > ' + getLang(prevWord,'h',0)+ " < /b > < /td > ";
if(getLang('','S',0) == prevWord)
helptxt += ' < td style="font-size:12px;border:1px solid #0DE8E9;" > ' + prevWord + ' + r + I = < b > ' + getLang(getLang(prevWord,'r',0),'I',0) + " < /b > < /td > ";
if(getLang('k','n',0).indexOf(prevWord) > 0 )
helptxt += ' < td style="font-size:12px;border:1px solid #0DE8E9;" > ' +prevWord + ' + t + h = < b > ' + getLang(getLang(prevWord,'t',0),'h',0) + " < /b > < /td > < td style='font-size:12px;border:1px solid #0DE8E9;' > "
+ prevWord + ' + g = < b > ' + getLang(prevWord,'g',0) + " < /b > < /td > < td style='font-size:12px;border:1px solid #0DE8E9;' > "
+ prevWord + ' + j = < b > ' + getLang(prevWord,'j',0) + " < /b > < /td > ";
}
}
helpdiv.innerHTML = ' < table cellpadding="2" cellspacing="0" border="0" style="border:1px solid #0DE8E9;background-color:#BDE8E9" > < tr > '+ helptxt + ' < /tr > < /table > ';
helpstyle.display = 'block';

}
else
helpstyle.display = 'none';
if(isIE) e.srcElement.onblur = hideHelp;
else e.target.onblur = hideHelp;
}

function isLangOtru(letter)
{
isOtru = false;
otruArr = new Array ( '\u200C',
"\u0BCD","\u0BBE","\u0BBF","\u0BC0", "\u0BC1","\u0BC2","\u0BC6","\u0BC7","\u0BC8","\u0BCA","\u0BCB","\u0BCC", // Tamil
"\u0C4D","\u0C3E","\u0C3F","\u0C40","\u0C41","\u0C42","\u0C46","\u0C47","\u0C48","\u0C4A","\u0C4B","\u0C4C","\u0C43","\u0C44","\u0C01","\u0C02","\u0C03", //Telugu
"\u094D","\u093E","\u093F","\u0940","\u0941","\u0942","\u0946","\u0947","\u0948","\u094A","\u094B","\u094C","\u0901","\u0902","\u0903",// Hindi
"\u0D3E","\u0D3F","\u0D40","\u0D41","\u0D42","\u0D43","\u0D47","\u0D46","\u0D48","\u0D4A","\u0D4B","\u0D4C","\u0D02","\u0D03", //Malayalam
"\u0CBE","\u0CBF","\u0CC0","\u0CC1","\u0CC2","\u0CC3","\u0CC4","\u0CC6","\u0CC7","\u0CC8","\u0CCA","\u0CCB","\u0CCC","\u0C82","\u0C83",//Kannada
"\u0ABE","\u0ABF","\u0AC0","\u0AC1","\u0AC2","\u0AC5","\u0AC7","\u0AC8","\u0AC9","\u0ACB","\u0ACC","\u0A81","\u0A82","\u0A83",//Gujarathi
"\u0B3E","\u0B3F","\u0B40","\u0B41","\u0B42","\u0B46","\u0B47","\u0B48","\u0B4A","\u0B4B","\u0B4C","\u0B01","\u0B02","\u0B03",//Oriya
"\u09BE","\u09BF","\u09C0","\u09C1","\u09C2","\u09C6","\u09C7","\u09C8","\u09CA","\u09CB","\u09CC","\u0981","\u0982","\u0983",//Bengali
"\u0A3E","\u0A3F","\u0A40","\u0A41","\u0A42","\u0A46","\u0A47","\u0A48","\u0A4A","\u0A4B","\u0A4C","\u0A50","\u0A03"//Punjabi
);
for(i=0;i < otruArr.length;i++)
if(otruArr[i] == letter)
isOtru = true;
return isOtru;
}

function showHelp(obj)
{
toShowHelp = obj.checked;
helpstyle = getStyleObject('HelpDiv');
if(!toShowHelp)
helpstyle.display = 'none';
}

function hideHelp()
{
helpstyle = getStyleObject('HelpDiv');
helpstyle.display = 'none';
}



and the Punjabi.js which will convert the characters or have the definition of Punjabi characters will be


var lang = "punjabi";
var chnbin = "\u0A4D";
var ugar = "\u0A41";
var uugar = "\u0A42";
myimg.src = "images/"+lang+".png";


var pu = new Array();
var putw = new Array();
//Typewritter
putw['\\!'] = "\u0A0D";
putw['\\@'] = "\u0A45";
putw['\\#'] = "\u0A4D\u0A30";
putw['\\$'] = "\u0A30\u0A4D";
putw['\\%'] = "\u0A1C\u0A4D\u0A1E";
putw['\\^'] = "\u0A24\u0A4D\u0A30";
putw['\\&'] = "\u0A15\u0A4D\u0A38";
putw['\\*'] = "\u0A36\u0A4D\u0A30";
putw['_'] = "\u0A03";
putw['\\+'] = "\u0A0B";
putw['\\='] = "\u0A43";
putw['q'] = "\u0A4C";
putw['w'] = "\u0A48";
putw['e'] = "\u0A3E";
putw['r'] = "\u0A40";
putw['t'] = "\u0A42";
putw['y'] = "\u0A2C";
putw['u'] = "\u0A39";
putw['i'] = "\u0A17";
putw['o'] = "\u0A26";
putw['p'] = "\u0A1C";
putw['\\['] = "\u0A21";
putw['\\]'] = "\u0A3C";
putw['Q'] = "\u0A14";
putw['W'] = "\u0A10";
putw['E'] = "\u0A06";
putw['R'] = "\u0A08";
putw['T'] = "\u0A0A";
putw['Y'] = "\u0A2D";
putw['U'] = "\u0A19";
putw['I'] = "\u0A18";
putw['O'] = "\u0A27";
putw['P'] = "\u0A1D";
putw['\\{'] = "\u0A22";
putw['\\}'] = "\u0A1E";

putw['a'] = "\u0A4B";
putw['s'] = "\u0A47";
putw['d'] = "\u0A4D";
putw['f'] = "\u0A3F";
putw['g'] = "\u0A41";
putw['h'] = "\u0A2A";
putw['j'] = "\u0A30";
putw['k'] = "\u0A15";
putw['l'] = "\u0A24";
putw['\\;'] = "\u0A1A";
putw['\\\''] = "\u0A1F";
putw['\\\\'] = "\u0A49";
putw['A'] = "\u0A13";
putw['S'] = "\u0A0F";
putw['D'] = "\u0A05";
putw['F'] = "\u0A07";
putw['G'] = "\u0A09";
putw['H'] = "\u0A2B";
putw['J'] = "\u0A5C";
putw['K'] = "\u0A16";
putw['L'] = "\u0A25";
putw['\\:'] = "\u0A1B";
putw['"'] = "\u0A20";
putw['\\|'] = "\u0A11";

putw['z'] = "";
putw['x'] = "\u0A02";
putw['c'] = "\u0A2E";
putw['v'] = "\u0A28";
putw['b'] = "\u0A35";
putw['n'] = "\u0A32";
putw['m'] = "\u0A38";
putw['/'] = "\u0A2F";
putw['Z'] = "";
putw['X'] = "\u0A01";
putw['C'] = "\u0A23";
putw['V'] = "";
putw['B'] = "";
putw['N'] = "\u0A33";
putw['M'] = "\u0A36";
putw[' < '] = "\u0A38";
putw[' > '] = "\u0A64";
putw['\\?'] = "\u0A5F";

//Phonetic
pu['B'] = "b";
pu['C'] = "c";
pu['F'] = "ph";
pu['f'] = "ph";
pu['G'] = "g";
pu['J'] = "j";
pu['K'] = "k";
pu['M'] = "m";
pu['P'] = "p";
pu['Q'] = "q";
pu['V'] = "v";
pu['W'] = "v";
pu['w'] = "v";
pu['X'] = "x";
pu['Y'] = "y";
pu['Z'] = "j";
pu['z'] = "j";
pu['e'] = "E";
pu['o'] = "O";
//Cons
pu['k'] = "\u0A15\u0A4D";
pu['c'] = "\u0A1A\u0A4D";
pu['T'] = "\u0A1F\u0A4D";
pu['D'] = "\u0A21\u0A4D";
pu['N'] = "\u0A23\u0A4D";
pu['t'] = "\u0A24\u0A4D";
pu['d'] = "\u0A26\u0A4D";
pu['n'] = "\u0A28\u0A4D";
pu['p'] = "\u0A2A\u0A4D";
pu['b'] = "\u0A2C\u0A4D";


pu['y'] = "\u0A2F\u0A4D";
pu['R'] = "\u0A5C\u0A4D";
pu['L'] = "\u0A33\u0A4D";
pu['v'] = "\u0A35\u0A4D";
pu['s'] = "\u0A38\u0A4D";
pu['S'] = "\u0A38\u0A4D";
pu['H'] = "\u0A39\u0A4D";
pu['x'] = "\u0A15\u0A4D\u0A36\u0A4D";

pu['\u0A15\u0A4Dh'] = "\u0A16\u0A4D";
pu['\u0A17\u0A4Dh'] = "\u0A18\u0A4D";
pu['\u0A28\u0A4Dg'] = "\u0A19\u0A4D";
pu['\u0A1A\u0A4Dh'] = "\u0A1B\u0A4D";
pu['\u0A1C\u0A4Dh'] = "\u0A1D\u0A4D";
pu['\u0A28\u0A4Dj'] = "\u0A1E\u0A4D";
pu['\u0A1F\u0A4Dh'] = "\u0A20\u0A4D";
pu['\u0A21\u0A4Dh'] = "\u0A22\u0A4D";
pu['\u0A24\u0A4Dh'] = "\u0A25\u0A4D";
pu['\u0A26\u0A4Dh'] = "\u0A27\u0A4D";
pu['\u0A2A\u0A4Dh'] = "\u0A2B\u0A4D";
pu['\u0A2C\u0A4Dh'] = "\u0A2D\u0A4D";
pu['\u0A38\u0A4Dh'] = "\u0A36\u0A4D";
pu['\u200Dm'] = "\u0A02";

pu['r'] = "\u0A30\u0A4D";
pu['l'] = "\u0A32\u0A4D";

pu['h'] = "\u0A39\u0A4D";
pu['g'] = "\u0A17\u0A4D";
pu['j'] = "\u0A1C\u0A4D";
pu['m'] = "\u0A2E\u0A4D";
//VowSml
pu['\u0A4Da'] = "\u200C";
pu['\u0A4Di'] = "\u0A3F";
pu['\u0A4Du'] = "\u0A41";
pu['\u0A4De'] = "\u0A46";
pu['\u0A4Do'] = "\u0A4A";
pu['\u200Ci'] = "\u0A48";
pu['\u200Cu'] = "\u0A4C";
pu['\u200C-'] = "\u200D";
pu['\u200C:'] = ":";
pu['-'] = "\u200D";
//VowBig
pu['\u200Ca'] = "\u0A3E";
pu['\u0A3Fi'] = "\u0A40";
pu['\u0A41u'] = "\u0A42";
pu['\u0A46e'] = "\u0A47";
pu['\u0A4Ao'] = "\u0A4B";
pu['\u0A4DA'] = "\u0A3E";
pu['\u0A4DI'] = "\u0A40";
pu['\u0A4DU'] = "\u0A42";
pu['\u0A4DE'] = "\u0A47";
pu['\u0A4DO'] = "\u0A4B";
//Vows
pu['\u0A05i'] = "\u0A10";
pu['\u0A05u'] = "\u0A14";
pu['\u0A05a'] = "\u0A06";
pu['\u0A07i'] = "\u0A08";
pu['\u0A09u'] = "\u0A0A";
pu['\u0A0Fe'] = "\u0A0F";
pu['\u0A13o'] = "\u0A13";
pu['\u0A13m'] = "\u0A50";
pu[':h'] = "\u0A03";

pu['a'] = "\u0A05";
pu['A'] = "\u0A06";
pu['i'] = "\u0A07";
pu['I'] = "\u0A08";
pu['u'] = "\u0A09";
pu['U'] = "\u0A0A";
pu['E'] = "\u0A0F";
pu['O'] = "\u0A13";
pu['q'] = "\u0A15\u0A4D";
//Nums
pu['\u200D1'] = "\u0A67";
pu['\u200D2'] = "\u0A68";
pu['\u200D3'] = "\u0A69";
pu['\u200D4'] = "\u0A6A";
pu['\u200D5'] = "\u0A6B";
pu['\u200D6'] = "\u0A6C";
pu['\u200D7'] = "\u0A6D";
pu['\u200D8'] = "\u0A6E";
pu['\u200D9'] = "\u0A6F";
pu['\u200D0'] = "\u0A66";
pu['(.+)\u200C(.+)'] = "$1$2";



and the sample implementation of the above two js is like


< !
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
< HTML >


< !--
Copyright (C) 2008 Gopalakrishnan (Gopi)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see < http://www.gnu.org/licenses/ > .
Further to the terms mentioned you should leave this copyright notice
intact, stating me as the original author.
-- >
< HEAD >
< META http-equiv="Content-Type" content="text/html; charset=utf-8" >

< META content="punjabi,iscii,unicode,converter,punjabiunicode,unicodepunjabi,punjabi,punjabiblog,unicodepunjabifont,tools,utilitiespunjabisoftware,font,software,web,net,convert,english,online,phonetic,typing" name=keywords >
< TITLE > Meetu's Unicode Punjabi Converter < /TITLE >
< SCRIPT language=JavaScript src="script/common.js" > < /SCRIPT >
< SCRIPT language=JavaScript src="script/punjabi.js" > < /SCRIPT >
< /HEAD >
< BODY >
< SCRIPT language="JavaScript" >
SelectedTab = 2;
SelectedMenu = 2;
SelectedSubMenu = 9;
showTab(); < /SCRIPT >
< form name="post" method="post" >

< b > Type in English and get it converted to Unicode Punjabi < /B > . Use < b > F12 < /b > to toggle between English & Punjabi
< br >

< textarea class=converters name=comment charset="utf-8" onKeyPress="javascript:convertThis(event)"

onKeyDown="toggleKBMode(event)" > < /textarea >

< br >
< /form >
< /BODY >
< /HTML >



Did you like this resource? Share it with your friends and show your love!

Responses to "Punjabi Editor"
Author: Gaurav Arora    21 Apr 2009Member Level: Gold   Points : 1
Hi Meetu,

I have downloaded the files and try to run but there is a javascript erro.



Author: Miss Meetu Choudhary    21 Apr 2009Member Level: Gold   Points : 0
Hi Gauruav can you pleas post the error i will reftify it.



Author: showcopyMasters    02 Jul 2009Member Level: Bronze   Points : 0
There are so many editor you submitted .where did you get this?


Author: Manigandan    02 Jul 2009Member Level: Gold   Points : 1
Hi showcopymaster,

Meetu wont tel that. If she tel means you started posting
Telugu Editor
Gujarathi Editot
Marathi Editor
Like that...

Correct Meetu!!! :-)



Thanks,
Mani



Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Subscribe to Subscribers
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India