PageSourceSearch

https://www.p-portal.go.jp/pps-web-biz/resources/app/javascript/common/common.js?verno=001

js p-portal.go.jp collected 2026-10-03 21:38:26 UTC 13,589 bytes, 352 lines download raw bytes

1/*=============================
2アコーディオンコンテンツ
3=============================*/
4$(function () {
5    /* メニューのアコーディオン */
6    $('.acodion_on').on('click', function () {
7        $(this).toggleClass('is-active');
8        if ($('.gnavi-side-on').hasClass('is-active') == true) {
9            $('.is-active').next('.gnavi-side-content').animate({
10                width: 'toggle'
11            }, 'fast')
12            $('.gnavi-side-on').removeClass('is-active');
13            $('.contract_work').removeClass('is-active');
14        }
15        $(this).next('.acodion_content').slideToggle();
16        var acodionMessage = $(this).html();
17        // PP更改
18        if (acodionMessage.match(/現在の検索条件を表示する/)) {
19            var str = acodionMessage.replace(/現在の検索条件を表示する/, '現在の検索条件を閉じる');
20            $(this).html(str);
21        } else if (acodionMessage.match(/現在の検索条件を閉じる/)) {
22            var str = acodionMessage.replace(/現在の検索条件を閉じる/, '現在の検索条件を表示する');
23            $(this).html(str);
24        } else if (acodionMessage.match(/検索条件を変更する/)) {
25            var str = acodionMessage.replace(/検索条件を変更する/, '検索条件を閉じる');
26            $(this).html(str);
27        } else if (acodionMessage.match(/検索条件を閉じる/)) {
28            var str = acodionMessage.replace(/検索条件を閉じる/, '検索条件を変更する');
29            $(this).html(str);
30        } else {
31            if (acodionMessage.match(/開く/)) {
32                var str = acodionMessage.replace(/開く/, '閉じる');
33                $(this).html(str);
34            } else if (acodionMessage.match(/閉じる/)) {
35                var str = acodionMessage.replace(/閉じる/, '開く');
36                $(this).html(str);
37            }
38        }
39    });
40
41    /* メニューのアコーディオン(中) */
42    $('.gnavi-side-on').on('click', function () {
43        if ($(this).hasClass('is-active') == false) {
44            $('.is-active').next('.gnavi-side-content').animate({
45                width: 'toggle'
46            }, 'fast')
47            $('.gnavi-side-on').removeClass('is-active');
48            $('.contract_work').removeClass('is-active');
49        }
50        $(this).toggleClass('is-active');
51        $(this).parent('li').toggleClass('is-active')
52        $(this).next('.gnavi-side-content').animate({
53            width: 'toggle'
54        }, 'fast')
55    });
56});
57
58/*メニュー以外クリックでメニューを閉じる */
59$(function () {
60    $('nav').click(function (e) {
61        e.stopPropagation()
62    });
63    $(document).click(function (e) {
64        if ($('.aside-inner-menu').hasClass('is-active') == true) {
65            $('.aside-inner-menu').toggleClass('is-active');
66            $('.aside-inner-menu').next('.acodion_content').slideToggle();
67        }
68    });
69});
70
71
72/*=============================
73フォーカス動作
74=============================*/
75
76$(function () {
77    /*フォーカスclickでフォーカス外す
78    IEのチェックボックスとラジオボタンのみフォーカスを外してまた付ける*/
79    $('a,.type-select,.tip-icn,.tip-txt-close,img,button,.Items,.table-check,.table-radio,.gnavi-side-content,.acodion_bar,.acodion_btn,.pager-link,.type-reflect,.result-squeeze input,.fixed-totop').on('click', function () {
80        var clickLink = $(this).attr('href');
81        var targetItem = $(this).attr('class');
82        var currentFocus = document.activeElement;
83        var userAgent = window.navigator.userAgent.toLowerCase();
84        if (clickLink == undefined || clickLink == '#') {
85            $(document.activeElement).blur();
86        }
87        if (userAgent.indexOf('edge') != -1 || userAgent.indexOf('trident/7') != -1 && event.keyCode === 13) {
88            if (targetItem == 'type-select') {
89                setTimeout(function () {
90                    $('.main-modal-inner').focus();
91                }, 0);
92            } else {
93                setTimeout(function () {
94                    $(currentFocus).focus();
95                }, 0);
96            }
97        }
98    });
99});
100
101/*フォーカス時にEnterでclickイベント発火*/
102$(function () {
103    $('a,.type-select,.tip-icn,.tip-txt-close,img,button,.Items,.table-check,.table-radio,.gnavi-side-content,.acodion_bar,.acodion_btn,.pager-link,.type-reflect,.result-squeeze input,.fixed-totop').on('keydown', function (e) {
104        if (e.keyCode === 13) {
105            $(document.activeElement).trigger('click');
106        }
107    });
108});
109
110/*=============================
111モーダルコンテンツ
112=============================*/
113
114$(function () {
115    /* tip */
116    $('.table-tip-txt').children('.tip-txt-close').on('click', function () {
117        $('.table-tip-txt').addClass('sis-active');
118    });
119
120    $('.table-tip').on('click', function () {
121        if ($(this).children('.table-tip-txt').hasClass('is-active')) {
122            $(this).children('.table-tip-txt').removeClass('is-active');
123        } else {
124            $(this).children('.table-tip-txt').addClass('is-active');
125        }
126    });
127
128    var ModalOpen = function (modalClass) {
129        $(modalClass).fadeIn();
130        setTimeout(function () {
131            $('.main-modal-inner').focus();
132        }, 0);
133        $('body').addClass('no-scroll');
134    }
135
136    /* モーダル */
137    $('.type-select').on('click', function () {
138        var modalNumber = $(this).attr('class').match(/[0-9]+/);
139        var modalType = '.modal-type-' + modalNumber[0];
140        ModalOpen(modalType);
141    });
142    $('.main-modal-bg').on('click', function () {
143        $('.main-modal').fadeOut();
144        setTimeout(function () {
145            $('body').removeClass('no-scroll')
146        }, 100);
147    });
148    $('.main-modal-close').on('click', function () {
149        $('.main-modal').fadeOut();
150        setTimeout(function () {
151            $('body').removeClass('no-scroll')
152        }, 100);
153    });
154    $('.modal-footer').children('.button-orange').on('click', function () {
155        $('.main-modal').fadeOut();
156        setTimeout(function () {
157            $('body').removeClass('no-scroll')
158        }, 100);
159    });
160
161    $(window).resize(function () {
162        var windowSize = {
163            width: $(window).width(),
164            height: $(window).height()
165        }
166        $('.main-modal-bg').css(windowSize);
167    });
168});
169
170/*モーダル選択画面*/
171var MoadleSelected = function (selectClass, selectContent, nonselectClass, nonselectContent) {
172    $(selectClass).addClass('selected');
173    $(selectContent).removeClass('is-close');
174    $(nonselectClass).removeClass('selected');
175    $(nonselectContent).addClass('is-close')
176};
177
178$(function () {
179    $('.select-state').children('label').on('click', function () {
180        MoadleSelected('.select-state', '.select-content-state', '.select-city', '.select-content-city')
181    });
182    $('.select-city').children('label').on('click', function () {
183        MoadleSelected('.select-city', '.select-content-city', '.select-state', '.select-content-state');
184    });
185});
186
187/*=============================
188ラジオボタン・チェックボックス動作
189=============================*/
190
191$(function () {
192    /* 業者種別のラジオボタン・チェックボックスの選択処理 */
193    $('.radio-downner').find('.table-radio').on('click', function () {
194        $('.radio-upper').find('input[type=checkbox]').prop('checked', false);
195        $('#hojin-number').attr('disabled', true);
196        $('#hojin-number').attr('placeholder', '');
197        $('#hojin-number').val('');
198    });
199    $('.radio-upper').find('.table-radio').on('click', function () {
200        $('#hojin-number').attr('disabled', false);
201        $('#hojin-number').attr('placeholder', 'XXXXXXXXXXXXX')
202        $('.radio-upper').find('.table-check-all').on('click', function () {
203            var items = $(this).parent().next('.table-checks').find('input');
204            $(items).prop('checked', true);
205        });
206    });
207    $('.radio-upper').find('.table-check').on('click', function () {
208        $('#hojin-number').attr('disabled', false);
209        $('#hojin-number').attr('placeholder', 'XXXXXXXXXXXXX')
210        $('.radio-upper').find('input[type=radio]').prop('checked', true);
211        $('.radio-downner').find('input[type=radio]').prop('checked', false);
212    });
213
214    /* チェックボックスの全選択・全解除 */
215    $('.table-check-all').on('click', function () {
216        var items = $(this).parent().next('.table-checks').find('input');
217        $(items).prop('checked', true);
218        $('.radio-upper').find('input[type=radio]').prop('checked', true);
219        $('.radio-downner').find('input[type=radio]').prop('checked', false);
220        $('#hojin-number').attr('disabled', false);
221        $('#hojin-number').attr('placeholder', 'XXXXXXXXXXXXX')
222    });
223    $('.table-check-remove').on('click', function () {
224        var items = $(this).parent().next('.table-checks').find('input');
225        $(items).prop('checked', false);
226    });
227
228    /* 企業規模のチェックボックスの選択処理 */
229    $('.check-upper').on('click', function () {
230        $(this).next('.check-downner').find('input').prop('checked', false);
231    })
232    $('.check-downner').on('click', function () {
233        $(this).prev('.check-upper').find('input').prop('checked', false);
234    })
235});
236
237
238/*=============================
239スクロール動作
240=============================*/
241
242$(function () {
243    /* 滑らかなスクロール */
244    $('a[href^="#"]').click(function () {
245        var speed = 500;
246        var href = $(this).attr('href');
247        var target = $(href == '#' || href == '' ? 'html' : href);
248        var position = target.offset().top;
249        $('html, body').animate({
250            scrollTop: position
251        }, speed, 'swing');
252        return false;
253    });
254
255    /* スクロール量に応じてボタン表示 */
256    var navBox = $('.fixed-totop');
257    navBox.hide();
258    var targetPos = 50;
259    $(window).scroll(function () {
260        var ScrollPos = $(window).scrollTop();
261        if (ScrollPos > targetPos) {
262            navBox.fadeIn();
263        } else {
264            navBox.fadeOut();
265        }
266    });
267});
268
269/*=============================
270テキストボックス入力制御
271=============================*/
272/* 入力制御 */
273$(document).on('focus', 'input textarea.input-error', function () {
274    $(this).parent().find('.message-error.input-error').css('display', 'none');
275    $(this).removeClass('input-error');
276});
277
278/*=============================
279on/off動作
280=============================*/
281
282/*「次へ」ボタンの活性非活性 */
283
284//活性化、非活性するための関数
285var ActivationChange = function (orizinClass, addClass, tabindexNumber, removeClass) {
286    $(orizinClass).addClass(addClass);
287    $(orizinClass).attr('tabindex', tabindexNumber);
288    $(orizinClass).removeClass(removeClass);
289};
290
291//orizinClass = 対象となるクラス( 追加ボタンに対して処理を行いたい場合は'.add-btn')
292//addClass = 追加するクラス( オレンジボタンに活性化する場合 'button-orange'、非活性にしたい場合は'button-gray')
293//除去クラスと対になる
294//tabindexNumber = 対象の要素のtabindex(活性化する場合はその要素の本来のtabindex、非活性にする場合はフォーカスがあたらない様-1)
295//removeClass = 除去するクラス( オレンジボタンに活性化する場合 'button-gray'、非活性にしたい場合は'button-orange')
296//追加するクラスと対になる
297
298
299$(function () {
300    $('.required').on('change', function () {
301        //活性化、非活性化するための条件を記載
302        var flag1 = $('#license-number').val();
303        var flag2 = $('.license-type').find('input[type=radio]:checked').length;
304        var flag3 = $('.target-license-table').find('input[type=checkbox]:checked').length;
305        if (flag1.length > 0 && flag2 > 0) {
306            ActivationChange('.add-btn', 'button-white', '1140', 'button-gray');
307        } else {
308            ActivationChange('.add-btn', 'button-gray', '-1', 'button-white');
309        }
310        if (flag3 > 0) {
311            ActivationChange('#next-btn', 'button-orange', '1230', 'button-gray');
312        } else {
313            ActivationChange('#next-btn', 'button-gray', '-1', 'button-orange');
314        }
315        //上記で決めた条件と処理内容を記載。374~の関数を使用
316    });
317});
318
319/*画像の切り替え */
320$(function () {
321    $('.over').hover(function () {
322        $(this).attr('src', $(this).attr('src').replace('_off', '_on'));
323    }, function () {
324        if (!$(this).hasClass('currentPage')) {
325            $(this).attr('src', $(this).attr('src').replace('_on', '_off'));
326        }
327    });
328    $('.over').click(function () {
329        $(this).attr('src', $(this).attr('src').replace('_on', '_off'));
330    });
331});
332
333
334/*=============================
335onload時の動作
336=============================*/
337
338$(document).ready(function () {
339    var pageTitle = $('h2').html();
340    if (pageTitle) {
341        if (pageTitle.match(/src=/)) {
342            $('.aside-inner-arrow').removeClass('text-link');
343            $('.aside-inner-arrow').text('');
344            $('.aside-inner-arrow').attr('tabindex', '-1');
345        } else {
346            var pageBreadcrumbs = pageTitle.replace(/<.*$/, '');
347            $('#now-location').text(pageBreadcrumbs);
348        }
349    }
350    $('.torikesi-end').attr('tabindex', '-1');
351    $('.button-gray').attr('tabindex', '-1');
352});

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.