PageSourceSearch

https://jeh-center.org/static/js/tx_mailform.js

js jeh-center.org collected 2026-10-02 11:49:09 UTC 6,005 bytes, 186 lines download raw bytes

1if (typeof txForm === 'undefined') {
2  txForm = 1;
3
4  function _tx_cancel_enter_submit(evt) {
5    if (evt.keyCode == 13) {
6      // EnterKey の場合
7      var target = null;
8      if (evt.target) {
9        target = evt.target;
10      } else if (evt.srcElement) { // IE
11        target = evt.srcElement;
12      } else {
13        return true;
14      }
15      if (
16        (target.tagName && target.tagName.toLowerCase() == 'textarea') ||
17        (target.getAttribute && target.getAttribute('type') && target.getAttribute('type').toLowerCase() == 'submit')
18      ) {
19        return true;
20      }
21      if (evt.preventDefault) { // W3C DOM Events
22        evt.preventDefault();
23      } else { // IE
24        return false;
25      }
26    }
27  }
28
29  function _tx_mailform_submit(formId) {
30    var form = document.getElementById(formId);
31    var formPath = "/form";
32    form.setAttribute("action", formPath);
33    form.submit();
34    return false;
35  }
36
37  // Event Listener の追加
38  if (document.addEventListener) { // W3C DOM Events
39    document.addEventListener("keydown", _tx_cancel_enter_submit, false);
40  } else if (document.attachEvent) { // IE
41    document.attachEvent("onkeydown", _tx_cancel_enter_submit);
42  }
43
44  // Chrome上での音声入力追加 H.OHARA
45  tx.addEventListener(window, 'load', function () {
46    tx.jsload('/static/js/webkit-speech-to-text/jquery.webkitSpeechToText.min.js',
47      'window.jQuery.fn.webkitSpeechToText',
48      function () {
49        (function ($) {
50          var options = {};
51          if ($.mobile || window.txspmode) options.css = {
52            'position': 'relative'
53          };
54          $('.form-item textarea, .form-item input:text').webkitSpeechToText(options);
55        })(jQuery);
56      }, 100
57    );
58  });
59}
60
61// AjaxZip3による自動住所入力機能追加 H.OHARA
62if (typeof AjaxZip3 === 'undefined') {
63
64  tx.addEventListener(window, 'load', function () {
65    var jsSrc = "https://ajaxzip3.github.io/ajaxzip3.js";
66    /*
67    var jsSrc = "http://ajaxzip3.googlecode.com/svn/trunk/ajaxzip3/ajaxzip3.js";
68    if ("https:" == document.location.protocol) {
69      jsSrc = "https://ajaxzip3.googlecode.com/svn/trunk/ajaxzip3/ajaxzip3-https.js";
70    }
71    */
72    tx.jsload(jsSrc, 'window.AjaxZip3', function () {
73      (function ($) {
74        var delayTime = 500;
75        $('input.txzipcode').each(function () {
76          var zipField = this;
77          var nextField = $(this).parent().parent().next();
78          var addrs = nextField.find('input.txaddress');
79          $(this).after('<label><input class="txaddress-checkbox" type="checkbox" checked="checked" /><span class="txaddress-label">住所を自動入力</span></label>');
80          var check = $(this).next().find('input.txaddress-checkbox');
81          var callback;
82          if (addrs.length > 0) {
83            var addrField = addrs[0];
84            callback = function () {
85              tx.delay(function () {
86                if (check.is(':checked')) {
87                  AjaxZip3.zip2addr(zipField, '', addrField, addrField);
88                }
89              }, delayTime, 'ajaxzip');
90            };
91            $(this).bind('keyup', callback);
92            check.click(callback);
93          } else {
94            var prefs = nextField.find('select.input-select');
95            addrs = nextField.next().find('input.txaddress');
96            callback = function () {
97              tx.delay(function () {
98                if (check.is(':checked')) {
99                  AjaxZip3.zip2addr(zipField, '', prefField, addrField);
100                  if ($.mobile) {
101                    tx.delay(function () {
102                      prefs.selectmenu('refresh');
103                    }, delayTime, 'refresh');
104                  }
105                }
106              }, delayTime, 'ajaxzip');
107            };
108            if (addrs.length > 0 && prefs.length > 0) {
109              var addrField = addrs[0];
110              var prefField = prefs[0];
111              $(this).bind('keyup', callback);
112              check.click(callback);
113            } else {
114              nextField = $(this).parent().parent().parent().next();
115              prefs = nextField.find('select.input-select');
116              addrs = nextField.next().find('input.txaddress');
117              if (addrs.length > 0 && prefs.length > 0) {
118                var addrField = addrs[0];
119                var prefField = prefs[0];
120                $(this).bind('keyup', callback);
121                check.click(callback);
122              }
123            }
124          }
125        });
126      })(jQuery);
127    }, 100);
128  });
129}
130
131// pickadate.jsでの日付入力機能追加 H.OHARA
132if (typeof Picker === 'undefined') {
133
134  tx.addEventListener(window, 'load', function () {
135    var jsSrc = "/static/js/pickadate.all.js";
136    var opt = {
137      format: 'yyyy/mm/dd',
138      formatSubmit: 'yyyy/mm/dd',
139      selectMonths: true,
140      selectYears: true
141    };
142    var tiopt = {
143      format: 'HH:i',
144      formatSubmit: 'HH:i',
145      clear: 'クリア'
146    };
147
148    tx.jsload(jsSrc, 'window.Picker', function () {
149
150      (function ($) {
151        var option = window.pickadateOption ? $.extend({}, opt, window.pickadateOption) : opt;
152        var tioption = window.pickatimeOption ? $.extend({}, tiopt, window.pickatimeOption) : tiopt;
153        $('input.txdate').each(function () {
154          $(this).pickadate(option);
155        });
156        $('input.txtime').each(function () {
157          $(this).pickatime(tioption);
158        });
159      })(jQuery);
160
161    }, 100);
162  });
163
164}
165
166/*
167if (typeof txFormInputMask === 'undefined') {
168  txFormInputMask = 1;
169
170  tx.addEventListener(window, 'load', function(){
171    var jsSrc = "/static/components/jQuery-Mask-Plugin/dist/jquery.mask.min.js";
172    var opt = {
173      placeholder: "___-____-____"
174    };
175
176    tx.jsload(jsSrc, 'window.jQuery.fn.mask', function() {
177
178      (function($){
179        var option = window.inputmaskOption ? $.extend({}, opt, window.inputmaskOption) : opt ;
180        $('input.txtel').mask('00999-0999-0000', option);
181      })(jQuery);
182
183    }, 100);
184  });
185}
186*/

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.