PageSourceSearch

https://www.100bestbooks.ru/script/utils.js

js 100bestbooks.ru collected 2026-10-02 10:11:13 UTC 1,830 bytes, 83 lines download raw bytes

1var msgTimeout;
2
3function trim(stringToTrim) {
4	if (stringToTrim == null) {
5		return null;
6	}
7	return stringToTrim.replace(/^\s+|\s+$/g,"");
8}
9
10function setFocus(sObjId) {
11	if (sObjId != null) {
12		var obj = document.getElementById(sObjId);
13		if (obj != null) {
14			obj.focus();
15		}
16	}
17}
18
19function validText(inputId, defVal) {
20	var obj = document.getElementById(inputId);
21	var s = trim(obj.value);
22	return s.length > 1 && s != defVal;
23}
24
25function onEnterKey(e, inputId, defVal) {
26	var key;     
27    if(window.event) {
28		key = window.event.keyCode; //IE
29    } else {
30		key = e.which; //firefox     
31    }
32    if (key == 13) {
33    	return validText(inputId, defVal);
34    }
35    return true;
36}
37
38function onEnterKeyVote(e, inputId, defVal, queryInputId, voteFormName) {
39	var key;     
40    if(window.event) {
41		key = window.event.keyCode; //IE
42    } else {
43		key = e.which; //firefox     
44    }
45    if (key == 13) {
46    	if (validText(inputId, defVal)) {
47    		doSearchVote(inputId, defVal, queryInputId, voteFormName);
48    	}
49    	return false;
50    }
51    return true;
52}
53
54function doSearch(inputId, formName, defVal) {
55	if (validText(inputId, defVal)) {
56		clearTimeout(msgTimeout);
57		document.forms[formName].submit();
58	}
59}
60
61function doSearchVote(inputId, defVal, queryInputId, voteFormName) {
62	if (validText(inputId, defVal)) {
63		var q = document.getElementById(inputId).value;
64		var qVote = document.getElementById(queryInputId).value = q;
65		document.forms[voteFormName].action = 'search.php';
66		clearTimeout(msgTimeout);
67		document.forms[voteFormName].submit();
68	}
69}
70
71function clearText(inputId, str) {
72	var obj = document.getElementById(inputId);
73	if (trim(obj.value) == str) {
74		obj.value = "";
75	}
76}
77
78function setText(inputId, str) {
79	var obj = document.getElementById(inputId);
80	if (trim(obj.value) == "") {
81		obj.value = str;
82	}
83}

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.