PageSourceSearch

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

js sahos24.com collected 2026-10-02 13:42:18 UTC 10,866 bytes, 385 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 unijoy Parser for writing in webpages
12 * This script helps to write unicode bangla using unijoy keyboard mapping
13 * 
14 * @name Unijoy Unicode Parser
15 * @version 1.0 [Date 26th August, 2006]
16 * @author Hasin Hayder. Visit My Homepage at http://www.hasinhyder.net
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)
29*/
30// Set of Characters
31var activeta; //active text area
32var unijoy=new Array();
33
34unijoy['0']='\u09e6';//'০'; 
35unijoy['1']='\u09e7';//'à§§';
36unijoy['2']='\u09e8';//'২';
37unijoy['3']='\u09e9';//'à§©';
38unijoy['4']='\u09ea';//'৪';
39unijoy['5']='\u09eb';//'à§«';
40unijoy['6']='\u09ec';//'৬';
41unijoy['7']='\u09ed';//'à§­';
42unijoy['8']='\u09ee';//'à§®';
43unijoy['9']='\u09ef';//'৯';
44
45// unijoy bangla equivalents
46unijoy['j'] = '\u0995'; // ko
47
48unijoy['d']='\u09BF'; // hrossho i kar
49unijoy['gd']='\u0987'; // hrossho i
50unijoy['D']='\u09C0'; // dirgho i kar
51unijoy['gD']='\u0988'; // dirgho i
52unijoy['c']='\u09C7'; // e kar
53unijoy['gc'] = '\u098F'; // E
54unijoy['gs'] = '\u0989'; // hrossho u
55unijoy['s'] = '\u09C1'; // hrossho u kar
56unijoy['S'] = '\u09C2'; // dirgho u kar
57unijoy['gS'] = '\u098A'; // dirgho u
58unijoy['v']='\u09B0'; // ro
59unijoy['a']='\u098B'; // wri
60unijoy['f']='\u09BE'; // a kar
61unijoy['gf'] = '\u0986'; //shore a
62unijoy['F']='\u0985'; // shore ao
63//unijoy['ao']='\u0985'; // shore o
64unijoy['n']='\u09B8'; // dontyo so
65unijoy['t']='\u099f'; // to
66unijoy['J'] = '\u0996'; // Kho
67
68//unijoy['kh'] = '\u0996'; // kho
69
70unijoy['b']='\u09A8'; // dontyo no
71unijoy['B']='\u09A3'; // murdhonyo no
72unijoy['k']='\u09A4'; // tto
73unijoy['K']='\u09A5'; // ttho
74
75unijoy['e']='\u09A1'; // ddo
76unijoy['E']='\u09A2'; // ddho
77
78unijoy['h']='\u09AC'; // bo
79unijoy['H']='\u09AD'; // bho
80//unijoy['v']='\u09AD'; // bho
81//unijoy['rh']='o';	 // doye bindu ro
82unijoy['p']='\u09DC';	 // doye bindu ro
83unijoy['P']='\u09DD';	 // dhoye bindu ro
84unijoy['o']='\u0997';	// go
85unijoy['O']='\u0998';	// gho
86
87//unijoy['gh']='\u0998'; // gho
88
89unijoy['i']='\u09B9';	// ho
90unijoy['I']='\u099E';	// yo
91unijoy['u']='\u099C';	// borgio jo
92unijoy['U']='\u099D'; // jho
93//unijoy['jh']='\u099D'; // jho
94unijoy['y']='\u099A'; //  cho
95unijoy['Y']='\u099B'; // cho
96//unijoy['C']='\u099B'; // ccho
97unijoy['T']='\u09A0'; // tho
98unijoy['r']='\u09AA'; // po
99unijoy['R']='\u09AB'; // fo
100//unijoy['ph']='\u09AB'; // fo
101unijoy['l']='\u09A6'; // do
102unijoy['L']='\u09A7'; // dho
103
104unijoy['w']='\u09AF';// ontoshyo zo
105unijoy['W']='\u09DF';	// ontostho yo
106unijoy['q']='\u0999';	// Uma
107unijoy['Q']='\u0982';	// uniswor
108unijoy['V']='\u09B2';	// lo
109unijoy['m']='\u09AE';	// mo
110unijoy['M']='\u09B6';	// talobyo sho
111unijoy['N']='\u09B7'; // mordhonyo sho
112unijoy['gx']= '\u0993';//'\u09CB'; // o
113unijoy['X']='\u09CC'; // ou kar
114unijoy['gX']='\u0994'; // OU
115//unijoy['Ou']='\u0994'; // OU
116unijoy['gC']='\u0990'; // Oi
117unijoy['\\']='\u0983'; // khandaTa
118unijoy['|']='\u09CE'; // bisworgo
119unijoy["G"] ="\u0964"; // dari
120//unijoy[".."] = "."; // fullstop
121unijoy['g'] = ' ';//'\u09CD' + '\u200c'; // hosonto
122unijoy['&'] = '\u0981'; // chondrobindu
123unijoy['Z'] ='\u09CD'+'\u09AF'; // jo fola
124unijoy['gh'] ='\u09CD'+ '\u09AC'; // bo fola
125unijoy['ga'] ='\u098B';// wri kar
126unijoy['a'] ='\u09C3'; // wri 
127//unijoy['k'] ="\u0995"  + '\u09CD'+ '\u09B8';
128unijoy['vZ'] = unijoy['v']+ '\u200C'+ '\u09CD'+'\u09AF';
129unijoy['z'] =  '\u09CD'+ unijoy['v'];
130unijoy['x'] = '\u09CB';
131unijoy['C'] = '\u09C8'; //Oi Kar
132
133
134
135var carry = '';  //This variable stores each keystrokes
136var old_len =0; //This stores length parsed bangla charcter
137var ctrlPressed=false;
138var first_letter = false;
139var lastInserted;
140
141isIE=document.all? 1:0;
142var switched=false;
143
144function checkKeyDown(ev)
145{
146	//just track the control key
147	var e = (window.event) ? event.keyCode : ev.which;
148	if (e=='17')
149	{
150		ctrlPressed = true;
151	}
152}
153
154function checkKeyUp(ev)
155{
156	//just track the control key
157	var e = (window.event) ? event.keyCode : ev.which;
158	if (e=='17')
159	{
160		ctrlPressed = false;
161		//alert(ctrlPressed);
162	}
163
164}
165
166
167function parseunijoy(evnt)
168{
169	// main unijoy parser
170	var t = document.getElementById(activeta); // the active text area
171	var e = (window.event) ? event.keyCode : evnt.which; // get the keycode
172
173	if (e=='113')
174	{
175		//switch the keyboard mode
176		if(ctrlPressed){
177			switched = !switched;
178			//alert("H"+switched);
179			return true;
180		}
181	}
182
183	if (switched) return true;
184	
185	if(ctrlPressed)
186	{
187		// user is pressing control, so leave the parsing
188		e=0; 
189	}
190
191	var char_e = String.fromCharCode(e); // get the character equivalent to this keycode
192	
193	if(e==8 || e==32)
194	{
195		// if space is pressed we have to clear the carry. otherwise there will be some malformed conjunctions
196		carry = " ";	
197		old_len = 1;
198		return;
199	}
200
201	lastcarry = carry;
202	carry += "" + char_e;	 //append the current character pressed to the carry
203	
204	bangla = parseunijoyCarry(carry); // get the combined equivalent
205	tempBangla = parseunijoyCarry(char_e); // get the single equivalent
206
207	if (tempBangla == ".." || bangla == "..") //that means it has sibling
208	{
209		return false;
210	}
211	if (char_e=="g")
212	{
213		if(carry=="gg")
214		{
215			// check if it is a plus sign
216			insertConjunction('\u09CD' + '\u200c',old_len);
217			old_len=1;
218			return false;
219		}	
220		//otherwise this is a simple joiner
221		insertAtCursor("\u09CD");old_len = 1;
222		carry="g";
223		return false;
224	}
225
226	else if(old_len==0) //first character
227	{
228		// this is first time someone press a character
229		insertConjunction(bangla,1);
230		old_len=1;
231		return false;
232		
233	}
234
235	else if(char_e=="A")
236	{
237		//process old style ref
238		newChar = unijoy['v']+ '\u09CD';
239		insertAtCursor(newChar);
240		old_len = 1;
241		return false;
242	}
243
244	
245	else if((bangla == "" && tempBangla !="")) //that means it has no joint equivalent
246	{
247		
248		// there is no joint equivalent - so show the single equivalent. 
249		bangla = tempBangla;
250		if (bangla=="")
251		{
252			// there is no available equivalent - leave as is
253			carry ="";
254			return;
255		}
256		
257		else
258		{
259			// found one equivalent
260			carry = char_e;
261			insertAtCursor(bangla);
262			old_len = bangla.length;
263			return false;
264		}
265	}
266	else if(bangla!="")//joint equivalent found 
267	{
268		// we have found some joint equivalent process it
269		
270		insertConjunction(bangla, old_len);
271		old_len = bangla.length;
272		return false;
273	}
274}
275
276    function parseunijoyCarry(code)
277    {
278	//this function just returns a bangla equivalent for a given keystroke
279	//or a conjunction
280	//just read the array - if found then return the bangla eq.
281	//otherwise return a null value
282        if (!unijoy[code])  //Oh my god :-( no bangla equivalent for this keystroke
283
284        {
285			return ''; //return a null value
286        }
287        else
288        {
289            return ( unijoy[code]);  //voila - we've found bangla equivalent
290        }
291
292    }
293
294
295function insertAtCursor(myValue) {
296	/**
297	 * this function inserts a character at the current cursor position in a text area
298	 * many thanks to alex king and phpMyAdmin for this cool function
299	 * 
300	 * This function is originally found in phpMyAdmin package and modified by Hasin Hayder to meet the requirement
301	 */
302	lastInserted = myValue;
303	var myField = document.getElementById(activeta);
304	if (document.selection) {
305		//alert("hello2");
306		myField.focus();
307		sel = document.selection.createRange();
308		sel.text = myValue;
309		sel.collapse(true);
310		sel.select();
311	}
312	//MOZILLA/NETSCAPE support
313	else if (myField.selectionStart || myField.selectionStart == 0) {
314		
315		var startPos = myField.selectionStart;
316		var endPos = myField.selectionEnd;
317		var scrollTop = myField.scrollTop;
318		startPos = (startPos == -1 ? myField.value.length : startPos );
319		myField.value = myField.value.substring(0, startPos)
320		+ myValue
321		+ myField.value.substring(endPos, myField.value.length);
322		myField.focus();
323		myField.selectionStart = startPos + myValue.length;
324		myField.selectionEnd = startPos + myValue.length;
325		myField.scrollTop = scrollTop;
326	} else {
327		var scrollTop = myField.scrollTop;
328		myField.value += myValue;
329		myField.focus();
330		myField.scrollTop = scrollTop;
331	}
332}
333
334function insertConjunction(myValue, len) {
335	/**
336	 * this function inserts a conjunction and removes previous single character at the current cursor position in a text area
337	 * 
338	 * This function is derived from the original one found in phpMyAdmin package and modified by Hasin to meet our need
339	 */
340	//alert(len);
341	lastInserted = myValue;
342	var myField = document.getElementById(activeta);
343	if (document.selection) {
344		myField.focus();
345		sel = document.selection.createRange();
346		if (myField.value.length >= len){  // here is that first conjunction bug in IE, if you use the > operator
347			sel.moveStart('character', -1*(len));   
348			//sel.moveEnd('character',-1*(len-1));
349		}
350		sel.text = myValue;
351		sel.collapse(true);
352		sel.select();
353	}
354	//MOZILLA/NETSCAPE support
355	else if (myField.selectionStart || myField.selectionStart == 0) {
356		myField.focus();
357		var startPos = myField.selectionStart-len;
358		var endPos = myField.selectionEnd;
359		var scrollTop = myField.scrollTop;
360		startPos = (startPos == -1 ? myField.value.length : startPos );
361		myField.value = myField.value.substring(0, startPos)
362		+ myValue
363		+ myField.value.substring(endPos, myField.value.length);
364		myField.focus();
365		myField.selectionStart = startPos + myValue.length;
366		myField.selectionEnd = startPos + myValue.length;
367		myField.scrollTop = scrollTop;
368	} else {
369		var scrollTop = myField.scrollTop;
370		myField.value += myValue;
371		myField.focus();
372		myField.scrollTop = scrollTop;
373	}
374	//document.getElementById("len").innerHTML = len;
375}
376
377function makeUnijoyEditor(textAreaId)
378{
379	activeTextAreaInstance = document.getElementById(textAreaId);
380	activeTextAreaInstance.onkeypress = parseunijoy;
381	activeTextAreaInstance.onkeydown = checkKeyDown; 
382	activeTextAreaInstance.onkeyup = checkKeyUp;
383	activeTextAreaInstance.onfocus = function(){activeta=textAreaId;};
384}
385}

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.