PageSourceSearch

https://www.nttdata-tokai.co.jp/common/assets/js/common-form-action.js

js nttdata-tokai.co.jp collected 2026-10-04 13:31:23 UTC 2,074 bytes, 59 lines download raw bytes

1/*---------------------------------
2// サジェスト取得処理
3---------------------------------*/
4var currentRequest = null;
5var formSubmitFlag = false;
6var currentRequestTimer = null;
7var currentRequestTimerFunc = function () {
8    var me = $('#search-box');
9    currentRequest = $.ajax({
10        url: window.location.href,
11        type: "POST",
12        context: me,
13        data: {
14            scController: "SearchJapan", scAction: "GetSuggestions", searchKeyword: $(me).val()
15        },
16        success: function (data) {
17            $('.l-header-search-suggestions').replaceWith($(data).find('.l-header-search-suggestions'));
18            $('.l-header-search-results').replaceWith($(data).find('.l-header-search-results'));
19            $('.l-header-search-results').find('a').each(function () {
20                if ($(this).text().match(/<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/)) {
21                    $(this).text($(this).text().replace(/(<([^>]+)>)/ig, ""));
22                }
23            });
24
25            $('.l-header-search-suggestions').addClass('is-show');
26            $('.l-header-search-suggestions').css({
27                'opacity': '1'
28            });
29            $('.l-header-search-results').show();
30        }
31    });
32};
33
34/*サイト内検索Form submitイベント */
35$('.l-header-search').children('form').submit(function (e) {
36    clearTimeout(currentRequestTimer);
37    if (currentRequest != null) {
38        currentRequest.abort();
39    }
40    formSubmitFlag = true;
41});
42
43/*サジェスト取得 */
44function getSuggestData() {
45    clearTimeout(currentRequestTimer);
46    //既に検索実行中の場合は、アボートでキャンセルさせる
47    if (currentRequest != null) {
48        currentRequest.abort();
49
50    }
51    //submitされた場合は検索を行わない
52    if (formSubmitFlag) {
53        return true;
54    }
55    //規定時間に達するまで検索をWaitする
56    currentRequestTimer = setTimeout(currentRequestTimerFunc, 500);
57
58}
59

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.