PageSourceSearch

https://dabasdati.lv/site/t/main.js

js dabasdati.lv collected 2026-10-02 12:49:25 UTC 12,374 bytes, 494 lines download raw bytes

1function nothing() {
2	return;
3}
4
5function CheckAll(obj) {
6	var form_obj = obj.form
7	for (i = 0;i < form_obj.length;i++ )	{
8		if (form_obj.elements[i].type == "checkbox") {
9			form_obj.elements[i].checked = (obj.checked) ? true : false;
10		}
11	}
12	return;
13}
14
15function ShowD(t) {
16	var currStyle = document.getElementById(t).style.display; var cact;
17	if ( currStyle == 'block' ) { cact = 'none'; } else { cact = 'block'; }
18	document.getElementById(t).style.display = cact;
19	return;
20}
21
22function ShowAct(t,veids) {
23	if (document.getElementById(t)) {
24		var currStyle = document.getElementById(t).style.display; var cact;
25		if ( veids == '0' ) { cact = 'none'; } else { cact = 'block'; }
26		document.getElementById(t).style.display = cact;
27	}
28	return;
29}
30
31function SetHTML(t,b) {
32	document.getElementById(t).innerHTML=b;
33	return;
34}
35
36function GetVal(t) {
37	if (document.getElementById(t)) {
38		v=document.getElementById(t).value;
39	} else {
40		v=document.getElementsByName(t)[0].value;
41	}
42	return v;
43}
44
45function GetValCheckBox(t) {
46	if (document.getElementById(t).checked==true) { v=1; } else { v=0; }
47	return v;
48}
49
50function GetValByName(t) {
51	return document.getElementsByName(t)[0].value;
52}
53
54function GetCheckedByName(t) {
55	let statuss=document.getElementsByName(t)[0];
56	return (statuss.checked==true?1:0);
57}
58
59function SetVal(t,v) {
60	document.getElementById(t).value = v;
61	return;
62}
63
64function SetFocus(i) {
65	document.getElementById(i).focus();
66	return;
67}
68
69function GetValByName(t) {
70	return document.getElementsByName(t)[0].value;
71}
72
73function locate(u) {
74	window.location.href=u;
75	return;
76}
77
78function locatenew(u) {
79	Win=this.open(u);
80	return
81}
82
83function WinClose() {
84	window.close();
85}
86
87function RefreshCurrentPage() {
88	var href = window.location.href;
89	window.location.assign(href);
90}
91
92function RefreshOpenerPage() {
93	var href = window.opener.location.href;
94	window.opener.location.assign(href);
95}
96
97function hidediv(pass) {
98var divs = document.getElementsByTagName('div');
99	for(i=0;i<divs.length;i++){
100		if(divs[i].id.match(pass)){
101			if (document.getElementById) // DOM3 = IE5, NS6
102			divs[i].style.display="none";// show/hide
103		else
104			if (document.layers) // Netscape 4
105			document.layers[divs[i]].display = 'none';
106			else // IE 4
107			document.all.hideShow.divs[i].display = 'none';
108		}
109	}
110	return;
111}
112
113function showdiv(pass) {
114	let divs = document.getElementsByTagName('div');
115	for(i=0;i<divs.length;i++){
116		if(divs[i].id.match(pass)){
117			if (document.getElementById) // DOM3 = IE5, NS6
118			divs[i].style.display="block";// show/hide
119		else
120			if (document.layers) // Netscape 4
121			document.layers[divs[i]].display = 'block';
122			else // IE 4
123			document.all.hideShow.divs[i].display = 'block';
124		}
125	}
126	return;
127}
128
129function openWin(page, i, width, height) {
130	window.name = "main";
131	if(!width) width=488;
132	if(!height) height=270;
133	Win=this.open(page, 'win'+i, "toolbar=no,scrollbars=yes,resizable=no,status=yes,height="+height+",width="+width);
134	if (Win) Win.focus();
135	return;
136}
137
138nereidFadeObjects = new Object();
139nereidFadeTimers = new Object();
140
141function nereidFade(object, destOp, rate, delta) {
142	if (!document.all)
143		return
144	if (object != "[object]") {
145		setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
146		return;
147	}
148	clearTimeout(nereidFadeTimers[object.sourceIndex]);
149	diff = destOp-object.filters.alpha.opacity;
150	direction = 1;
151	if (object.filters.alpha.opacity > destOp) {
152		direction = -1;
153	}
154	delta=Math.min(direction*diff,delta);
155	object.filters.alpha.opacity+=direction*delta;
156	if (object.filters.alpha.opacity != destOp) {
157		nereidFadeObjects[object.sourceIndex]=object;
158		nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
159	}
160}
161
162function echeck(str) {
163
164var at="@"
165var dot="."
166var lat=str.indexOf(at)
167var lstr=str.length
168var ldot=str.indexOf(dot)
169if (str.indexOf(at)==-1){ return false; }
170if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false; }
171if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false; }
172if (str.indexOf(at,(lat+1))!=-1){ return false; }
173if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false; }
174if (str.indexOf(dot,(lat+2))==-1){ return false; }
175if (str.indexOf(" ")!=-1){ return false; }
176return true;
177}
178
179function trim(stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g,""); }
180
181function updateTimeIndex() {
182var st = document.getElementsByName("ddlStartTime")[0]
183var et = document.getElementsByName("ddlEndTime")[0]
184if (st.selectedIndex<84) {
185et.selectedIndex=(st.selectedIndex + 12)
186} else {
187et.selectedIndex=(st.selectedIndex-84)
188}
189return false;
190}
191
192function refresh() { window.location.reload(false); return; }
193
194function ClassName(id,cl) {
195	if (document.getElementById(id)) {
196		document.getElementById(id).className=cl;
197	}
198	return;
199}
200
201function SetBody(id,b) { document.getElementById(id).innerHTML=b;return; }
202
203function ub(){getdim = getPageSizeWithScroll();y=getdim[1]; if (document.getElementById('pb')) { document.getElementById('pb').style.height=y+"px"; } return; }
204
205function getPageSizeWithScroll(){
206if (window.innerHeight && window.scrollMaxY) {
207	yWithScroll = window.innerHeight + window.scrollMaxY;
208	xWithScroll = window.innerWidth + window.scrollMaxX;
209} else if (document.body.scrollHeight > document.body.offsetHeight){
210	yWithScroll = document.body.scrollHeight;
211	xWithScroll = document.body.scrollWidth;
212} else {
213	yWithScroll = document.body.offsetHeight;
214	xWithScroll = document.body.offsetWidth;
215}
216arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
217return arrayPageSizeWithScroll;
218}
219
220function GetInnerDimensions() {
221	if (window.innerHeight) {
222		win_y = window.innerHeight;
223		win_x = window.innerWidth;
224	} else {
225		win_y = ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight )
226		win_x = ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth )
227	}
228	return Array(win_x,win_y);
229}
230
231window.onresize = function() { ub(); return; }
232
233
234function alpha(e) {
235	var k;
236	document.all ? k = e.keyCode : k = e.which;
237	return ((k > 47 && k <= 57) || k == 43 || k == 8 || k == 0);
238}
239
240function IsNumeric(sText) {
241	let ValidChars = "0123456789";
242	let IsNumber=true;
243	let Char;
244	for (let i = 0; i < sText.length && IsNumber == true; i++) {
245		Char = sText.charAt(i);
246		if (ValidChars.indexOf(Char) == -1){
247			IsNumber = false;
248			break;
249		}
250	}
251	return IsNumber;
252}
253
254var checkboxstarted=0;
255function ChkBoxStatus(v1,v2) {
256	if (checkboxstarted==0) {
257		checkboxstarted=1;
258		v=document.getElementsByName(v1)[0].checked;
259		document.getElementsByName(v2)[0].checked=v;
260	}
261	checkboxstarted=0;
262	return;
263}
264
265function ChkMaxVal(id,v,v2) {
266	if (v<v2) document.getElementsByName(id)[0].value=v;
267}
268
269function dump(arr,level) {
270	var dumped_text = "";
271	if(!level) level = 0;
272
273	var level_padding = "";
274	for(var j=0;j<level+1;j++) level_padding += "    ";
275
276	if(typeof(arr) == 'object') {
277		for(var item in arr) {
278			var value = arr[item];
279
280			if(typeof(value) == 'object') {
281				dumped_text += level_padding + "'" + item + "' ...\n";
282				dumped_text += dump(value,level+1);
283			} else {
284				dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
285			}
286		}
287	} else {
288		dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
289	}
290	return dumped_text;
291}
292
293function uploadFile(obj) {
294	ShowAct('uploader',0);
295	ShowAct('loading',1);
296	document.getElementById('loading').innerHTML="<img src='/site/img/loading.gif' alt='loading...'>";
297	document.getElementById('UploadFormName').submit();
298}
299
300function uploadMp3(obj) {
301	ShowAct('mp3uploader',0);
302	ShowAct('mp3loading',1);
303	document.getElementById('mp3loading').innerHTML="<img src='/site/img/loading.gif' alt='loading...'>";
304	document.getElementById('Mp3UploadFormName').submit();
305}
306
307
308function ShowActOpener(t,veids){
309	var currStyle = parent.document.getElementById(t).style.display; var cact;
310	if ( veids == '0' ) { cact = 'none'; } else { cact = 'block'; }
311	parent.document.getElementById(t).style.display = cact;
312	return;
313}
314
315function DataSaved() {
316ShowAct('statusWindow',1);
317setTimeout("DataSavedRemove()",300);
318return;
319}
320function DataSavedRemove() {
321ShowAct('statusWindow',0);
322}
323
324function ResetCssStyle(id,fromval,toval,val) {
325	toval2=toval+1;
326	for (i = fromval;i<toval2; i++ ) {
327		className=id+i;
328		if (document.getElementById(className)) {
329			document.getElementById(className).className=val;
330		}
331	}
332}
333
334var idtoclear,lastpid,lastid,lasttype;
335
336function LoadComments(pid,id,v){
337lasttype=v;
338GetUrl("/site/sw/comments.php?pid="+pid+'&v='+v,id);
339}
340
341function ClearAndRefresh() {
342document.getElementsByName(idtoclear)[0].value='';
343LoadComments(lastpid,lastid,lasttype);
344}
345
346function SendComment(i,p,i2,t){
347	myForm = new FormData();
348	myForm.append('p',p);
349	myForm.append('t',t);
350	myForm.append('v',document.getElementsByName(i)[0].value);
351	$.ajax({url:'/site/sw/addcomment.php',type:'post',data:myForm,processData:false,contentType:false})
352		.done(function(data){lastpid=p;idtoclear=i;lastid=i2;ClearAndRefresh();})
353		.fail(function(data){lastpid=p;idtoclear=i;lastid=i2;ClearAndRefresh();});
354}
355
356function SendCommentWTF(i,p,i2,t) {
357var v=document.getElementsByName(i)[0].value;
358d="p="+p+"&v="+v+'&t='+t;
359Sw("/site/sw/addcomment.php",d);
360idtoclear=i;
361lastpid=p;
362lastid=i2;
363setTimeout("ClearAndRefresh()",500);
364}
365
366function ActivitiesWithImage(i,q) {
367if (confirm(q)) {
368d="i="+i; Sw("/site/sw/image_hide.php",d);
369}
370}
371
372function ActivitiesWithObservation(i,q) {
373if (confirm(q)) {
374d="i="+i; Sw("/site/sw/observation_hide.php",d);
375}
376}
377
378function ActivitiesWithComments(i,q) {
379if (confirm(q)) {
380d="i="+i; Sw("/site/sw/comment_hide.php",d);
381setTimeout("RefreshCurrentPage()",500);
382}
383}
384
385
386function urlencode( str ) {
387	var histogram = {}, histogram_r = {}, code = 0, tmp_arr = [];
388	var ret = str.toString();
389	var replacer = function(search, replace, str) {
390		var tmp_arr = [];
391		tmp_arr = str.split(search);
392		return tmp_arr.join(replace);
393	};
394
395	histogram['!']   = '%21';
396	histogram['%20'] = '+';
397
398	ret = encodeURIComponent(ret);
399	for (search in histogram) {
400		replace = histogram[search];
401		ret = replacer(search, replace, ret)
402	}
403	return ret.replace(/(\%([a-z0-9]{2}))/g, function(full, m1, m2) {
404		return "%"+m2.toUpperCase();
405	});
406	//return ret;
407}
408
409function Delete_Cookie( name, path, domain ) {
410if ( Get_Cookie( name ) ) document.cookie = name + "=" +
411( ( path ) ? ";path=" + path : "") +
412( ( domain ) ? ";domain=" + domain : "" ) +
413";expires=Thu, 01-Jan-1970 00:00:01 GMT";
414}
415
416function Get_Cookie( check_name ) {
417	var a_all_cookies = document.cookie.split( ';' );
418	var a_temp_cookie = '';
419	var cookie_name = '';
420	var cookie_value = '';
421	var b_cookie_found = false; // set boolean t/f default f
422
423	for ( i = 0; i < a_all_cookies.length; i++ )
424	{
425		a_temp_cookie = a_all_cookies[i].split( '=' );
426
427		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
428
429		if ( cookie_name == check_name )
430		{
431			b_cookie_found = true;
432			if ( a_temp_cookie.length > 1 )
433			{
434				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
435			}
436			return cookie_value;
437			break;
438		}
439		a_temp_cookie = null;
440		cookie_name = '';
441	}
442	if ( !b_cookie_found )
443	{
444		return null;
445	}
446}
447
448function Delete_Cookie2() {
449document.cookie = 'cfguserid= ; expires=Thu, 2 Aug 2001 20:47:11 UTC; path=/';
450}
451
452function UpdateLastObs(v) {
453url='/site/sw/getlastobservations.php?v='+v;
454GetUrl(url,'cfglastobsinc');
455return;
456}
457
458function SetTdWdt(id,v) {
459if (document.getElementById(id)) {
460	alert(id +' -> '+ v);
461	document.getElementById(id).style.width=v;
462}
463}
464
465function GetTdWdt(id) {
466if (document.getElementById(id)) {
467	return document.getElementById(id).offsetWidth;
468}
469}
470
471function PrintPreview(l,o) {
472url='/'+l+'/print/'+o+'/';
473openWin(url, 'preview'+o, 781, 600);
474}
475
476function PrintPreviewArticle(l,o) {
477url='/'+l+'/printpreview/'+o+'/';
478openWin(url, 'previewarticle'+o, 781, 600);
479}
480
481function DraugiemSay( title, url, titlePrefix ){
482 window.open(
483  'http://www.draugiem.lv/say/ext/add.php?title=' + encodeURIComponent( title ) +
484  '&link=' + encodeURIComponent( url ) +
485  ( titlePrefix ? '&titlePrefix=' + encodeURIComponent( titlePrefix ) : '' ),
486  '',
487  'location=1,status=1,scrollbars=0,resizable=0,width=530,height=400'
488 );
489 return false;
490}
491
492function Pending(t) {
493	SetHTML(t,"<div align=center><img border=0 src=/site/img/waiting.gif></div>");
494}

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.