PageSourceSearch

https://www.tokyo23-kuchokai-kiko.jp/js/search.js

js tokyo23-kuchokai-kiko.jp collected 2026-10-05 06:25:57 UTC 5,262 bytes, 138 lines download raw bytes

1var url = "https://ilisod001.apsel.jp/xxxxxx/wopc/pc/OpacServlet?disp=simpleSearch&Resource=ja_AD";
2var encode = "UTF-8";
3var type = "2";
4var minimamLength = 2;
5var isUseZenbun = false;
6var confirmMessage = "完全一致検索を行います。よろしいですか?";
7var requireKeyword = "検索キーワードが未入力です。";
8
9// common function for http communication
10function createXMLHttpRequest(cbFunc) {
11    var XMLhttpObject = null;
12    try {
13        XMLhttpObject = new XMLHttpRequest();
14    } catch(e) {
15        try {
16            XMLhttpObject = new ActiveXObject("Msxml2.XMLHTTP");
17        } catch(e) {
18            try {
19                XMLhttpObject = new ActiveXObject("Microsoft.XMLHTTP");
20            } catch(e) {
21                return null;
22            }
23        }
24    }
25    if (XMLhttpObject) {
26        XMLhttpObject.onreadystatechange = cbFunc;
27    }
28    return XMLhttpObject;
29}
30
31// This function acquire informations for keyword checks.
32function searchInit() {
33    httpObj = createXMLHttpRequest(initData);
34    if (httpObj) {
35        httpObj.open("POST",url,"sync");
36        httpObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=' + encode);
37        httpObj.send("searchTipInit=1");
38    }
39}
40// This function analyze the data acquired in searchInit function, and store it in global variable. 
41function initData() {
42    if ((httpObj.readyState == 4) && (httpObj.status == 200)) {
43        xmlData = httpObj.responseXML;
44        resultTags = xmlData.getElementsByTagName("result");
45        minimamLength = resultTags[0].childNodes[0].firstChild.nodeValue;
46        isUseZenbun = ("true" == resultTags[0].childNodes[1].firstChild.nodeValue);
47        confirmMessage = resultTags[0].childNodes[2].firstChild.nodeValue;
48        requireKeyword = resultTags[0].childNodes[3].firstChild.nodeValue;
49    }
50}
51// This function execute a keyword search.
52function dataSend() {
53    if (!checkLength()) {
54        return false;
55    }
56    if (type == 2) {
57        document.forms['simpleSearchForm'].action = url;
58        document.forms['simpleSearchForm'].elements['enc'].value = encode;
59        document.forms['simpleSearchForm'].elements['type'].value = type;
60        document.forms['simpleSearchForm'].submit();
61    } else {
62        var textData = document.simpleSearchForm.searchword.value;
63        httpObj = createXMLHttpRequest(displayData);
64        if (httpObj) {
65            httpObj.open("POST",url,"sync");
66            httpObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=' + encode);
67            httpObj.send("searchword=" + textData + "&type=" + type);
68        }
69    }
70}
71// This function analyze search results, and display error message or redirect for search result list. 
72function displayData() {
73    if ((httpObj.readyState == 4) && (httpObj.status == 200)) {
74        xmlData = httpObj.responseXML;
75        resultTags = xmlData.getElementsByTagName("result");
76        flg = resultTags[0].childNodes[0].firstChild.nodeValue;
77        if (flg == 0) {
78            if (type == 0) {
79                document.getElementById('notFoundMessage').innerHTML = "<b><font color=#C14923>" + resultTags[0].childNodes[1].firstChild.nodeValue + "</font></b>";
80            } else {
81                document.getElementById('notFoundMessage').innerHTML = "&nbsp;";
82                alert(resultTags[0].childNodes[1].firstChild.nodeValue);
83            }
84            selectText();
85        } else {
86            document.getElementById('notFoundMessage').innerHTML = "&nbsp;";
87            document.location = resultTags[0].childNodes[1].firstChild.nodeValue;
88        }
89    } else {
90        document.getElementById('notFoundMessage').innerHTML = "<b>Wait...</b>";
91    }
92}
93//This function checks length of keyword.
94function checkLength() {
95    var keyword = document.forms['simpleSearchForm'].elements['searchword'].value;
96    var fullSpace = document.forms['simpleSearchForm'].elements['fullSpace'].value;
97    keyword = keyword.replace(/ /g, fullSpace);
98    var flg = false;
99    var flg2 = false;
100    ary = keyword.split(fullSpace);
101    for (var i = 0; i < ary.length; i++) {
102        ary[i] = ary[i].replace(/ /g, '');
103        if (ary[i] == '') {
104            flg2 = true;
105            continue;
106        }
107        if (ary[i].length <= minimamLength) {
108            flg = true;
109            break;
110        }
111        flg2 = false;
112    }
113    if (flg && !isUseZenbun) {
114        if (!confirm(confirmMessage)) return false;
115    }
116    if (flg2) {
117        if (type == 0) {
118            document.getElementById('notFoundMessage').innerHTML = "<b><font color=#C14923>" + requireKeyword + "</font></b>";
119        } else {
120            if (type == 1) {
121                document.getElementById('notFoundMessage').innerHTML = "&nbsp;";
122            }
123            alert(requireKeyword);
124            setFocusForInputform();
125        }
126        return false;
127    }
128    return true;
129}
130//This function set focus on text area.
131function setFocusForInputform() {
132    document.forms['simpleSearchForm'].elements['searchword'].focus();
133}
134// This function makes the character string of the text box a choice state.
135function selectText() {
136    setFocusForInputform();
137    document.forms['simpleSearchForm'].elements['searchword'].select();
138}

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.