PageSourceSearch

https://www.okayama-kanko.jp/common/lsc/js/exvalidation/exchecker-ja.js

js okayama-kanko.jp collected 2026-10-02 05:07:26 UTC 6,881 bytes, 225 lines download raw bytes

1/*!
2 * exchecker-ja
3 *
4 * @version   : 1.1
5 * @author    : nori ([email protected])
6 * @copyright : 5509 (http://5509.me/)
7 * @license   : The MIT License
8 * @link      : http://5509.me/log/exvalidation
9 * @modified  : 2012-04-09 16:52
10 */
11;(function($) {
12  // Extend validation rules
13  $.exValidationRules = $.extend($.exValidationRules, {
14    chkrequired: [
15      "必須入力です",
16      function(txt, t) {
17        if ( $(t).hasClass("chkgroup") ) {
18          var flag = 0;
19          $("input,select",t).each(function() {
20            if ( $(this).val().length > 0 ) flag++;
21          });
22          if ( txt && flag === $("input,select", t).length ) {
23            if ( /^[  \r\n\t]+$/.test(txt) ) {
24              return false;
25            } else {
26              return true;
27            }
28          }
29        } else {
30          if ( txt && txt.length>0 ) {
31            if ( /^[  \r\n\t]+$/.test(txt) ) {
32              return false;
33            } else {
34              return true;
35            }
36          }
37        }
38      }
39    ],
40    chkfutureday: [
41      "クリックして日付を選択してください",
42      function(txt, t) {
43		var curDate  = new Date();
44		var year  = curDate.getFullYear();
45		var month = curDate.getMonth()+1;
46	    var day   = curDate.getDate();
47        if ( $(t).hasClass("chkgroup") ) {
48          var flag = 0;
49		  
50          $("input,select",t).each(function() {
51            if ( $(this).val().length > 0 ) flag++;
52			if ($(this).attr('data-role')=='year') {
53				year = parseInt($(this).val());
54			} else if ($(this).attr('data-role')=='month') {
55				month = parseInt($(this).val());
56			} else if ($(this).attr('data-role')=='day') {
57				day = parseInt($(this).val());
58			}
59          });
60          if ( txt && flag === $("input,select", t).length ) {
61			var chkDate = new Date(year, month - 1, day);
62            if (curDate.getTime() >= chkDate.getTime()) {
63              return false;
64            } else {
65              return true;
66            }
67          }
68        } else {
69          if ( txt && txt.length>0 ) {
70			var time = Date.parse(txt);
71			var chkDate = new Date();
72			chkDate.setTime(time);
73            if (curDate.getTime() >= chkDate.getTime()) {
74              return false;
75            } else {
76              return true;
77            }
78          }
79        }
80      }
81    ],
82    chkselect: [
83      "選択してください",
84      function(txt, t) {
85        if ( txt && txt.length>0 ) {
86          if ( /^[  \r\n\t]+$/.test(txt) ) {
87            return false;
88          } else {
89            return true;
90          }
91        }
92      }
93    ],
94    chkretype: [
95      "入力内容が異なります",
96      function(txt, t) {
97        var elm = $("#" + $(t).attr("class").split("retype\-")[1].split(/\b/)[0]);
98        if ( elm.hasClass("chkgroup") ) {
99          var chktxt = $("input", elm), txt = $("input", t);
100          for ( var i = 0, flag = false; i < chktxt.length; i++ ) {
101            if ( chktxt[i].value === txt[i].value ) {
102              flag = true;
103            } else {
104              flag = false;
105              break;
106            }
107          }
108          if ( flag ) return true;
109        } else {
110          return elm.val() == txt;
111        }
112      }
113    ],
114    chkemail: [
115      "メールアドレスの書式が間違っています",
116      /^(?:[^\@]+?@[A-Za-z0-9_\.\-]+\.+[A-Za-z\.\-\_]+)*$/
117    ],
118    chkhankaku: [
119      "全角文字は使用できません",
120      /^(?:[a-zA-Z0-9@\<\>\;\:\[\]\{\}\|\^\=\/\!\*\`\"\#\$\+\%\&\'\(\)\,\.\-\_\?\\\s]*)*$/
121    ], //"
122    chkzenkaku: [
123      "全角文字で入力してください",
124      /^(?:[^a-zA-Z0-9@\<\>\;\:\[\]\{\}\|\^\=\/\!\*\"\#\$\+\%\&\'\(\)\,\.\-\_\?\\\s]+)*$/
125    ],
126    chkhiragana: [
127      "ひらがなで入力してください",
128      /^(?:[ぁ-ゞ]+)*$/
129    ],
130    chkkatakana: [
131      "カタカナで入力してください",
132      /^(?:[ァ-ヾ]+)*$/
133    ],
134    chkfurigana: [
135      "ふりがなはひらがな、全角数字と〜、ー、()が利用できます",
136      /^(?:[ぁ-ゞ0-9ー~()\(\)\d  ]+)*$/
137    ],
138    chknochar: [
139      "英数字で入力してください",
140      /^(?:[a-zA-Z0-9]+)*$/
141    ],
142    chknocaps: [
143      "英数字(小文字のみ)で入力してください",
144      /^(?:[a-z0-9]+)*$/
145    ],
146    chknumonly: [
147      "半角数字のみで入力してください",
148      /^(?:[0-9]+)*$/
149    ],
150    chkmin: [
151      "文字以上で入力してください",
152      function(txt, t) {
153        if ( txt.length === 0 ) return true;
154         var length = $(t).attr("class").match(/min(\d+)/) ? RegExp.$1 : null;
155        return txt.length >= length;
156      }
157    ],
158    chkmax: [
159      "文字以内で入力してください",
160      function(txt, t) {
161        var length = $(t).attr("class").match(/max(\d+)/) ? RegExp.$1 : null;
162        return txt.length <= length;
163      }
164    ],
165    chkradio: [
166      "選択してください",
167      function(txt, t) {
168        return $("input:checked",t).length>0;
169      }
170    ],
171    chkcheckbox: [
172      "選択してください",
173      function(txt, t) {
174        return $("input:checked",t).length>0;
175      }
176    ],
177    chkzip: [
178      "正しい郵便番号の形式を入力してください",
179      ///^(?:\d{3}-?\d{4}$|^\d{3}-?\d{2}$|^\d{3}$)*$/
180	  function(txt, t) {
181		txt = txt.replace(/[ー ― - -]/g,'');
182		txt = txt.replace(/[A-Za-z0-9]/g,function(s){return String.fromCharCode(s.charCodeAt(0)-0xFEE0)});
183		if ( /^(?:\d{3}-?\d{4}$|^\d{3}-?\d{2}$|^\d{3}$)*$/.test(txt) ) {
184          return true;
185        } else {
186          return false;
187        }  
188	  }
189    ],
190    chkurl: [
191      "正しいURLの形式を入力してください",
192      /^(?:(?:ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)*$/
193    ],
194    chktel: [
195      "正しい電話番号を入力してください",
196      ///^(?:\(?\d+\)?\-?\d+\-?\d+)*$/
197	  function(txt, t) {
198		txt = txt.replace(/[ー ― - -]/g,'');
199		txt = txt.replace(/[A-Za-z0-9 ー ― -]/g,function(s){return String.fromCharCode(s.charCodeAt(0)-0xFEE0)});
200		if ( /^(?:\(?\d+\)?\-?\d+\-?\d+)*$/.test(txt) ) {
201          return true;
202        } else {
203          return false;
204        }  
205	  }
206    ],
207    chkfax: [
208      "正しいファックス番号を入力してください",
209      /^(?:\(?\d+\)?\-?\d+\-?\d+)*$/
210    ],
211    chkfile: [
212      "ファイルを選択してください",
213      function(txt, t) {
214        if ( txt && txt.length>0 ) {
215          if ( /^[  \r\n\t]+$/.test(txt) ) {
216            return false;
217          } else {
218            return true;
219          }
220        }
221      }
222    ]
223  });
224})(jQuery);
225

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.