PageSourceSearch

https://www.nagasaki-np.co.jp/rs/js/form.js?ver=190214

js nagasaki-np.co.jp collected 2026-10-02 04:32:07 UTC 10,071 bytes, 304 lines download raw bytes

1var MAIL = MAIL || {};
2MAIL.Mail = function(to,cc,bcc,sub,msg_top,msg_btm){
3    
4    this.to = to;
5    this.cc = cc;
6    this.bcc = bcc;
7    this.subject = sub;
8    this.msg_top = msg_top;
9    this.msg_btm = msg_btm;
10    //debugger;
11}
12MAIL.Mail.prototype.send = function(form,nameId){
13    
14    var to = this.to;
15    var subject = this.subject;
16    var msg = msgJoin(nameId,this.msg_top,this.msg_btm);
17    var cc = [this.cc];
18    var bcc = [this.bcc];
19    
20    form.register_db()
21    .then(
22        function() {
23            
24            return form.sendMail(to, subject, msg, cc, bcc);
25        },
26        function(errMsg) {
27            formStep(null);
28            formChange();
29        }
30    )
31    .then(
32        function() {
33            formStep(true);
34            formChange();
35        },
36        function(errMsg) {
37            formStep(null);
38            formChange();
39        }
40    );
41}
42
43function msgJoin(nameId,msg_top,msg_btm){
44    var item = new Array();
45    var form_name = '[name='+nameId+'] ';
46   
47    var text = '';
48    $(form_name+'.mail_input,'+form_name+'.mail_input_head').each(function(index,element){
49        if($(this).hasClass('mail_input_head')){
50            text += '【'+$(this).text()+'】\n';
51        }else{
52            var tmp_text = '';
53            if($(this).find('.input_head').text() != ''){
54                tmp_text += $(this).find('.input_head').text()+' : ';
55            }
56            $(this).find('.input_text').each(function(idx,elm){
57                var flag = false;
58                $(this).find('input,select,textarea').each(function(i,e){
59                    flag = true;
60                    if($(this).attr('type') == 'radio' || $(this).attr('type') == 'checkbox'){
61                        if($(this).prop('checked')){
62                            tmp_text += $(this).val();
63                        }
64                    }else{
65                        tmp_text += $(this).val() + ' ';
66                    }
67                });
68                if(!flag){
69                    tmp_text += $(this).text();
70                }
71            });
72            if(tmp_text != ''){
73                text += tmp_text+'\n';
74            }
75        }
76    });
77    return msg_top+'\n'+text+msg_btm;
78}
79
80function deliveryRequired(){
81    var flag = false;
82    // 一項目でも入力があれば全て必須入力
83    for(var i = 0; i < $('.delivery_table input').length; i++) {
84        if($('.delivery_table input')[i].value != ""){
85            flag = true;
86        }
87    }
88
89    if(flag){
90        $('.delivery_table input').attr('required','');
91    }else{
92        $('.delivery_table input').removeAttr('required');
93    }
94}
95
96/*
97ループ処理(スタート数字、終了数字、表示id名、デフォルト数字、語尾、空白行追加)
98*/
99function optionLoop(start, end, id, this_day, after, isSpace) {
100    
101    if(document.getElementById(id) == null) return; // idで指定した要素がない場合は処理を行わない
102    
103    var i, opt;
104    selected = "";
105    opt = null;
106
107    if(isSpace == true){
108        opt = "<option value='' num=''>--</option>";
109        if(this_day <= 0){
110            opt = "<option value='' num='' selected>--</option>";
111        }else{
112            selected = "selected";
113        }
114    }else{
115        selected = "selected";
116        if(this_day <= 0){
117            this_day = 1;
118        }
119    }
120    var start_num = parseInt(start, 10);
121    var end_num = parseInt(end, 10);
122
123    for (i = start_num; i <= end_num ; i++) {
124        var text = "";
125        if(i == start_num && typeof (start) == "string"){
126            text = start;
127        }else if(i == end_num && typeof (end) == "string"){
128            text = end;
129        }else{
130            text = i + after;
131        }
132        if (i === this_day) {
133            opt += "<option value='" +text+ "' num='" +i+ "' " + selected + ">" + text + "</option>";
134        } else {
135            opt += "<option value='" +text+ "' num='"+i+ "' >" +text+ "</option>";
136        }
137    }
138    return document.getElementById(id).innerHTML = opt;
139};
140
141function changeValidation(id_year, id_month, id_day){
142    if (typeof id_year === "undefined") {
143        id_year = 'id_year';
144    }
145    if (typeof id_month === "undefined") {
146        id_month = 'id_month';
147    }
148    if (typeof id_day === "undefined") {
149        id_day = 'id_day';
150    }
151    var index_year = $('#'+id_year+' option').index($('#'+id_year+' option:selected'));
152    var index_day = $('#'+id_day+' option').index($('#'+id_day+' option:selected'));
153    //index_day += 1;
154    var max = dayMax(id_year, id_month);
155    if(max < index_day){
156        index_day = 0;
157    }
158    optionLoop(1, max, id_day, index_day, " 日", true);
159}
160
161function dayMax(id_year, id_month){
162    if (typeof id_year === "undefined") {
163        id_year = 'id_year';
164    }
165    if (typeof id_month === "undefined") {
166        id_month = 'id_month';
167    }
168    var y = parseInt($('#'+id_year+' option:selected').val());
169    var m = parseInt($('#'+id_month+' option:selected').val());
170    
171    var max = 31;
172    for(var d=1;d<=max;d++){
173        if ( y && m && d ) {
174            var ds = new Date( y, m-1, d );
175            if ( ds.getFullYear() != y || ds.getMonth() != m-1 || ds.getDate() != d ) {
176                max = d-1;
177                break;
178            }
179        }
180    }
181    return max;
182}
183
184function zip3(address,message,zipcode){
185    if(!$('form').hasClass('validated')){
186        $(message).html('');
187        
188        // 404等の「error」をハンドリング
189        window.addEventListener('error', function(e) {
190            if (e.target && e.target.src && e.target.src.indexOf("yubinbango.github.io") != -1) {
191                // 郵便番号の上3桁が記載されたJSが存在しないとき(=404)
192                // 例:郵便番号に「0000000」を指定すると「000.js」が存在しないため発生
193                //alert("存在しない郵便番号です 1");
194                $(message).html('※ 郵便番号を取得できませんでした');
195            }
196        }, true);
197
198        // キーイベント設定
199        var that = $("[name=" + zipcode + "]");
200
201        if(that.val().length < 7){
202            $(message).html('※ 郵便番号を取得できませんでした');
203        }
204        
205        // onFailureプロパティにコールバック関数を設定
206        AjaxZip3.onFailure = function(e) {
207            // 郵便番号の上3桁が記載されたJSは存在するが、その中から下4桁が発見できないとき
208            // 例:郵便番号に「1234567」を指定すると、「123.js」はダウンロードできるが
209            //   その中から「4567」が発見できないため発生
210            //that.val(""); // キーを押す度にアラートが表示されるので一度クリア
211            //alert("存在しない郵便番号です 2");
212            $(message).html('※ 郵便番号を取得できませんでした');
213        };
214
215        // 郵便番号検索
216        AjaxZip3.zip2addr(zipcode,'',address,address);
217    }
218}
219
220// フォームを識別するフラグを変更する
221function formStep(isNext){
222    if(isNext == null){
223       if($('#step1').length > 0){
224            $('#step1').attr("id",'step4');
225        }else if($('#step2').length > 0){
226            $('#step2').attr("id",'step4');
227        }else if($('#step3').length > 0){
228            $('#step3').attr("id",'step4');
229        }
230    }
231    else if(isNext){
232       if($('#step3').length > 0){
233            $('#step3').attr("id",'step1');
234        }else if($('#step1').length > 0){
235            $('#step1').attr("id",'step2');
236        }else if($('#step2').length > 0){
237            $('#step2').attr("id",'step3');
238        }
239    }
240    else{
241        if($('#step3').length > 0){
242            $('#step3').attr("id",'step2');
243        }else if($('#step1').length > 0){
244            $('#step1').attr("id",'step3');
245        }else if($('#step2').length > 0){
246            $('#step2').attr("id",'step1');
247        }
248    }
249}
250// フラグに該当するフォーム画面に切り替える
251function formChange(){
252    if($('#step1').length > 0){
253        $('.type2').css('display', 'none');
254        $('.type3').css('display', 'none');
255        $('.type4').css('display', 'none');
256        $('.type1').css('display', '');
257    }else if($('#step2').length > 0){
258        $('.type1').css('display', 'none');
259        $('.type3').css('display', 'none');
260        $('.type4').css('display', 'none');
261        $('.type2').css('display', '');
262    }else if($('#step3').length > 0){
263        $('.type1').css('display', 'none');
264        $('.type2').css('display', 'none');
265        $('.type4').css('display', 'none');
266        $('.type3').css('display', '');
267    }else if($('#step4').length > 0){
268        $('.type1').css('display', 'none');
269        $('.type2').css('display', 'none');
270        $('.type3').css('display', 'none');
271        $('.type4').css('display', '');
272    }
273}
274
275function exRequired(ex1,ex2){
276    if(ex1.val() == "" && ex2.val() == ""){
277        ex1.attr('required','');
278        ex2.attr('required','');
279    }
280    else{
281        ex1.removeAttr('required');
282        ex2.removeAttr('required');
283    }
284}
285
286function typeTel(){
287                        
288    $('input').each(function(idx,elm){
289        if($(elm).attr('type') == 'tel'){
290            var text = $(elm).val();
291            var textRtn = '';
292            var textArr = text.split('');
293            for(var i = 0; i < textArr.length; i++){
294                if(textArr[i].match(/[\uFF10-\uFF19]/g)){
295                    textRtn += String.fromCharCode(textArr[i].charCo
295deAt(0) - 0xFEE0);
296                }
297                else if(textArr[i].match(/[0-9]/g)){
298                    textRtn += textArr[i];
299                }
300            }
301            $(elm).val(textRtn);
302        }
303    });
304}

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.