PageSourceSearch

https://cpk.si/js/functions.js

js cpk.si collected 2026-10-08 04:07:35 UTC 4,379 bytes, 184 lines download raw bytes

1//check if just one checkbox is checked
2function isChecked(formId, message) {
3	var form = document.getElementById(formId);
4	
5	for(i=0; i<form.elements.length; i++){
6		if(form.elements[i].checked == true){
7			return true;
8		}
9	}
10	alert(message);
11	return false;
12}
13
14//mail decode
15function mDec(ensl, enlsShow, addToHref, insertHtml) {
16	if (enlsShow == undefined || enlsShow == "") {
17		enlsShow = ensl;
18	}
19
20	if (addToHref == undefined) {
21		addToHref = "";
22	}
23		
24	a = "pdlowr=" + ensl;
25	nslv = "";
26	for (i=0; i<a.length; i++) {
27		n = a.charCodeAt(i)-3;
28		nslv += String.fromCharCode(n);
29	}
30	
31	s = "";
32	for (i=0; i<enlsShow.length; i++) {
33		n = enlsShow.charCodeAt(i);
34		if (n >= 35 && n <= 126) {
35			s += String.fromCharCode((n-3));
36		} else {
37			s += enlsShow.charAt(i);
38		}
39	}
40	
41	if (insertHtml == '') {
42		insertHtml = s;
43	}
44	
45	document.write("<a class=\"email\" href=\"" + nslv + addToHref + "\">"+insertHtml+"</a>");
46}
47
48/*
49 * Bookmark the current page
50 * title = bookmark title
51 * url = bookmark url
52 */
53function arctBookmarkIt(title,url) {
54	if (window.sidebar) // firefox
55		window.sidebar.addPanel(title, url, "");
56	else if (window.opera && window.print) { // opera
57		var elem = document.createElement('a');
58		elem.setAttribute('href',url);
59		elem.setAttribute('title',title);
60		elem.setAttribute('rel','sidebar');
61		elem.click();
62	}
63	else if (document.all)// ie
64		window.external.AddFavorite(url, title);
65}
66
67/*
68 * Set the page as the home page - Only works in IE
69 * object = this
70 * url = 'http://www.karkoli.com'
71 */
72function arctSetAsHomepage(object, url) {
73	if (document.all) { // ie
74		document.body.style.behavior='url(#default#homepage)';
75		document.body.setHomePage(url);
76	}
77}
78
79/*
80 * function get elements by class name ... simiar to getElementsByTagName
81 * leave container arg out, and will default to document.
82 */
83function getElementsByClassName(className, container) {
84  if (!container) {
85  	container = document;
86  }
87  if (container.all) {
88  	var all = container.all;
89  } else {
90  	var all = container.getElementsByTagName('*');
91  }
92  var arr = [] ;
93  for(var k=0;k<all.length;k++) {
94    if (all[k].className == className) {
95      arr[arr.length] = all[k];
96     }
97  }
98  return arr;
99}
100
101/*
102 * Closes a tree of uls/lis (a menu for example) if scripts are enabled. Else leaves
103 * the list open, so it is accessible to other users.
104 * Note: this could be done in jQuery, but the list needs to close
105 * as soon as it is loaded, so jQuery is not an option here.
106 */
107function closeList(listId, sublevelsClassName, closeAtLevel) {
108	var list = document.getElementById(listId);
109	
110	for (i = closeAtLevel; i < 5; ++i) {
111		var aUls = getElementsByClassName(sublevelsClassName+i, list);
112		for (j = 0; j < aUls.length; ++j) {
113			if (aUls[j].tagName == 'UL') { // only close ULs
114				aUls[j].style.display = "none";
115			}
116		}
117	}
118}
119
120/*
121 * Closes any element by ID
122 */
123function hideElementById(elId) {
124	var el = document.getElementById(elId);
125	el.style.display = "none";
126}
127
128/*
129 * Closes any element by className
130 */
131function hideElementByClassName(elClassName) {
132	var els = getElementsByClassName(elClassName);
133	for(var i=0;i<els.length;i++) {
134		els[i].style.display = "none";
135	}
136	
137}
138
139function isArray(obj) {
140   return (obj.constructor.toString().indexOf("Array") == -1) ? false : true;
141}
142
143function display(contents) {
144	var resultDiv = document.getElementById("institut-area-filter");
145	resultDiv.innerHTML = contents;
146}
147
148function proces() {
149	var procesDiv = document.getElementById("institut-area-filter");
150	procesDiv.innerHTML = "Nalagam...";
151}
152
153function procesResult() {
154	var procesDiv = document.getElementById("result-container");
155	procesDiv.innerHTML = "Nalagam...";
156}
157
158function checkUncheckAll(FormName, idName, checkName) {
159	var i = 1;
160	var idName = idName;
161	var FormName = document.getElementById(FormName);
162
163	for (i = 0; i <= FormName.elements.length; i++) {
164		if (FormName.elements[i]) {
165			if (typeof checkName == 'undefined') {
166				if (FormName.elements[i].name.match(idName)) {
167					if (FormName.checker.checked == true) {
168						FormName.elements[i].checked = true;
169					} else {
170						FormName.elements[i].checked = false;
171					}
172				}
173			} else {
174				if (FormName.elements[i].name.match(idName)) {
175					if (FormName[checkName].checked == true) {
176						FormName.elements[i].checked = true;
177					} else {
178						FormName.elements[i].checked = false;
179					}
180				}
181			}
182		}
183	}
184}

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.