PageSourceSearch

https://sahos24.com/assets/js/phoneticunicode.js

js sahos24.com collected 2026-10-02 13:42:17 UTC 12,130 bytes, 428 lines download raw bytes

1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
2let window = _____WB$wombat$assign$function_____("window");
3let self = _____WB$wombat$assign$function_____("self");
4let document = _____WB$wombat$assign$function_____("document");
5let location = _____WB$wombat$assign$function_____("location");
6let top = _____WB$wombat$assign$function_____("top");
7let parent = _____WB$wombat$assign$function_____("parent");
8let frames = _____WB$wombat$assign$function_____("frames");
9let opens = _____WB$wombat$assign$function_____("opens");
10/**
11 * Unicode Phonetic Parser for writing in webpages
12 * This script transliterate the user input and display unicode bangla characters
13 * 
14 * @name Ekushey Unicode Parser
15 * @version 1.0 [Date 30th July, 2006]
16 * @author Hasin Hayder. Visit My Homepage at http://hasin.wordpress.com
17 * @license LGPL
18 */
19 
20/**
21 * This script is released under Lesser GNU Public License [LGPL] 
22 * which implies that you are free to use this script in your 
23 * web applications without any problem. No warranty ensured. If you like 
24 * this script, Please acknowledge by keeping a link to my website 
25 * http://hasin.wordpress.com in the page where you use this script. 
26 */ 
27/*
28Last Modification:01/11/2008 by Sabuj Kundu(http://manchu.wordpress.com)
29Last Modification: 26 Jan 2008 by Omi Azad (http://omi.net.bd)
30*/
31// Set of Characters
32var activeta; //active text area
33var phonetic=new Array();
34
35// phonetic bangla equivalents
36//Bengali: {U+0980..U+09FF} 
37phonetic['k'] = '\u0995'; // ko
38//digits
39phonetic['0']='\u09e6';//'০'; 
40phonetic['1']='\u09e7';//'à§§';
41phonetic['2']='\u09e8';//'২';
42phonetic['3']='\u09e9';//'à§©';
43phonetic['4']='\u09ea';//'৪';
44phonetic['5']='\u09eb';//'à§«';
45phonetic['6']='\u09ec';//'৬';
46phonetic['7']='\u09ed';//'à§­';
47phonetic['8']='\u09ee';//'à§®';
48phonetic['9']='\u09ef';//'৯';
49
50phonetic['i']='\u09BF'; // hrossho i kar
51phonetic['I']='\u0987'; // hrossho i
52phonetic['ii']='\u09C0'; // dirgho i kar
53phonetic['II']='\u0988'; // dirgho i
54phonetic['e']='\u09C7'; // e kar
55phonetic['E'] = '\u098F'; // E
56phonetic['U'] = '\u0989'; // hrossho u
57phonetic['u'] = '\u09C1'; // hrossho u kar
58phonetic['uu'] = '\u09C2'; // dirgho u kar
59phonetic['UU'] = '\u098A'; // dirgho u
60phonetic['r']='\u09B0'; // ro
61phonetic['WR']='\u098B'; // wri
62phonetic['a']='\u09BE'; // a kar
63phonetic['A']='\u0986'; // shore a
64phonetic['ao']='\u0985'; // shore o
65phonetic['s']='\u09B8'; // dontyo so
66phonetic['t']='\u099f'; // to
67phonetic['K'] = '\u0996'; // Kho
68
69phonetic['kh'] = '\u0996'; // kho
70
71phonetic['n']='\u09A8'; // dontyo no
72phonetic['N']='\u09A3'; // murdhonyo no
73phonetic['T']='\u09A4'; // tto
74phonetic['Th']='\u09A5'; // ttho
75
76phonetic['d']='\u09A1'; // ddo
77phonetic['dh']='\u09A2'; // ddho
78
79phonetic['b']='\u09AC'; // bo
80phonetic['bh']='\u09AD'; // bho
81phonetic['v']='\u09AD'; // bho
82//phonetic['rh']='o';	 // doye bindu ro
83phonetic['R']='\u09DC';	 // doye bindu ro
84phonetic['Rh']='\u09DD';	 // dhoye bindu ro
85phonetic['g']='\u0997';	// go
86phonetic['G']='\u0998';	// gho
87
88phonetic['gh']='\u0998'; // gho
89
90phonetic['h']='\u09B9';	// ho
91phonetic['NG']='\u099E';	// yo
92phonetic['j']='\u099C';	// borgio jo
93phonetic['J']='\u099D'; // jho
94phonetic['jh']='\u099D'; // jho
95phonetic['c']='\u099A'; //  cho
96phonetic['ch']='\u099A'; // cho
97phonetic['C']='\u099B'; // ccho
98phonetic['th']='\u09A0'; // tho
99phonetic['p']='\u09AA'; // po
100phonetic['f']='\u09AB'; // fo
101phonetic['ph']='\u09AB'; // fo
102phonetic['D']='\u09A6'; // do
103phonetic['Dh']='\u09A7'; // dho
104
105phonetic['z']='\u09AF';// ontoshyo zo
106phonetic['y']='\u09DF';	// ontostho yo
107phonetic['Ng']='\u0999';	// Uma
108phonetic['ng']='\u0982';	// uniswor
109phonetic['l']='\u09B2';	// lo
110phonetic['m']='\u09AE';	// mo
111phonetic['sh']='\u09B6';	// talobyo sho
112phonetic['S']='\u09B7'; // mordhonyo sho
113phonetic['O']= '\u0993';//'\u09CB'; // o
114phonetic['ou']='\u099C'; // ou kar
115phonetic['OU']='\u0994'; // OU
116phonetic['Ou']='\u0994'; // OU
117phonetic['Oi']='\u0990'; // OU
118phonetic['OI']='\u0990'; // OU
119phonetic['tt']='\u09CE'; // tto
120phonetic['H']='\u0983'; // bisworgo
121phonetic["."] ="\u0964"; // dari
122phonetic[".."] = "."; // fullstop
123phonetic['HH'] = '\u09CD' + '\u200c'; // hosonto
124phonetic['NN'] = '\u0981'; // chondrobindu
125phonetic['Y'] ='\u09CD'+'\u09AF'; // jo fola
126phonetic['w'] ='\u09CD'+ '\u09AC'; // wri kar
127phonetic['W'] ='\u09C3';// wri kar
128phonetic['wr'] ='\u09C3'; // wri kar
129phonetic['x'] ="\u0995"  + '\u09CD'+ '\u09B8';
130phonetic['rY'] = phonetic['r']+ '\u200D'+ '\u09CD'+'\u09AF';
131phonetic['L'] = phonetic['l'];
132phonetic['Z'] = phonetic['z'];
133phonetic['P'] = phonetic['p'];
134phonetic['V'] = phonetic['v'];
135phonetic['B'] = phonetic['b'];
136phonetic['M'] = phonetic['m'];
137phonetic['V'] = phonetic['v'];
138phonetic['X'] = phonetic['x'];
139phonetic['V'] = phonetic['v'];
140phonetic['F'] = phonetic['f'];
141//End Set
142
143
144var carry = '';  //This variable stores each keystrokes
145var old_len =0; //This stores length parsed bangla charcter
146var ctrlPressed=false;
147var len_to_process_oi_kar=0;
148var first_letter = false;
149var carry2="";
150isIE=document.all? 1:0;
151var switched=false;
152
153function checkKeyDown(ev)
154{
155	//just track the control key
156	var e = (window.event) ? event.keyCode : ev.which;
157	if (e=='17')
158	{
159		ctrlPressed = true;
160	}
161}
162
163function checkKeyUp(ev)
164{
165	//just track the control key
166	var e = (window.event) ? event.keyCode : ev.which;
167	if (e=='17')
168	{
169		ctrlPressed = false;
170		//alert(ctrlPressed);
171	}
172
173}
174
175
176function parsePhonetic(evnt)
177{
178	// main phonetic parser
179	var t = document.getElementById(activeta); // the active text area
180	var e = (window.event) ? event.keyCode : evnt.which; // get the keycode
181
182	if (e=='113')
183	{
184		//switch the keyboard mode
185		if(ctrlPressed){
186			switched = !switched;
187			//alert("H"+switched);
188			return true;
189		}
190	}
191
192	if (switched) return true;
193	
194	if(ctrlPressed)
195	{
196		// user is pressing control, so leave the parsing
197		e=0; 
198	}
199
200	var char_e = String.fromCharCode(e); // get the character equivalent to this keycode
201	
202	if(e==8 || e==32)
203	{
204		// if space is pressed we have to clear the carry. otherwise there will be some malformed conjunctions
205		carry = " ";	
206		old_len = 1;
207		return;
208	}
209
210	lastcarry = carry;
211	carry += "" + char_e;	 //append the current character pressed to the carry
212	
213	bangla = parsePhoneticCarry(carry); // get the combined equivalent
214	tempBangla = parsePhoneticCarry(char_e); // get the single equivalent
215
216	if (tempBangla == ".." || bangla == "..") //that means it has next sibling
217	{
218		return false;
219	}
220	if (char_e=="+")
221	{
222		if(carry=="++")
223		{
224			// check if it is a plus sign
225			insertJointAtCursor("+",old_len);
226			old_len=1;
227			return false;
228		}	
229		//otherwise this is a simple joiner
230		insertAtCursor("\u09CD");old_len = 1;
231		carry2=carry;
232		carry="+";
233		return false;
234	}
235	else if(old_len==0) //first character
236	{
237		// this is first time someone press a character
238		insertJointAtCursor(bangla,1);
239		old_len=1;
240		return false;
241		
242	}
243/*	else if((char_e=='z' || char_e=='Z')&& carry2=="r+")//force Za-phola after Ra
244	{
245		//alert('yes');
246		insertJointAtCursor('\u200D'+'\u09CD'+phonetic['z'],1);
247		old_len=1;	
248		return false;
249	} */
250	else if(carry=="ao")
251	{
252		// its a shore o
253		insertJointAtCursor(parsePhoneticCarry("ao"),old_len);
254		old_len=1;
255		return false;
256	}
257	else if (carry == "ii")
258	{
259		// process dirgho i kar
260
261		insertJointAtCursor(phonetic['ii'],1);
262		old_len = 1;
263		return false;
264	}
265	else if (carry == "oi" )
266	{
267		insertJointAtCursor('\u09C8',1);
268		return false;
269	}		
270
271	else if (char_e == "o")
272	{
273		old_len = 1;
274		insertAtCursor('\u09CB');
275		carry = "o";
276		return false;
277	}
278	else if (carry == "ou")
279	{
280		// ou kar
281		insertJointAtCursor("\u09CC",old_len);
282		old_len = 1;
283		return false;
284	}	
285	
286	else if((bangla == "" && tempBangla !="")) //that means it has no joint equivalent
287	{
288		
289		// there is no joint equivalent - so show the single equivalent. 
290		bangla = tempBangla;
291		if (bangla=="")
292		{
293			// there is no available equivalent - leave as is
294			carry ="";
295			return;
296		}
297		
298		else
299		{
300			// found one equivalent
301			carry = char_e;
302			insertAtCursor(bangla);
303			old_len = bangla.length;
304			return false;
305		}
306	}
307	else if(bangla!="")//joint equivalent found 
308	{
309		// we have found some joint equivalent process it
310		
311		insertJointAtCursor(bangla, old_len);
312		old_len = bangla.length;
313		return false;
314	}
315}
316
317    function parsePhoneticCarry(code)
318    {
319	//this function just returns a bangla equivalent for a given keystroke
320	//or a conjunction
321	//just read the array - if found then return the bangla eq.
322	//otherwise return a null value
323        if (!phonetic[code])  //Oh my god :-( no bangla equivalent for this keystroke
324
325        {
326			return ''; //return a null value
327        }
328        else
329        {
330            return ( phonetic[code]);  //voila - we've found bangla equivalent
331        }
332
333    }
334
335
336function insertAtCursor(myValue) {
337	/**
338	 * this function inserts a character at the current cursor position in a text area
339	 * many thanks to alex king and phpMyAdmin for this cool function
340	 * 
341	 * This function is originally found in phpMyAdmin package and modified by Hasin Hayder to meet the requirement
342	 */
343	var myField = document.getElementById(activeta);
344	if (document.selection) {		
345		myField.focus();
346		sel = document.selection.createRange();
347		sel.text = myValue;
348		sel.collapse(true);
349		sel.select();
350	}
351	//MOZILLA/NETSCAPE support
352	else if (myField.selectionStart || myField.selectionStart == 0) {
353		
354		var startPos = myField.selectionStart;
355		var endPos = myField.selectionEnd;
356		var scrollTop = myField.scrollTop;
357		startPos = (startPos == -1 ? myField.value.length : startPos );
358		myField.value = myField.value.substring(0, startPos)
359		+ myValue
360		+ myField.value.substring(endPos, myField.value.length);
361		myField.focus();
362		myField.selectionStart = startPos + myValue.length;
363		myField.selectionEnd = startPos + myValue.length;
364		myField.scrollTop = scrollTop;
365	} else {
366		var scrollTop = myField.scrollTop;
367		myField.value += myValue;
368		myField.focus();
369		myField.scrollTop = scrollTop;
370	}
371}
372
373function insertJointAtCursor(myValue, len) {
374	/**
375	 * this function inserts a conjunction and removes previous single character at the current cursor position in a text area
376	 * 
377	 * This function is derived from the original one found in phpMyAdmin package and modified by Hasin to meet our need
378	 */
379	//alert(len);
380	var myField = document.getElementById(activeta);
381	if (document.selection) {
382		myField.focus();
383		sel = document.selection.createRange();
384		if (myField.value.length >= len){  // here is that first conjunction bug in IE, if you use the > operator
385			sel.moveStart('character', -1*(len));   
386			//sel.moveEnd('character',-1*(len-1));
387		}
388		sel.text = myValue;
389		sel.collapse(true);
390		sel.select();
391	}
392	//MOZILLA/NETSCAPE support
393	else if (myField.selectionStart || myField.selectionStart == 0) {
394		myField.focus();
395		var startPos = myField.selectionStart-len;
396		var endPos = myField.selectionEnd;
397		var scrollTop = myField.scrollTop;
398		startPos = (startPos == -1 ? myField.value.length : startPos );
399		myField.value = myField.value.substring(0, startPos)
400		+ myValue
401		+ myField.value.substring(endPos, myField.value.length);
402		myField.focus();
403		myField.selectionStart = startPos + myValue.length;
404		myField.selectionEnd = startPos + myValue.length;
405		myField.scrollTop = scrollTop;
406	} else {
407		var scrollTop = myField.scrollTop;
408		myField.value += myValue;
409		myField.focus();
410		myField.scrollTop = scrollTop;
411	}
412	//document.getElementById("len").innerHTML = len;
413}
414
415function makePhoneticEditor(textAreaId)
416{
417	activeTextAreaInstance = document.getElementById(textAreaId);
418	activeTextAreaInstance.onkeypress = parsePhonetic; 
419	activeTextAreaInstance.onkeydown = checkKeyDown; 
420	activeTextAreaInstance.onkeyup = checkKeyUp;
421	activeTextAreaInstance.onfocus = function(){activeta=textAreaId;};
422}
423function makeVirtualEditor(textAreaId)
424{
425	activeTextAreaInstance = document.getElementById(textAreaId);
426	activeTextAreaInstance.onfocus = function(){activeta=textAreaId;};
427}
428}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.