PageSourceSearch

https://info.toushi.school/js/autozip.js

js toushi.school collected 2026-09-30 23:41:04 UTC 1,741 bytes, 38 lines download raw bytes

1// googleの住所自動入力を利用します
2document.write('<script src="https://ajaxzip3.github.io/ajaxzip3.js" charset="UTF-8"></script>');
3
4// 郵便番号から住所自動入力
5jQuery(function () {
6    // 存在確認
7    if (jQuery('#Userzipcode').length > 0) {
8        // zipcodeが有るときだけイベント発火
9        // コピペ等のイベントが反応しないことがあるので
10        // on('change')で実行する
11        jQuery(document)
12            .off('change.autozip')
13            .on('change.autozip', '#Userzipcode', function (e) {
14                // 存在チェック
15                var $pref = jQuery(this).parents('form').find('#Userpref');
16                var $zip = jQuery(this).parents('form').find('#Userzip');
17
18                var use_pref = $pref.length > 0;
19                var use_zip = $zip.length > 0;
20
21                // 住所が存在するときに、上書きチェックをします。
22                var allow_overwrite = !use_zip || $zip.val() === '';
23
24                // zip2addrは引数4つ目と5つ目を同じにすると
25                // うまく動かないので4つ目までにすること
26                if (allow_overwrite) {
27                    if (use_pref && use_zip) {
28                        // 両方使うとき
29                        AjaxZip3.zip2addr(this, '', 'data[User][pref]', 'data[User][zip]');
30                    } else if (!use_pref && use_zip) {
31                        // 住所だけ使うとき
32                        AjaxZip3.zip2addr(this, '', 'data[User][zip]', 'data[User][zip]');
33                    }
34                    // 都道府県だけ使うときは、動作させません。
35                }
36            });
37    }
38});

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.