PageSourceSearch

http://batak-bg.com/common/js/x.js?t=1777560748

js batak-bg.com collected 2026-10-02 19:21:59 UTC 17,441 bytes, 679 lines download raw bytes

1/**
2 * x.js compiled from X 4.0 with XC 0.27b.
3 * Distributed by GNU LGPL. For copyrights, license, documentation and more visit Cross-Browser.com
4 * Copyright 2001-2005 Michael Foster (Cross-Browser.com)
5 **/
6function xDeprecate(funcName) {
7	var msg = 'DEPRECATED : '+funcName+'() is deprecated in Rhymix.';
8	if (typeof console == 'object' && typeof console.warn == 'function') {
9		if (navigator.userAgent.match(/Firefox/)) {
10			console.error(msg);
11		} else {
12			console.warn(msg);
13		}
14	}
15}
16
17var xOp7Up,xOp6Dn,xIE4Up,xIE4,xIE5,xIE6,xNN4,xUA=navigator.userAgent.toLowerCase();
18if(window.opera){
19	var i=xUA.indexOf('opera');
20	if(i!=-1){
21		var v=parseInt(xUA.charAt(i+6));
22		xOp7Up=v>=7;
23		xOp6Dn=v<7;
24	}
25}
26else if(navigator.vendor!='KDE' && document.all && xUA.indexOf('msie')!=-1){
27	xIE4Up=parseFloat(navigator.appVersion)>=4;
28	xIE4=xUA.indexOf('msie 4')!=-1;
29	xIE5=xUA.indexOf('msie 5')!=-1;
30	xIE6=xUA.indexOf('msie 6')!=-1;
31}
32else if(document.layers){xNN4=true;}
33var xMac=xUA.indexOf('mac')!=-1;
34var xFF=xUA.indexOf('firefox')!=-1;
35
36// (element, event(without 'on'), event listener(function name)[, caption])
37function xAddEventListener(e,eT,eL,cap)
38{
39	xDeprecate('xAddEventListener');
40	if(!(e=xGetElementById(e))) return;
41	eT=eT.toLowerCase();
42	if((!xIE4Up && !xOp7Up) && e==window) {
43		if(eT=='resize') { window.xPCW=xClientWidth(); window.xPCH=xClientHeight(); window.xREL=eL; xResizeEvent(); return; }
44		if(eT=='scroll') { window.xPSL=xScrollLeft(); window.xPST=xScrollTop(); window.xSEL=eL; xScrollEvent(); return; }
45	}
46	var eh='e.on'+eT+'=eL';
47	if(e.addEventListener) e.addEventListener(eT,eL,cap);
48	else if(e.attachEvent) e.attachEvent('on'+eT,eL);
49	else eval(eh);
50}
51// called only from the above
52function xResizeEvent()
53{
54	xDeprecate('xResizeEvent');
55	if (window.xREL) setTimeout('xResizeEvent()', 250);
56	var cw = xClientWidth(), ch = xClientHeight();
57	if (window.xPCW != cw || window.xPCH != ch) { window.xPCW = cw; window.xPCH = ch; if (window.xREL) window.xREL(); }
58}
59
60function xScrollEvent()
61{
62	xDeprecate('xScrollEvent');
63	if (window.xSEL) setTimeout('xScrollEvent()', 250);
64	var sl = xScrollLeft(), st = xScrollTop();
65	if (window.xPSL != sl || window.xPST != st) { window.xPSL = sl; window.xPST = st; if (window.xSEL) window.xSEL(); }
66}
67
68function xAppendChild(oParent, oChild)
69{
70	xDeprecate('xAppendChild');
71	if (oParent.appendChild) return oParent.appendChild(oChild);
72	else return null;
73}
74
75function xClientHeight()
76{
77	xDeprecate('xClientHeight');
78	var h=0;
79	if(xOp6Dn) h=window.innerHeight;
80	else if(document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientHeight)
81		h=document.documentElement.clientHeight;
82	else if(document.body && document.body.clientHeight)
83		h=document.body.clientHeight;
84	else if(xDef(window.innerWidth,window.innerHeight,document.width)) {
85		h=window.innerHeight;
86		if(document.width>window.innerWidth) h-=16;
87	}
88	return h;
89}
90
91function xClientWidth()
92{
93	xDeprecate('xClientWidth');
94	var w=0;
95	if(xOp6Dn) w=window.innerWidth;
96	else if(document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientWidth)
97		w=document.documentElement.clientWidth;
98	else if(document.body && document.body.clientWidth)
99		w=document.body.clientWidth;
100	else if(xDef(window.innerWidth,window.innerHeight,document.height)) {
101		w=window.innerWidth;
102		if(document.height>window.innerHeight) w-=16;
103	}
104	return w;
105}
106
107function xCreateElement(sTag)
108{
109	xDeprecate('xCreateElement');
110	if (document.createElement) return document.createElement(sTag);
111	else return null;
112}
113
114function xDef()
115{
116	xDeprecate('xDef');
117	for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}
118	return true;
119}
120
121function xDeleteCookie(name, path)
122{
123	xDeprecate('xDeleteCookie');
124	if (xGetCookie(name)) {
125		document.cookie = name + "=" +
126			"; path=" + ((!path) ? "/" : path) +
127			"; expires=" + new Date(0).toGMTString();
128	}
129}
130
131function xDisplay(e,s)
132{
133	xDeprecate('xDisplay');
134	if(!(e=xGetElementById(e))) return null;
135	if(e.style && xDef(e.style.display)) {
136		if (xStr(s)) e.style.display = s;
137		return e.style.display;
138	}
139	return null;
140}
141
142function xEvent(evt) // object prototype
143{
144	xDeprecate('xEvent');
145	var e = evt || window.event;
146	if(!e) return;
147	if(e.type) this.type = e.type;
148	if(e.target) this.target = e.target;
149	else if(e.srcElement) this.target = e.srcElement;
150
151	// Section B
152	if (e.relatedTarget) this.relatedTarget = e.relatedTarget;
153	else if (e.type == 'mouseover' && e.fromElement) this.relatedTarget = e.fromElement;
154	else if (e.type == 'mouseout') this.relatedTarget = e.toElement;
155	// End Section B
156
157	if(xOp6Dn) { this.pageX = e.clientX; this.pageY = e.clientY; }
158	else if(xDef(e.pageX,e.pageY)) { this.pageX = e.pageX; this.pageY = e.pageY; }
159	else if(xDef(e.clientX,e.clientY)) { this.pageX = e.clientX + xScrollLeft(); this.pageY = e.clientY + xScrollTop(); }
160
161	// Section A
162	if (xDef(e.offsetX,e.offsetY)) {
163		this.offsetX = e.offsetX;
164		this.offsetY = e.offsetY;
165	}
166	else if (xDef(e.layerX,e.layerY)) {
167		this.offsetX = e.layerX;
168		this.offsetY = e.layerY;
169	}
170	else {
171		this.offsetX = this.pageX - xPageX(this.target);
172		this.offsetY = this.pageY - xPageY(this.target);
173	}
174	// End Section A
175
176	if (e.keyCode) { this.keyCode = e.keyCode; } // for moz/fb, if keyCode==0 use which
177	else if (xDef(e.which) && e.type.indexOf('key')!=-1) { this.keyCode = e.which; }
178
179	this.shiftKey = e.shiftKey;
180	this.ctrlKey = e.ctrlKey;
181	this.altKey = e.altKey;
182}
183
184function xFirstChild(e, t)
185{
186	xDeprecate('xFirstChild');
187	var c = e ? e.firstChild : null;
188	if (t) while (c && c.nodeName != t) { c = c.nextSibling; }
189	else while (c && c.nodeType != 1) { c = c.nextSibling; }
190	return c;
191}
192
193function xGetBodyWidth() {
194	xDeprecate('xGetBodyWidth');
195	var cw = xClientWidth();
196	var sw = window.document.body.scrollWidth;
197	return cw>sw?cw:sw;
198}
199
200function xGetBodyHeight() {
201	xDeprecate('xGetBodyHeight');
202	var cw = xClientHeight();
203	var sw = window.document.body.scrollHeight;
204	return cw>sw?cw:sw;
205}
206
207function xGetComputedStyle(oEle, sProp, bInt)
208{
209	xDeprecate('xGetComputedStyle');
210	var s, p = 'undefined';
211	var dv = document.defaultView;
212	if(dv && dv.getComputedStyle){
213		s = dv.getComputedStyle(oEle,'');
214		if (s) p = s.getPropertyValue(sProp);
215	}
216	else if(oEle.currentStyle) {
217		// convert css property name to object property name for IE
218		var a = sProp.split('-');
219		sProp = a[0];
220		for (var i=1; i<a.length; ++i) {
221			c = a[i].charAt(0);
222			sProp += a[i].replace(c, c.toUpperCase());
223		}
224		p = oEle.currentStyle[sProp];
225	}
226	else return null;
227	return bInt ? (parseInt(p) || 0) : p;
228}
229
230function xGetCookie(name)
231{
232	xDeprecate('xGetCookie');
233	var value=null, search=name+"=";
234	if (document.cookie.length > 0) {
235		var offset = document.cookie.indexOf(search);
236		if (offset != -1) {
237			offset += search.length;
238			var end = document.cookie.indexOf(";", offset);
239			if (end == -1) end = document.cookie.length;
240			value = unescape(document.cookie.substring(offset, end));
241		}
242	}
243	return value;
244}
245
246function xGetElementById(e)
247{
248	xDeprecate('xGetElementById');
249	if(typeof(e)!='string') return e;
250	if(document.getElementById) e=document.getElementById(e);
251	else if(document.all) e=document.all[e];
252	else e=null;
253	return e;
254}
255
256function xGetElementsByAttribute(sTag, sAtt, sRE, fn)
257{
258	xDeprecate('xGetElementsByAttribute');
259	var a, list, found = new Array(), re = new RegExp(sRE, 'i');
260	list = xGetElementsByTagName(sTag);
261	for (var i = 0; i < list.length; ++i) {
262		a = list[i].getAttribute(sAtt);
263		if (!a) {a = list[i][sAtt];}
264		if (typeof(a)=='string' && a.search(re) != -1) {
265			found[found.length] = list[i];
266			if (fn) fn(list[i]);
267		}
268	}
269	return found;
270}
271
272function xGetElementsByClassName(c,p,t,f)
273{
274	xDeprecate('xGetElementsByClassName');
275	var found = new Array();
276	var re = new RegExp('\\b'+c+'\\b', 'i');
277	var list = xGetElementsByTagName(t, p);
278	for (var i = 0; i < list.length; ++i) {
279		if (list[i].className && list[i].className.search(re) != -1) {
280			found[found.length] = list[i];
281			if (f) f(list[i]);
282		}
283	}
284	return found;
285}
286
287function xGetElementsByTagName(t,p)
288{
289	xDeprecate('xGetElementsByTagName');
290	var list = null;
291	t = t || '*';
292	p = p || document;
293	if (xIE4 || xIE5) {
294		if (t == '*') list = p.all;
295		else list = p.all.tags(t);
296	}
297	else if (p.getElementsByTagName) list = p.getElementsByTagName(t);
298	return list || new Array();
299}
300
301function xGetURLArguments()
302{
303	xDeprecate('xGetURLArguments');
304	var idx = location.href.indexOf('?');
305	var params = new Array();
306	if (idx != -1) {
307		var pairs = location.href.substring(idx+1, location.href.length).split('&');
308		for (var i=0; i<pairs.length; i++) {
309			nameVal = pairs[i].split('=');
310			params[i] = nameVal[1];
311			params[nameVal[0]] = nameVal[1];
312		}
313	}
314	return params;
315}
316
317function xHeight(e,h)
318{
319	xDeprecate('xHeight');
320	if(!(e=xGetElementById(e))) return 0;
321	if (xNum(h)) {
322		if (h<0) h = 0;
323		else h=Math.round(h);
324	}
325	else h=-1;
326	var css=xDef(e.style);
327	if (e == document || e.tagName.toLowerCase() == 'html' || e.tagName.toLowerCase() == 'body') {
328		h = xClientHeight();
329	}
330	else if(css && xDef(e.offsetHeight) && xStr(e.style.height)) {
331		if(h>=0) {
332			var pt=0,pb=0,bt=0,bb=0;
333			if (document.compatMode=='CSS1Compat') {
334				var gcs = xGetComputedStyle;
335				pt=gcs(e,'padding-top',1);
336				if (pt !== null) {
337					pb=gcs(e,'padding-bottom',1);
338					bt=gcs(e,'border-top-width',1);
339					bb=gcs(e,'border-bottom-width',1);
340				}
341				// Should we try this as a last resort?
342				// At this point getComputedStyle and currentStyle do not exist.
343				else if(xDef(e.offsetHeight,e.style.height)){
344					e.style.height=h+'px';
345					pt=e.offsetHeight-h;
346				}
347			}
348			h-=(pt+pb+bt+bb);
349			if(isNaN(h)||h<0) return null;
350			else e.style.height=h+'px';
351		}
352		h=e.offsetHeight;
353	}
354	else if(css && xDef(e.style.pixelHeight)) {
355		if(h>=0) e.style.pixelHeight=h;
356		h=e.style.pixelHeight;
357	}
358	return h;
359}
360
361function xHex(sn, digits, prefix)
362{
363	xDeprecate('xHex');
364	var p = '';
365	var n = Math.ceil(sn);
366	if (prefix) p = prefix;
367	n = n.toString(16);
368	for (var i=0; i < digits - n.length; ++i) {
369		p += '0';
370	}
371	return p + n;
372}
373
374function xHide(e){  xDeprecate('xHide'); return xVisibility(e,0);}
375
376function xInnerHtml(e,h)
377{
378	xDeprecate('xInnerHtml');
379	if(!(e=xGetElementById(e)) || !xStr(e.innerHTML)) return null;
380	var s = e.innerHTML;
381	if (xStr(h)) {e.innerHTML = h;}
382	return s;
383}
384
385function xLeft(e, iX)
386{
387	xDeprecate('xLeft');
388	if(!(e=xGetElementById(e))) return 0;
389	var css=xDef(e.style);
390	if (css && xStr(e.style.left)) {
391		if(xNum(iX)) e.style.left=iX+'px';
392		else {
393			iX=parseInt(e.style.left);
394			if(isNaN(iX)) iX=0;
395		}
396	}
397	else if(css && xDef(e.style.pixelLeft)) {
398		if(xNum(iX)) e.style.pixelLeft=iX;
399		else iX=e.style.pixelLeft;
400	}
401	return iX;
402}
403
404function xMoveTo(e,x,y)
405{
406	xDeprecate('xMoveTo');
407	xLeft(e,x);
408	xTop(e,y);
409}
410
411function xName(e)
412{
413	xDeprecate('xName');
414	if (!e) return e;
415	else if (e.id && e.id != "") return e.id;
416	else if (e.name && e.name != "") return e.name;
417	else if (e.nodeName && e.nodeName != "") return e.nodeName;
418	else if (e.tagName && e.tagName != "") return e.tagName;
419	else return e;
420}
421
422function xNextSib(e,t)
423{
424	xDeprecate('xNextSib');
425	var s = e ? e.nextSibling : null;
426	if (t) while (s && s.nodeName != t) { s = s.nextSibling; }
427	else while (s && s.nodeType != 1) { s = s.nextSibling; }
428	return s;
429}
430
431function xNum()
432{
433	xDeprecate('xNum');
434	for(var i=0; i<arguments.length; ++i){if(isNaN(arguments[i]) || typeof(arguments[i])!='number') return false;}
435	return true;
436}
437
438function xOffsetLeft(e)
439{
440	xDeprecate('xOffsetLeft');
441	if (!(e=xGetElementById(e))) return 0;
442	if (xDef(e.offsetLeft)) return e.offsetLeft;
443	else return 0;
444}
445
446function xOffsetTop(e)
447{
448	xDeprecate('xOffsetTop');
449	if (!(e=xGetElementById(e))) return 0;
450	if (xDef(e.offsetTop)) return e.offsetTop;
451	else return 0;
452}
453
454function xPad(s,len,c,left)
455{
456	xDeprecate('xPad');
457	if(typeof s != 'string') s=s+'';
458	if(left) {for(var i=s.length; i<len; ++i) s=c+s;}
459	else {for (i=s.length; i<len; ++i) s+=c;}
460	return s;
461}
462
463function xPageX(e)
464{
465	xDeprecate('xPageX');
466	if (!(e=xGetElementById(e))) return 0;
467	var x = 0;
468	while (e) {
469		if (xDef(e.offsetLeft)) x += e.offsetLeft;
470		e = xDef(e.offsetParent) ? e.offsetParent : null;
471	}
472	return x;
473}
474
475function xPageY(e)
476{
477	xDeprecate('xPageY');
478	if (!(e=xGetElementById(e))) return 0;
479	var y = 0;
480	while (e) {
481		if (xDef(e.offsetTop)) y += e.offsetTop;
482		e = xDef(e.offsetParent) ? e.offsetParent : null;
483	}
484//  if (xOp7Up) return y - document.body.offsetTop; // v3.14, temporary hack for opera bug 130324 (reported 1nov03)
485	return y;
486}
487
488function xParent(e, bNode)
489{
490	xDeprecate('xParent');
491	if (!(e=xGetElementById(e))) return null;
492	var p=null;
493	if (!bNode && xDef(e.offsetParent)) p=e.offsetParent;
494	else if (xDef(e.parentNode)) p=e.parentNode;
495	else if (xDef(e.parentElement)) p=e.parentElement;
496	return p;
497}
498
499function xPreventDefault(e)
500{
501	xDeprecate('xPreventDefault');
502	if (e && e.preventDefault) e.preventDefault()
503	else if (window.event) window.event.returnValue = false;
504}
505
506function xPrevSib(e,t)
507{
508	xDeprecate('xPrevSib');
509	var s = e ? e.previousSibling : null;
510	if (t) while(s && s.nodeName != t) {s=s.previousSibling;}
511	else while(s && s.nodeType != 1) {s=s.previousSibling;}
512	return s;
513}
514
515function xRemoveEventListener(e,eT,eL,cap)
516{
517	xDeprecate('xRemoveEventListener');
518	if(!(e=xGetElementById(e))) return;
519	eT=eT.toLowerCase();
520	if((!xIE4Up && !xOp7Up) && e==window) {
521		if(eT=='resize') { window.xREL=null; return; }
522		if(eT=='scroll') { window.xSEL=null; return; }
523	}
524	var eh='e.on'+eT+'=null';
525	if(e.removeEventListener) e.removeEventListener(eT,eL,cap);
526	else if(e.detachEvent) e.detachEvent('on'+eT,eL);
527	else eval(eh);
528}
529
530function xResizeTo(e,w,h)
531{
532	xDeprecate('xResizeTo');
533	xWidth(e,w);
534	xHeight(e,h);
535}
536
537function xScrollLeft(e, bWin)
538{
539	xDeprecate('xScrollLeft');
540	var offset=0;
541	if (!xDef(e) || bWin || e == document || e.tagName.toLowerCase() == 'html' || e.tagName.toLowerCase() == 'body') {
542		var w = window;
543		if (bWin && e) w = e;
544		if(w.document.documentElement && w.document.documentElement.scrollLeft) offset=w.document.documentElement.scrollLeft;
545		else if(w.document.body && xDef(w.document.body.scrollLeft)) offset=w.document.body.scrollLeft;
546	}
547	else {
548		e = xGetElementById(e);
549		if (e && xNum(e.scrollLeft)) offset = e.scrollLeft;
550	}
551	return offset;
552}
553
554function xScrollTop(e, bWin)
555{
556	xDeprecate('xScrollTop');
557	var offset=0;
558	if (!xDef(e) || bWin || e == document || e.tagName.toLowerCase() == 'html' || e.tagName.toLowerCase() == 'body') {
559		var w = window;
560		if (bWin && e) w = e;
561		if(w.document.documentElement && w.document.documentElement.scrollTop) offset=w.document.documentElement.scrollTop;
562		else if(w.document.body && xDef(w.document.body.scrollTop)) offset=w.document.body.scrollTop;
563	}
564	else {
565		e = xGetElementById(e);
566		if (e && xNum(e.scrollTop)) offset = e.scrollTop;
567	}
568	return offset;
569}
570
571function xSetCookie(name, value, expire, path)
572{
573	xDeprecate('xSetCookie');
574	document.cookie = name + "=" + escape(value) +
575		((!expire) ? "" : ("; expires=" + expire.toGMTString())) +
576		"; path=" + ((!path) ? "/" : path);
577}
578
579function xShow(e) { xDeprecate('xShow'); return xVisibility(e,1);}
580
581
582function xStr(s)
583{
584	xDeprecate('xStr');
585	for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])!='string') return false;}
586	return true;
587}
588
589function xTop(e, iY)
590{
591	xDeprecate('xTop');
592	if(!(e=xGetElementById(e))) return 0;
593	var css=xDef(e.style);
594	if(css && xStr(e.style.top)) {
595		if(xNum(iY)) e.style.top=iY+'px';
596		else {
597			iY=parseInt(e.style.top);
598			if(isNaN(iY)) iY=0;
599		}
600	}
601	else if(css && xDef(e.style.pixelTop)) {
602		if(xNum(iY)) e.style.pixelTop=iY;
603		else iY=e.style.pixelTop;
604	}
605	return iY;
606}
607
608function xVisibility(e, bShow)
609{
610	xDeprecate('xVisibility');
611	if(!(e=xGetElementById(e))) return null;
612	if(e.style && xDef(e.style.visibility)) {
613		if (xDef(bShow)) e.style.visibility = bShow ? 'visible' : 'hidden';
614		return e.style.visibility;
615	}
616	return null;
617}
618
619function xWidth(e,w)
620{
621	xDeprecate('xWidth');
622	if(!(e=xGetElementById(e))) return 0;
623	if (xNum(w)) {
624		if (w<0) w = 0;
625		else w=Math.round(w);
626	}
627	else w=-1;
628	var css=xDef(e.style);
629	if (e == document || e.tagName.toLowerCase() == 'html' || e.tagName.toLowerCase() == 'body') {
630		w = xClientWidth();
631	}
632	else if(css && xDef(e.offsetWidth) && xStr(e.style.width)) {
633		if(w>=0) {
634			var pl=0,pr=0,bl=0,br=0;
635			if (document.compatMode=='CSS1Compat') {
636				var gcs = xGetComputedStyle;
637				pl=gcs(e,'padding-left',1);
638				if (pl !== null) {
639					pr=gcs(e,'padding-right',1);
640					bl=gcs(e,'border-left-width',1);
641					br=gcs(e,'border-right-width',1);
642				}
643				// Should we try this as a last resort?
644				// At this point getComputedStyle and currentStyle do not exist.
645				else if(xDef(e.offsetWidth,e.style.width)){
646					e.style.width=w+'px';
647					pl=e.offsetWidth-w;
648				}
649			}
650			w-=(pl+pr+bl+br);
651			if(isNaN(w)||w<0) return null;
652			else e.style.width=w+'px';
653		}
654		w=e.offsetWidth;
655	}
656	else if(css && xDef(e.style.pixelWidth)) {
657		if(w>=0) e.style.pixelWidth=w;
658		w=e.style.pixelWidth;
659	}
660	return w;
661}
662
663function xZIndex(e,uZ)
664{
665	xDeprecate('xZIndex');
666	if(!(e=xGetElementById(e))) return 0;
667	if(e.style && xDef(e.style.zIndex)) {
668		if(xNum(uZ)) e.style.zIndex=uZ;
669		uZ=parseInt(e.style.zIndex);
670	}
671	return uZ;
672}
673
674function xStopPropagation(evt)
675{
676	xDeprecate('xStopPropagation');
677	if (evt && evt.stopPropagation) evt.stopPropagation();
678	else if (window.event) window.event.cancelBubble = true;
679}

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.