1"use strict"; 2 3// æ¬èã®æ¥ã¨ç§åã®æ¥ã¯éãªãã¾ããï¼æ¬èã®æ¥ 9/15ï½9/21ã®éã§ç§»åãç§åã®æ¥ 9/22ã9/23ã®ã©ã¡ããï¼ 4var Holiday = (function() { 5 /** 6 * 伿¥åå¾ 7 * @param Date date 8 * @return string 9 */ 10 var getHolidayName = function(date) { 11 var holidayName = ""; 12 if (typeof date != "object") { 13 return holidayName; 14 } 15 try { 16 date.getTime(); 17 } catch (error) { 18 return holidayName; 19 } 20 holidayName = _getPublicHolidayName(date); 21 if (holidayName !== "") { 22 return holidayName; 23 } 24 var year = date.getFullYear(); 25 var month = date.getMonth() + 1; 26 var day = date.getDate(); 27 var weekday = date.getDay(); 28 // æ¯æ¿ä¼æ¥ã®å¤å® 29 var timeStamp = date.getTime(); 30 // 忥(dateããã¼ã¹ã«å¥ã¤ã³ã¹ã¿ã³ã¹ã§ä½æ) 31 var previousDate = new Date(timeStamp); 32 previousDate.setDate(date.getDate() - 1); 33 // 忥(dateããã¼ã¹ã«å¥ã¤ã³ã¹ã¿ã³ã¹ã§ä½æ) 34 var previousDateForLoop = new Date(timeStamp); 35 previousDateForLoop.setDate(date.getDate() - 1); 36 // 1986-2006ã®5æ4æ¥ã®ç¹æ®å¦ç 37 if (1986 <= year && year <= 2006 && month == 5 && day == 4) { 38 if (weekday == 1) { 39 holidayName = "æ¯æ¿ä¼æ¥"; 40 } 41 } 42 if (holidayName !== "") { 43 return holidayName; 44 } 45 if (new Date("1973/04/12") <= date && date <= new Date("2006/12/31")) { 46 // åæ¥ãæ¥æãã¤å½æ°ã®ç¥æ¥ã®ã¨ãæ¬æ¥ã¯æ¯æ¿ä¼æ¥ 47 if (previousDate.getDay() === 0 && _getPublicHolidayName(previousDate) !== "") { 48 holidayName = "æ¯æ¿ä¼æ¥"; 49 } 50 } 51 if (holidayName !== "") { 52 return holidayName; 53 } 54 if (new Date("2007/01/01") <= date) { 55 // 忥ã«å½æ°ã®ç¥æ¥ãé£ç¶ãã¦ããããã®ä¸ã«æ¥æãå«ã¾ããã¨ãæ¬æ¥ã¯æ¯æ¿ä¼æ¥ 56 while (true) { 57 if (_getPublicHolidayName(previousDateForLoop) === "") { 58 // 忥ã彿°ã®ç¥æ¥ã§ã¯ç¡ãå ´åã¯çµäº 59 break; 60 } 61 if (previousDateForLoop.getDay() === 0) { 62 // åæ¥ãæ¥æã®å ´åã¯çµäº 63 holidayName = "æ¯æ¿ä¼æ¥"; 64 break; 65 } 66 previousDateForLoop.setDate(previousDateForLoop.getDate() - 1); 67 } 68 } 69 if (holidayName !== "") { 70 return holidayName; 71 } 72 // 彿°ã®ä¼æ¥ 73 // 1986-2006ã®5æ4æ¥ã®ç¹æ®å¦ç 74 if (1986 <= year && year <= 2006 && month === 5 && day === 4) { 75 if (weekday >= 2 && weekday <= 6) { 76 holidayName = "彿°ã®ä¼æ¥"; 77 } 78 } 79 if (holidayName !== "") { 80 return holidayName; 81 } 82 // åå¾ã彿°ã®ç¥æ¥ã§ããå¹³æ¥ã¯å½æ°ã®ä¼æ¥ã¨ãªã 83 // æ¬¡ã®æ¥(dateããã¼ã¹ã«å¥ã¤ã³ã¹ã¿ã³ã¹ã§ä½æ) 84 var nextDate = new Date(timeStamp); 85 nextDate.setDate(date.getDate() + 1); 86 if (new Date("1985/12/27") <= date) { 87 if (_getPublicHolidayName(previousDate) !== "" && _getPublicHolidayName(nextDate) !== "" && weekday >= 2 && weekday <= 6) { 88 holidayName = "彿°ã®ä¼æ¥"; 89 } 90 } 91 return holidayName; 92 } 93 var _fixHolidayObjectList = [{ 94 "name": "å æ¥", 95 "month": 1, 96 "day": 1, 97 "start": 1949, 98 "end": null 99 }, { 100 "name": "æäººã®æ¥", 101 "month": 1, 102 "day": 15, 103 "start": 1949, 104 "end": 1999 105 }, { 106 "name": "建å½è¨å¿µã®æ¥", 107 "month": 2, 108 "day": 11, 109 "start": 1967, 110 "end": null 111 }, { 112 "name": "æå天çã®å¤§åªã®ç¤¼", 113 "month": 2, 114 "day": 24, 115 "start": 1989, 116 "end": 1989 117 }, { 118 "name": "ç太åã»æä»è¦ªçã®çµå©ã®å", 119 "month": 4, 120 "day": 10, 121 "start": 1959, 122 "end": 1959 123 }, { 124 "name": "天çèªçæ¥", 125 "month": 4, 126 "day": 29, 127 "start": 1949, 128 "end": 1988 129 }, { 130 "name": "天çèªçæ¥", 131 "month": 2, 132 "day": 23, 133 "start": 1989, 134 "end": 2018 135 }, { 136 "name": "ã¿ã©ãã®æ¥", 137 "month": 4, 138 "day": 29, 139 "start": 1989, 140 "end": 2006 141 }, { 142 "name": "æåã®æ¥", 143 "month": 4, 144 "day": 29, 145 "start": 2007, 146 "end": null 147 }, { 148 "name": "æ²æ³è¨å¿µæ¥", 149 "month": 5, 150 "day": 3, 151 "start": 1949, 152 "end": null 153 }, { 154 "name": "ã¿ã©ãã®æ¥", 155 "month": 5, 156 "day": 4, 157 "start": 2007, 158 "end": null 159 }, { 160 "name": "ãã©ãã®æ¥", 161 "month": 5, 162 "day": 5, 163 "start": 1949, 164 "end": null 165 }, { 166 "name": "ç太åã»ç太åå¾³ä»è¦ªçã®çµå©ã®å", 167 "month": 6, 168 "day": 9, 169 "start": 1993, 170 "end": 1993 171 }, { 172 "name": "æµ·ã®æ¥", 173 "month": 7, 174 "day": 20, 175 "start": 1996, 176 "end": 2002 177 }, { 178 "name": "å±±ã®æ¥", 179 "month": 8, 180 "day": 11, 181 "start": 2016, 182 "end": null 183 }, { 184 "name": "æ¬èã®æ¥", 185 "month": 9, 186 "day": 5, 187 "start": 1966, 188 "end": 2002 189 }, { 190 "name": "ä½è²ã®æ¥", 191 "month": 10, 192 "day": 10, 193 "start": 1966, 194 "end": 1999 195 }, { 196 "name": "æåã®æ¥", 197 "month": 11, 198 "day": 3, 199 "start": 1948, 200 "end": null 201 }, { 202 "name": "å³ä½ã®ç¤¼æ£æ®¿ã®å", 203 "month": 11, 204 "day": 12, 205 "start": 1990, 206 "end": 1990 207 }, { 208 "name": "å¤å´æè¬ã®æ¥", 209 "month": 11, 210 "day": 23, 211 "start": 1948, 212 "end": null 213 }, { 214 "name": "天çèªçæ¥", 215 "month": 2, 216 "day": 23, 217 "start": 2018, 218 "end": null 219 }, ]; 220 var _happyMondayObjectList = [{ 221 "name": "æäººã®æ¥", 222 "month": 1, 223 "weekNumber": 2, 224 "start": 2000, 225 "end": null 226 }, { 227 "name": "æµ·ã®æ¥", 228 "month": 7, 229 "weekNumber": 3, 230 "start": 2003, 231 "end": null 232 }, { 233 "name": "æ¬èã®æ¥", 234 "month": 9, 235 "weekNumber": 3, 236 "start": 2003, 237 "end": null 238 }, { 239 "name": "ä½è²ã®æ¥", 240 "month": 10, 241 "weekNumber": 2, 242 "start": 2000, 243 "end": null 244 }, ]; 245 /** 246 * 彿°ã®ç¥æ¥åå¾ 247 * @param Date date 248 * @return string 249 */ 250 var _getPublicHolidayName = function(date) { 251 var publicHolidayName = ""; 252 var year = date.getFullYear();
253 var month = date.getMonth() + 1; 254 var day = date.getDate(); 255 var weekday = date.getDay(); 256 // 第ä½é± 257 var weekNumber = null; 258 if (day % 7 == 0) { 259 weekNumber = day / 7; 260 } else { 261 weekNumber = parseInt(day / 7, 10) + 1; 262 } 263 // åºå®ç¥æ¥ 264 _fixHolidayObjectList.forEach(function(object) { 265 if (object.end !== null) { 266 if (object.start <= year && year <= object.end && month === object.month && day === object.day) { 267 publicHolidayName = object.name; 268 } 269 } else { 270 if (object.start <= year && month === object.month && day === object.day) { 271 publicHolidayName = object.name; 272 } 273 } 274 }); 275 if (publicHolidayName !== "") { 276 return publicHolidayName; 277 } 278 // ãããã¼ãã³ãã¼å¶åº¦ 279 _happyMondayObjectList.forEach(function(object) { 280 if (weekday !== 1) { 281 // ææã§ã¯ãªãå ´å 282 return; 283 } 284 if (object.end !== null) { 285 if (object.start <= year && year <= object.end && month === object.month && weekNumber === object.weekNumber) { 286 publicHolidayName = object.name; 287 } 288 } else {
289 if (object.start <= year && month === object.month && weekNumber === object.weekNumber) { 290 publicHolidayName = object.name; 291 } 292 } 293 }); 294 if (publicHolidayName !== "") { 295 return publicHolidayName; 296 } 297 // æ¥åã®æ¥ã»ç§åã®æ¥ 298 if (1900 <= year && year < 1980) { 299 if (month === 3) { 300 if (day === parseInt(20.8357 + 0.242194 * (year - 1980), 10) - parseInt((year - 1983) / 4, 10)) { 301 publicHolidayName = "æ¥åã®æ¥"; 302 } 303 } 304 if (month === 9) { 305 if (day === parseInt(23.2588 + 0.242194 * (year - 1980), 10) - parseInt((year - 1983) / 4, 10)) { 306 publicHolidayName = "ç§åã®æ¥"; 307 } 308 } 309 } 310 if (1980 <= year && year < 2100) { 311 if (month === 3) { 312 if (day === parseInt(20.8431 + 0.242194 * (year - 1980), 10) - parseInt((year - 1980) / 4, 10)) { 313 publicHolidayName = "æ¥åã®æ¥"; 314 } 315 } 316 if (month === 9) { 317 if (day === parseInt(23.2488 + 0.242194 * (year - 1980), 10) - parseInt((year - 1980) / 4, 10)) { 318 publicHolidayName = "ç§åã®æ¥"; 319 } 320 } 321 } 322 if (2100 <= year && year < 2150) { 323 if (month === 3) { 324 if (day === parseInt(20.8510 + 0.242194 * (year - 1980), 10) - parseInt((year - 1980) / 4, 10)) { 325 publicHolidayName = "æ¥åã®æ¥"; 326 } 327 } 328 if (month === 9) { 329 if (day === parseInt(24.2488 + 0.242194 * (year - 1980), 10) - parseInt((year - 1980) / 4, 10)) { 330 publicHolidayName = "ç§åã®æ¥"; 331 } 332 } 333 } 334 return publicHolidayName; 335 } 336 return { 337 getHolidayName: getHolidayName 338 } 339})(); 340 341window.addEventListener('pageshow', function(){ 342(function() { 343 //èªåå ¥åã«ã 344 (function() { 345 var targets = document.querySelectorAll('[data-form-autokana]'); 346 if (targets.length) { 347 //autokanaãããã©JS 348 var autoKana = function(D, C, e) { 349 if (!e) { 350 var e = { 351 katakana: false 352 } 353 } 354 var t = new RegExp("[^ ããã-ãã¼]", "g"); 355 var s = new RegExp("[ããã ããã£ãã ã]", "g"); 356 var h = D, 357 f = C, 358 k = false, 359 q = null, 360 B = true, 361 r, b, u, l; 362 var i = function() { 363 k = true 364 }; 365 var x = function() { 366 k = false 367 }; 368 var w = function(H) { 369 var G = H || window.event; 370 if (H) { 371 var F = Event.element(H); 372 if (F.checked) { 373 k = true 374 } else { 375 k = false 376 } 377 } else { 378 k = !k 379 } 380 }; 381 var y = function(F) { 382 if (!B) { 383 if (Math.abs(b.length - F.length) > 1) { 384 var G = F.join("").replace(s, "").split(""); 385 if (Math.abs(b.length - G.length) > 1) { 386 v() 387 } 388 } else { 389 if (b.length == r.length && b.join("") != r) { 390 if (r.match(t)) { 391 v() 392 } 393 } 394 } 395 } 396 }; 397 var p = function() { 398 var G, F; 399 G = h.value; 400 if (G == "") { 401 A(); 402 c() 403 } else { 404 G = g(G); 405 if (r == G) { 406 return 407 } else { 408 r = G; 409 if (!B) { 410 F = G.replace(t, "").split(""); 411 y(F); 412 c(F) 413 } 414 } 415 } 416 }; 417 var d = function() { 418 clearInterval(q) 419 }; 420 var m = function(F) { 421 d() 422 }; 423 var o = function(F) { 424 z(); 425 n() 426 }; 427 var j = function(F) { 428 if (B) { 429 z() 430 } 431 }; 432 var a = function(F) { 433 return ((F >= 12353 && F <= 12435) || F == 12445 || F == 12446) 434 }; 435 var g = function(I) { 436 if (I.indexOf(u) !== -1) { 437 return I.replace(u, "") 438 } else { 439 var G, H, F; 440 H = u.split(""); 441 F = I.split(""); 442 for (G = 0; G < H.length; G++) { 443 if (H[G] == F[G]) { 444 F[G] = "" 445 } 446 } 447 return F.join("") 448 } 449 }; 450 var n = function() { 451 var F = this; 452 q = setInterval(p, 30) 453 }; 454 var c = function(F) { 455 if (!B) { 456 if (F) { 457 b = F 458 } 459 if (k) { 460 var G = E(l + b.join("")); 461 f.value = G 462 } 463 } 464 }; 465 var A = function() { 466 l = ""; 467 B = false; 468 u = ""; 469 r = ""; 470 b = [] 471 }; 472 var z = function() { 473 l = f.value; 474 B = false; 475 u = h.value 476 }; 477 var v = function() { 478 l = l + b.join(""); 479 B = true; 480 b = [] 481 }; 482 var E = function(H) { 483 if (e.katakana) { 484 var I, F, G; 485 G = new String; 486 for (F = 0; F < H.length; F++) { 487 I = H.charCodeAt(F); 488 if (a(I)) { 489 G += String.fromCharCode(I + 96) 490 } else { 491 G += H.charAt(F) 492 } 493 } 494 return G 495 } else { 496 return H 497 } 498 }; 499 k = true; 500 A(); 501 h.addEventListener('blur', function(e){
502 C.dispatchEvent(new Event('change')); 503 C.dispatchEvent(new Event('focus')); 504 C.dispatchEvent(new Event('blur')); 505 C.dispatchEvent(new Event('keydown')); 506 C.dispatchEvent(new Event('keyup')); 507 m(e); 508 }); 509 h.addEventListener('focus', function(e){ 510 C.dispatchEvent(new Event('change')); 511 C.dispatchEvent(new Event('focus')); 512 C.dispatchEvent(new Event('blur')); 513 C.dispatchEvent(new Event('keydown')); 514 C.dispatchEvent(new Event('keyup')); 515 o(e); 516 }); 517 h.addEventListener('keydown', function(e){ 518 C.dispatchEvent(new Event('change')); 519 C.dispatchEvent(new Event('focus')); 520 C.dispatchEvent(new Event('blur')); 521 C.dispatchEvent(new Event('keydown')); 522 C.dispatchEvent(new Event('keyup')); 523 j(e); 524 }); 525 }; 526 for (var i = 0; i < targets.length; i++) { 527 (function(target) { 528 var autokana_target = document.querySelector('[data-form-autokana_target="' + target.getAttribute('data-form-autokana') + '"]'); 529 autoKana(target, autokana_target, { 530 katakana: true 531 }); 532 }(targets[i])); 533 } 534 } 535 }()); 536 537 //éµä¾¿çªå· 538 (function() { 539 var targets = document.querySelectorAll('[data-form-postalnumber]'); 540 if (targets.length) { 541 for (var i = 0; i < targets.length; i++) { 542 (function(target) { 543 var pref = document.querySelector('[data-form-postalnumber_pref="' + target.getAttribute('data-form-postalnumber') + '"]'); 544 var addr = document.querySelector('[data-form-postalnumber_address="' + target.getAttribute('data-form-postalnumber') + '"]'); 545 if(pref && addr) { 546 target.addEventListener('keyup', function() { 547 AjaxZip3.zip2addr(target, '', pref.name, addr.name); 548 }); 549 } else if(pref) { 550 target.addEventListener('keyup', function() { 551 AjaxZip3.zip2addr(target, '', pref.name, pref.name); 552 }); 553 } else { 554 target.addEventListener('keyup', function() { 555 AjaxZip3.zip2addr(target, '', addr.name, addr.name); 556 }); 557 } 558 }(targets[i])); 559 } 560 } 561 }()); 562 563 //ã«ã¬ã³ãã¼ 564 (function() { 565 var targets = document.querySelectorAll('[data-form-calender]'); 566 if (targets.length) { 567 if(document.getElementById('Form').getAttribute('data-formlang')) { 568 } else { 569 $.datepicker.regional['ja'] = { 570 closeText: 'éãã', 571 prevText: '<å', 572 nextText: '次>', 573 currentText: '仿¥', 574 monthNames: ['1æ', '2æ', '3æ', '4æ', '5æ', '6æ', '7æ', '8æ', '9æ', '10æ', '11æ', '12æ'], 575 monthNamesShort: ['1æ', '2æ', '3æ', '4æ', '5æ', '6æ', '7æ', '8æ', '9æ', '10æ', '11æ', '12æ'], 576 dayNames: ['æ¥ææ¥', 'æææ¥', 'ç«ææ¥', 'æ°´ææ¥', 'æ¨ææ¥', 'éææ¥', 'åææ¥'], 577 dayNamesShort: ['æ¥', 'æ', 'ç«', 'æ°´', 'æ¨', 'é', 'å'], 578 dayNamesMin: ['æ¥', 'æ', 'ç«', 'æ°´', 'æ¨', 'é', 'å'], 579 weekHeader: 'é±', 580 dateFormat: 'yyå¹´mmæddæ¥ï¼Dï¼', 581 firstDay: 1, 582 isRTL: false, 583 showMonthAfterYear: true, 584 yearSuffix: 'å¹´' 585 }; 586 $.datepicker.setDefaults($.datepicker.regional['ja']); 587 } 588 for (var i = 0; i < targets.length; i++) { 589 (function(target) { 590 var onselect = function() { 591 target.dispatchEvent(new Event('input')); 592 }; 593 $(target).datepicker({ 594 minDate: '+1d' //'+0d' 595 , 596 beforeShowDay: function(date) { // åæ¥ç¥æ¥è²å¤æ´ 597 var shukujitu = Holiday.getHolidayName(date); 598 if (date.getDay() == 0) { // æ¥ææ¥ 599 return [true, 'sunday', 'æ¥ææ¥']; 600 } else if (date.getDay() == 6) { // åææ¥ 601 return [true, 'saturday', 'åææ¥']; 602 } else if (shukujitu) { // ç¥æ¥ 603 return [true, 'holiday', 'ç¥æ¥']; 604 } else { // å¹³æ¥ 605 return [true, 'weekday', 'å¹³æ¥']; 606 } 607 }, 608 onSelect: function(dateText) { 609 setTimeout(function(){ 610 target.dispatchEvent(new Event('input')); 611 target.dispatchEvent(new Event('change')); 612 target.dispatchEvent(new Event('blur')); 613 }, 100); 614 onselect(); 615 }, 616 beforeShow: function(input, inst) { 617 var calendar = inst.dpDiv; 618 setTimeout(function() { 619 calendar.position({ 620 my: 'left bottom', 621 at: 'left top', 622 of: input 623 });
624 }, 1); 625 } 626 }); 627 onselect(); 628 }(targets[i])); 629 } 630 } 631 }()); 632 633 //ããããã®è¦ç´ 634 (function(){ 635 var targets = document.querySelectorAll('.itemWrap'); 636 for(var i = 0; i < targets.length; i++) { 637 (function(target){ 638 if(target.querySelector('[type="checkbox"]')) {//checkbox 639 var inputs = target.querySelectorAll('[type="checkbox"]'); 640 for(var h = 0; h < inputs.length; h++) { 641 (function(input){ 642 var needinputcount = parseInt(target.querySelector('[data-form-needinputcount]').getAttribute('data-form-needinputcount')); 643 var check = function(){ 644 //ãã§ãã¯æ°ãã«ã¦ã³ããã 645 if(needinputcount <= target.querySelectorAll('[type="checkbox"]:checked').length){//å ¥åããã¦ããªãã¨ã 646 target.setAttribute('data-form-complete', ''); 647 }else{//å ¥åãããã¨ã 648 target.removeAttribute('data-form-complete'); 649 } 650 }; 651 input.addEventListener('change', check); 652 check(); 653 }(inputs[h])); 654 } 655 }else if(target.querySelector('[type="radio"]')) {//radio 656 var inputs = target.querySelectorAll('[type="radio"]'); 657 for(var h = 0; h < inputs.length; h++) { 658 (function(input){ 659 var check = function(){ 660 //ãã§ãã¯æ°ãã«ã¦ã³ããã 661 if(target.querySelector('[type="radio"]:checked')){//å ¥åããã¦ããªãã¨ã 662 target.setAttribute('data-form-complete', ''); 663 }else{//å ¥åãããã¨ã 664 target.removeAttribute('data-form-complete'); 665 } 666 }; 667 input.addEventListener('change', check); 668 check(); 669 }(inputs[h])); 670 } 671 }else if(target.querySelector('[type="email"]')) {//email 672 var checkMailReg = /^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/; 673 var input = target.querySelector('[type="email"]'); 674 var check = function(){ 675 //ééã£ã¦ããæåãç½®æ 676 input.value = input.value.replace(/[A-Zï½-ï½ï¼-ï¼]/g, function(s) { 677 return String.fromCharCode(s.charCodeAt(0) - 0xFEE0); 678 }); 679 input.value = input.value.replace(/[\u3041-\u3096\u30A1-\u30FAã ãã»\u3400-\u9FFF\uF900-\uFAFF]|[\uD840-\uD87F][\uDC00-\uDFFFï¼ï¼âï¼ï¼ï¼ ï¼âï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼¿ï¼»ï¼½ï½ï½ï¼ ï¼¾ï½ï¿¥]/g, ""); 680 if(input.value.search(checkMailReg)){//å ¥åããã¦ããªãã¨ã 681 target.removeAttribute('data-form-complete'); 682 }else{//å ¥åãããã¨ã 683 target.setAttribute('data-form-complete', ''); 684 } 685 }; 686 input.addEventListener('change', check); 687 input.addEventListener('keyup', check); 688 check(); 689 }else if(target.querySelector('[type="tel"]')) {//tel 690 var input = target.querySelector('[type="tel"]'); 691 var check = function(){ 692 //æ°åã大æåã®ã¨ã 693 input.value = input.value.replace(/[A-Zï½-ï½ï¼-ï¼]/g, function(s){return String.fromCharCode(s.charCodeAt(0)-0xFEE0)}); 694 695 //æ°å以å¤ã¯å ¥åãããªã 696 input.value = input.value.replace(/[^0-9]+/g, ""); 697 698 if(input.value.length){ 699 target.setAttribute('data-form-complete', ''); 700 }else{ 701 target.removeAttribute('data-form-complete'); 702 } 703 }; 704 input.addEventListener('change', check); 705 input.addEventListener('keyup', check); 706 check(); 707 }else if(target.querySelector('select')) {//select 708 var input = target.querySelector('select'); 709 var check = function(){ 710 //å ¥åãééã£ã¦ããããã§ã㯠711 if(input.value){ 712 target.setAttribute('data-form-complete', ''); 713 }else{ 714 target.removeAttribute('data-form-complete'); 715 } 716 }; 717 input.addEventListener('change', check); 718 check(); 719 }else if(target.querySelector('[type="text"]')) {//text 720 var input = target.querySelector('[type="text"]'); 721 var check = function(){ 722 if(input.value.length){ 723 target.setAttribute('data-form-complete', ''); 724 }else{ 725 target.removeAttribute('data-form-complete'); 726 } 727 }; 728 input.addEventListener('change', check); 729 input.addEventListener('keyup', check); 730 check(); 731 }else if(target.querySelector('textarea')) {//textarea 732 var input = target.querySelector('textarea'); 733 var check = function(){ 734 if(input.value.length){ 735 target.setAttribute('data-form-complete', ''); 736 }else{ 737 target.removeAttribute('data-form-complete'); 738 } 739 }; 740 input.addEventListener('change', check); 741 input.addEventListener('keyup', check); 742 check(); 743 }else if(target.classList.contains('uploadWrap')) {//upload 744 if(window.File && window.FileReader && window.FileList && window.Blob){ 745 var blocks = target.querySelectorAll('.uploadareaBlock'); 746 var inputs = target.querySelectorAll('[type="file"]'); 747 for(var h = 0; h < blocks.length; h++) { 748 if(h) blocks[h].className += ' disable'; 749 } 750 for(var h = 0; h < blocks.length; h++) { 751 (function(block, input){ 752 //次ã®ã¢ãããã¼ãè¦ç´ ãã²ããã 753 if(block.querySelector('[data-filepath]').value) { 754 // block.nextElementSibling.classList.remove('disable'); 755 } 756 757 var needinputcount = parseInt(target.querySelector('[data-form-needinputcount]').getAttribute('data-form-needinputcount')); 758 var check = function(){ 759 //ãã§ãã¯æ°ãã«ã¦ã³ããã 760 var count = 0; 761 for(var j = 0; j < inputs.length; j++) { 762 if(inputs[j].files.length) count++; 763 } 764 if(needinputcount <= count){//å ¥åããã¦ããªãã¨ã 765 target.setAttribute('data-form-complete', ''); 766 }else{//å ¥åãããã¨ã 767 target.removeAttribute('data-form-complete'); 768 } 769 }; 770 input.addEventListener('change', check); 771 check(); 772 773 var closebtn = block.querySelector('.close'); 774 var preview = block.querySelector('.preview'); 775 var uploadname = block.querySelector('.uploadname'); 776 var hidden_filePath = block.querySelector('[type="hidden"][data-filePath]'); 777 var hidden_filename = block.querySelector('[type="hidden"][data-filename]'); 778 var hidden_filetype = block.querySelector('[type="hidden"][data-filetype]'); 779 var displayLoop; 780 var displayNum = 0; 781 782 var previewSet = function(){ 783 if(input.files[0]) { 784 var ary = input.files[0].name.split('.'); 785 hidden_filetype.value = ary[ary.length-1]; 786 preview.setAttribute('data-inputtype', '.' + hidden_filetype.value); 787 preview.title = uploadname.innerHTML = input.files[0].name; 788 closebtn.classList.add('active'); 789 790 if(input.files[0].type.indexOf("image") < 0){ 791 preview.style.backgroundImage = ''; 792 }else{ 793 var reader = new FileReader(); 794 reader.addEventListener('load', function handler(){ 795 preview.style.backgroundImage = 'url(' + this.result + ')'; 796 this.removeEventListener('load', handler); 797 });
798 reader.readAsDataURL(input.files[0]); 799 } 800 }else{ 801 if(hidden_filePath.value) { 802 preview.setAttribute('data-inputtype', '.' + hidden_filetype.value); 803 preview.title = uploadname.innerHTML = hidden_filename.value; 804 closebtn.classList.add('active'); 805 if(hidden_filetype.value.indexOf("jpg") < 0 && hidden_filetype.value.indexOf("jpeg") < 0 && hidden_filetype.value.indexOf("gif") < 0 && hidden_filetype.value.indexOf("png") < 0){ 806 preview.style.backgroundImage = ''; 807 }else{ 808 var newImg = document.createElement('img'); 809 newImg.addEventListener('load', function load(){ 810 // New Canvas 811 var canvas = document.createElement('canvas'); 812 canvas.width = newImg.width; 813 canvas.height = newImg.height; 814 // Draw Image 815 var ctx = canvas.getContext('2d'); 816 ctx.drawImage(newImg, 0, 0); 817 // To Base64 818 preview.style.backgroundImage = 'url(' + canvas.toDataURL(hidden_filetype.value) + ')'; 819 820 this.removeEventListener('load', load); 821 }); 822 newImg.src = hidden_filePath.value; 823 } 824 }else{ 825 hidden_filePath.value = ''; 826 hidden_filename.value = ''; 827 hidden_filetype.value = ''; 828 preview.title = uploadname.innerHTML = 'ãã¡ã¤ã«ã鏿ãã¦ãã ãã'; 829 preview.style.backgroundImage = ''; 830 preview.setAttribute('data-inputtype', ''); 831 closebtn.classList.remove('active'); 832 } 833 834 if(hidden_filetype.value.indexOf("jpg") < 0 && hidden_filetype.value.indexOf("jpeg") < 0 && hidden_filetype.value.indexOf("gif") < 0 && hidden_filetype.value.indexOf("png") < 0){ 835 preview.style.backgroundImage = ''; 836 }else{ 837 if(hidden_filePath.value) { 838 }else{ 839 preview.style.backgroundImage = ''; 840 } 841 } 842 } 843 }; 844 845 //ãªã»ãããã¿ã³ 846 closebtn.addEventListener('click', function(e){ 847 input.value = ''; 848 input.dispatchEvent(new Event('change')); 849 hidden_filePath.value = ''; 850 previewSet(); 851 });
852 853 //ã¢ãããã¼ããã¿ã³ 854 input.addEventListener('change', function(e){ 855 if(input.value){ 856 var filesize = parseInt(input.files[0].size); 857 var maxsize = parseInt(input.closest('.uploadareaBlock').querySelector('[name="MAX_FILE_SIZE"]').value); 858 if(filesize > maxsize){//容éãï¼ã°ã¼ 859 input.value = ''; 860 uploadname.innerHTML = '<span class="red">ãã¡ã¤ã«ã®å®¹éã大ãããã¾ã</span>'; 861 previewSet(); 862 }else{ 863 displayNum = 0; 864 displayLoop = setInterval(function(){ 865 if(displayNum == 0) { 866 displayNum++; 867 uploadname.innerHTML = '<span class="red">èªã¿è¾¼ã¿ä¸</span>'; 868 }else if(displayNum == 1) { 869 displayNum++; 870 uploadname.innerHTML = '<span class="red">èªã¿è¾¼ã¿ä¸.</span>'; 871 }else if(displayNum == 2) { 872 displayNum++; 873 uploadname.innerHTML = '<span class="red">èªã¿è¾¼ã¿ä¸..</span>'; 874 }else if(displayNum == 2) { 875 displayNum = 0; 876 uploadname.innerHTML = '<span class="red">èªã¿è¾¼ã¿ä¸...</span>'; 877 } 878 }, 300); 879 880 //éåæã¢ãããã¼ã 881 var xmlHttpRequest = new XMLHttpRequest(); 882 xmlHttpRequest.addEventListener('readystatechange', function handler(){ 883 if (this.readyState === 4) { 884 if (this.status === 200) { 885 clearInterval(displayLoop); 886 var json = JSON.parse(this.responseText); 887 if(json.type == 'success') { 888 hidden_filePath.value = json.value; 889 hidden_filename.value = input.files[0].name; 890 hidden_filetype.value = input.files[0].type; 891 uploadname.innerHTML = input.files[0].name; 892 // block.nextElementSibling.classList.remove('disable'); 893 previewSet(); 894 }else if(json.type == 'error') { 895 input.value = ''; 896 hidden_filePath.value = ''; 897 previewSet(); 898 uploadname.innerHTML = '<span class="red">' + json.value + '</span>'; 899 // block.nextElementSibling.classList.add('disable'); 900 }else{ 901 input.value = ''; 902 hidden_filePath.value = ''; 903 previewSet(); 904 // block.nextElementSibling.classList.add('disable'); 905 uploadname.innerHTML = '<span class="red">䏿ãªã¨ã©ã¼</span>'; 906 } 907 this.removeEventListener('readystatechange', handler); 908 } else { 909 clearInterval(displayLoop); 910 console.error('ã¢ãããã¼ãå¦çãã¡ã¤ã«ãèªã¿è¾¼ããªã'); 911 this.removeEventListener('readystatechange', handler); 912 } 913 } 914 }); 915 xmlHttpRequest.open('POST', '../form_php/upload.php', true); 916 var fd = new FormData(); 917 fd.append(input.id, input.files[0]); 918 fd.append('configdir', document.form.getAttribute('data-configdir')); 919 xmlHttpRequest.send(fd); 920 } 921 }else{ 922 } 923 });
924 925 previewSet(); 926 927 if(hidden_filePath.value) { 928 block.classList.remove('disable'); 929 } 930 }(blocks[h], inputs[h])); 931 } 932 }else{ 933 var uploadwraps = document.querySelectorAll('.uploadWrap .uploadareaBlock'); 934 for(var i = 0; i < uploadwraps.length; i++) { 935 (function(uploadwrap){ 936 var oya = uploadwrap.parentNode; 937 oya.innerHTML = oya.innerHTML + '<p>å¥ã®ã¢ãããã¼ããµã¼ãã¹ãå©ç¨ãã¦ãéããã ããã<br><a href="http://gigafile.nu/" target="_blank">ã®ã¬ãã¡ã¤ã«ä¾¿</a></p>'; 938 }(uploadwraps[i])); 939 } 940 } 941 }else{//ãã®ã 942 943 } 944 }(targets[i])); 945 } 946 }()); 947 948 //ã¡ã¼ã«ã¢ãã¬ã¹ç¢ºèª 949 (function() { 950 var text_mail = document.getElementById('text_mail'); 951 var CheckMail = document.getElementById('CheckMail'); 952 if(CheckMail) { 953 var check = function() { 954 if (text_mail.value) { 955 CheckMail.innerText = text_mail.value; 956 } else { 957 CheckMail.innerText = 'ã'; 958 } 959 }; 960 text_mail.addEventListener('change', check); 961 text_mail.addEventListener('keyup', check); 962 text_mail.addEventListener('focus', check); 963 text_mail.addEventListener('blur', check); 964 check(); 965 } 966 })(); 967 968 //å¿ é ã¤ã³ããã 969 var allneedinputs = document.querySelectorAll('[data-needinput],[data-form-needinputcount]'); 970 //å¿ é æå®ã®è¦ªè¦ç´ ãããå ´å 971 var nowhissuSelector = [ 972 '[data-form-hissu]' 973 , 974 '[data-form-hissuteam][data-form-hissuteam-hissu]' 975 ].join(', '); 976 //ã¡ã¼ã«ãã§ã㯠977 var checkMailReg = /^[A-Za-z0-9]{1}[A-Za-z0-9_.\-]*@{1}[A-Za-z0-9_.\-]{1,}\.[A-Za-z0-9]{1,}$/; 978 //ãµãããããã¿ã³ 979 var submitbtns = document.querySelectorAll('form .formbtnarea .l-button-A'); 980 //data-view_termã®è¦ç´ 981 var formList = '.formlist'; 982 var formList_name = 'dt'; 983 984 //ã¬ã¤ãããã²ã¼ã·ã§ã³ 985 (function() { 986 var guidenavigation = document.getElementById('Guidenavigation'); 987 if (!guidenavigation) return false; 988 989 //ã¬ã¤ãããã²ã¼ã·ã§ã³è¦ç´ 990 if(document.documentElement.classList.contains('no-touchevents')) { 991 window.addEventListener('mousemove', function(e){ 992 guidenavigation.style.top = e.clientY + 'px'; 993 guidenavigation.style.left = e.clientX + 'px'; 994 }); 995 } 996 997 //ã«ã¦ã³ã¿ã¼ 998 var counterElement = document.getElementById('GuidenavigationCounter'); 999 1000 //é ç®ã®tyekku 1001 var check = function(){ 1002 var counter = 0; 1003 var total = 0; 1004 for(var i = 0; i < allneedinputs.length; i++) { 1005 (function(targetinput) { 1006 var parent = targetinput.closest(nowhissuSelector); 1007 if(parent) { 1008 total++; 1009 switch(targetinput.getAttribute('data-needinput-type')) { 1010 case 'text': 1011 case 'textarea': 1012 case 'select': 1013 if(targetinput.value === '') { 1014 counter++; 1015 } 1016 break; 1017 case 'email': 1018 if(targetinput.value.search(checkMailReg) == -1){//å ¥åããã¦ããªãã¨ã 1019 counter++; 1020 } 1021 break; 1022 case 'radio': 1023 if(!document.querySelector('[name="' + targetinput.getAttribute('data-form-needinput') + '"]:checked')) { 1024 counter++; 1025 } 1026 break; 1027 case 'checkbox': 1028 if(document.querySelectorAll('[name="' + targetinput.getAttribute('data-form-needinput') + '"]:checked').length < targetinput.getAttribute('data-form-hissuinput-count')) { 1029 counter++; 1030 } 1031 break; 1032 default : 1033 console.error('ã¬ã¤ãããã²ã¼ã·ã§ã³ 1'); 1034 break; 1035 } 1036 } 1037 }(allneedinputs[i])); 1038 } 1039 if(counter) { 1040 if(counterElement.innerText != counter) { 1041 counterElement.style.opacity = 0; 1042 counterElement.style.transform = 'translateY(20px)'; 1043 counterElement.style.transition = 'none'; 1044 counterElement.innerText = counter; 1045 setTimeout(function(){ 1046 counterElement.style.opacity = 1; 1047 counterElement.style.transform = 'none'; 1048 counterElement.style.transition = '1.8s cubic-bezier(0.175, 1.650, 0.195, 0.990)'; 1049 }, 200); 1050 1051 1052 guidenavigation.style.opacity = 1;
1053 guidenavigation.style.transition = 'none'; 1054 setTimeout(function(){ 1055 guidenavigation.style.opacity = 0; 1056 guidenavigation.style.transition = '4.8s cubic-bezier(0.175, 1.650, 0.195, 0.990)'; 1057 }, 1500); 1058 } 1059 }else{ 1060 counterElement.innerText = 0; 1061 } 1062 }; 1063 1064 //ãã§ãã¯ããè¦ç´ ãã¤ãã³ãã§ç£è¦ 1065 (function() { 1066 for(var i = 0; i < allneedinputs.length; i++) { 1067 (function(targetinput) { 1068 switch(targetinput.getAttribute('data-needinput-type')) { 1069 case 'text': 1070 case 'email': 1071 case 'textarea': 1072 targetinput.addEventListener('input', check); 1073 break; 1074 case 'checkbox': 1075 case 'radio': 1076 var inputs = targetinput.parentNode.querySelectorAll('input'); 1077 for(var h = 0; h < inputs.length; h++) { 1078 inputs[h].addEventListener('change', check); 1079 } 1080 break; 1081 case 'select': 1082 targetinput.addEventListener('change', check); 1083 break; 1084 } 1085 }(allneedinputs[i])); 1086 } 1087 }()); 1088 }()); 1089 1090 //ãµããããã¢ã©ã¼ã 1091 (function() { 1092 if (!document.getElementById('submitalert_flg')) return false; 1093 1094 //ã¹ã ã¼ãºã¹ã¯ãã¼ã« 1095 var jump = function(target, options) { 1096 var start = window.pageYOffset; 1097 var opt = options? 1098 { 1099 duration: options.duration || 1000, 1100 offset: options.offset || 0, 1101 callback: options.callback || null, 1102 easing: options.easing || easeInOutQuad 1103 } 1104 : 1105 { 1106 duration: 500, 1107 offset: 0, 1108 easing: easeInOutQuad 1109 }; 1110 var distance = typeof target === 'string' ? opt.offset + document.querySelector(target).getBoundingClientRect().top :target, 1111 duration = typeof opt.duration === 'function' ? opt.duration(distance) : opt.duration, 1112 timeStart, 1113 timeElapsed, 1114 mokushou = distance - start; 1115 1116 requestAnimationFrame(function(time) { 1117 timeStart = time; 1118 loop(time); 1119 }); 1120 1121 function loop(time) { 1122 timeElapsed = time - timeStart; 1123 window.scrollTo(0, opt.easing(timeElapsed, start, mokushou, duration)); 1124 if (timeElapsed < duration) requestAnimationFrame(loop) 1125 else end(); 1126 } 1127 1128 function end() { 1129 window.scrollTo(0, start + mokushou); 1130 if (opt.callback) opt.callback(); 1131 } 1132 1133 // Robert Penner's easeInOutQuad - http://robertpenner.com/easing/ 1134 function easeInOutQuad(t, b, c, d) { 1135 t /= d / 2 1136 if (t < 1) return c / 2 * t * t + b 1137 t-- 1138 return -c / 2 * (t * (t - 2) - 1) + b 1139 } 1140 } 1141 1142 var check = function(){ 1143 var counter = 0; 1144 var firstErrorElem; 1145 for(var i = 0; i < allneedinputs.length; i++) { 1146 (function(targetinput) { 1147 var parent = targetinput.closest(nowhissuSelector); 1148 if(parent) { 1149 switch(targetinput.getAttribute('data-needinput-type')) { 1150 case 'text': 1151 case 'textarea': 1152 if(targetinput.value === '') { 1153 counter++; 1154 if(!firstErrorElem) firstErrorElem = parent; 1155 } 1156 break; 1157 case 'select': 1158 if(targetinput.options[targetinput.selectedIndex].value === '') { 1159 counter++; 1160 if(!firstErrorElem) firstErrorElem = parent; 1161 } 1162 break; 1163 case 'email': 1164 if(targetinput.value.search(checkMailReg) == -1){//å ¥åããã¦ããªãã¨ã 1165 counter++; 1166 if(!firstErrorElem) firstErrorElem = parent; 1167 } 1168 break; 1169 case 'radio': 1170 if(!document.querySelector('[name="' + targetinput.getAttribute('data-checkboxradio') + '"]:checked')) { 1171 counter++; 1172 if(!firstErrorElem) firstErrorElem = parent; 1173 } 1174 break; 1175 case 'checkbox': 1176 if(document.querySelectorAll('[name="' + targetinput.getAttribute('data-checkboxradio') + '[]"]:checked').length < targetinput.getAttribute('data-form-needinputcount')) { 1177 counter++; 1178 if(!firstErrorElem) firstErrorElem = parent; 1179 } 1180 break; 1181 default : 1182 console.error('ãµããããããã㯠1'); 1183 break; 1184 } 1185 } 1186 }(allneedinputs[i])); 1187 } 1188 1189 1190 if(counter) {//ã¾ã å¿ é ãæ®ã£ã¦ãã 1191 for(var i = 0; i < submitbtns.length; i++) { 1192 submitbtns[i].style.opacity = 0.4; 1193 submitbtns[i].style.pointerEvents = 'none'; 1194 } 1195 }else{ 1196 for(var i = 0; i < submitbtns.length; i++) { 1197 submitbtns[i].style.opacity = ''; 1198 submitbtns[i].style.pointerEvents = ''; 1199 } 1200 } 1201 }; 1202 check(); 1203 1204 //ãã¼ã¸ããã¯ã¤ãã³ãã§å¿ é ãã§ã㯠1205 history.replaceState(null, null, null); 1206 window.addEventListener('popstate', function(e) { 1207 check(); 1208 }); 1209 window.addEventListener('pageshow', function(e) { 1210 check(); 1211 console.log('pageshow'); 1212 }); 1213 1214 //ãã§ãã¯ããè¦ç´ ãã¤ãã³ãã§ç£è¦ 1215 (function() { 1216 var allInput; 1217 allInput = document.querySelectorAll('form input[type="text"], form input[type="tel"], form input[type="email"], form textarea, form select'); 1218 for(var i = 0; i < allInput.length; i++) { 1219 (function(target) { 1220 target.addEventListener('input', check); 1221 }(allInput[i])); 1222 } 1223 1224 allInput = document.querySelectorAll('form input[type="checkbox"], form input[type="tel"], form input[type="radio"], form select, form select'); 1225 for(var i = 0; i < allInput.length; i++) { 1226 (function(target) { 1227 target.addEventListener('change', check); 1228 }(allInput[i])); 1229 } 1230 }()); 1231 }()); 1232 1233 //é¢è±ããã㯠1234 (function() { 1235 if (!document.getElementById('ridatsublock_flg')) return false; 1236 1237 var targets = document.querySelectorAll('form input, form select, form textarea'); 1238 var handler = function() { 1239 document.documentElement.classList.add('state_stoppingpagetransition'); 1240 }; 1241 for(var i = 0; i < targets.length; i++) { 1242 (function(target) { 1243 target.addEventListener('click', handler); 1244 target.addEventListener('touchstart', handler); 1245 }(targets[i])); 1246 } 1247 }()); 1248 1249 //å ¥åå½¢å¼äºåæç¤º 1250 (function() { 1251 if (!document.getElementById('nyuuryokukeisikijizensiji_flg')) return false; 1252 1253 var targets = document.querySelectorAll('[type="email"], [type="tel"], [data-form-autokana], [data-form-autokana_target]'); 1254 for(var i = 0; i < targets.length; i++) { 1255 (function(target) { 1256 var parent = target.closest('.itemWrap');
1257 var jizensiji = document.createElement('p'); 1258 jizensiji.className = 'jizensijiHyouji type01'; 1259 if(target.getAttribute('type') == 'email') { 1260 jizensiji.innerText = 'åè§ã§å ¥åãã¦ãã ãã'; 1261 }else if(target.getAttribute('type') == 'tel') { 1262 jizensiji.innerText = 'æ°åã§å ¥åãã¦ãã ãã'; 1263 }else if(target.getAttribute('data-form-autokana')) { 1264 jizensiji.innerText = 'å ¨è§ã§å ¥åãã¦ãã ãã'; 1265 }else if(target.getAttribute('data-form-autokana_target')) { 1266 jizensiji.innerText = 'ã«ã¿ã«ãã§å ¥åãã¦ãã ãã'; 1267 } 1268 parent.style.position = 'relative'; 1269 parent.appendChild(jizensiji); 1270 target.addEventListener('focus', function(){ 1271 jizensiji.classList.add('active'); 1272 }); 1273 target.addEventListener('blur', function(){ 1274 jizensiji.classList.remove('active'); 1275 }); 1276 }(targets[i])); 1277 } 1278 }()); 1279 1280 //å ¥åæåãµã¤ã³ 1281 (function() { 1282 if (!document.getElementById('nyuuryokuseikousing_flg')) return false; 1283 1284 for(var i = 0; i < allneedinputs.length; i++) { 1285 (function(targetinput) { 1286 var parent = targetinput.closest('.itemWrap'); 1287 var nyuuryokuDame = document.createElement('p'); 1288 nyuuryokuDame.className = 'nyuuryokuDame type01'; 1289 parent.style.position = 'relative'; 1290 parent.appendChild(nyuuryokuDame); 1291 var nyuuryokuOK = document.createElement('p'); 1292 nyuuryokuOK.className = 'nyuuryokuOK type01'; 1293 parent.appendChild(nyuuryokuOK); 1294 1295 var needCheckFunc = function(){ 1296 if(targetinput.closest(nowhissuSelector)) { 1297 switch(targetinput.getAttribute('data-needinput-type')) { 1298 case 'text': 1299 case 'textarea': 1300 case 'select': 1301 if(targetinput.value === '') { 1302 nyuuryokuDame.classList.add('active'); 1303 nyuuryokuOK.classList.remove('active'); 1304 }else{ 1305 nyuuryokuDame.classList.remove('active'); 1306 nyuuryokuOK.classList.add('active'); 1307 } 1308 break; 1309 case 'email': 1310 if(targetinput.value.search(checkMailReg) == -1){//å ¥åããã¦ããªãã¨ã 1311 nyuuryokuDame.classList.add('active'); 1312 nyuuryokuOK.classList.remove('active'); 1313 }else{ 1314 nyuuryokuDame.classList.remove('active'); 1315 nyuuryokuOK.classList.add('active'); 1316 } 1317 break; 1318 case 'radio': 1319 if(!document.querySelector('[name="' + targetinput.getAttribute('data-needinput') + '"]:checked')) { 1320 nyuuryokuDame.classList.add('active'); 1321 nyuuryokuOK.classList.remove('active'); 1322 }else{ 1323 nyuuryokuDame.classList.remove('active'); 1324 nyuuryokuOK.classList.add('active'); 1325 } 1326 break; 1327 case 'checkbox': 1328 if(document.querySelectorAll('[name="' + targetinput.getAttribute('data-needinput') + '[]"]:checked').length < ~~targetinput.getAttribute('data-form-needinputcount')) { 1329 nyuuryokuDame.classList.add('active'); 1330 nyuuryokuOK.classList.remove('active'); 1331 }else{ 1332 nyuuryokuDame.classList.remove('active'); 1333 nyuuryokuOK.classList.add('active'); 1334 } 1335 break; 1336 default : 1337 console.error('å ¥åæåãµã¤ã³ 1'); 1338 break; 1339 } 1340 } 1341 }; 1342 if(document.querySelector('.errorWrap')) { 1343 needCheckFunc(); 1344 } 1345 1346 switch(targetinput.getAttribute('data-needinput-type')) { 1347 case 'radio': 1348 var targetinputCheckbox = document.querySelectorAll('[name="' + targetinput.getAttribute('data-needinput') + '"]'); 1349 for(var j = 0; j < targetinputCheckbox.length; j++) { 1350 targetinputCheckbox[j].addEventListener('change', needCheckFunc); 1351 } 1352 break; 1353 case 'checkbox': 1354 var targetinputCheckbox = document.querySelectorAll('[name="' + targetinput.getAttribute('data-needinput') + '[]"]'); 1355 for(var j = 0; j < targetinputCheckbox.length; j++) { 1356 targetinputCheckbox[j].addEventListener('change', needCheckFunc); 1357 } 1358 break; 1359 default: 1360 targetinput.addEventListener('blur', needCheckFunc); 1361 targetinput.addEventListener('input', needCheckFunc); 1362 break; 1363 } 1364 }(allneedinputs[i])); 1365 } 1366 }()); 1367 1368 //ã¡ã¼ã«ãµã¸ã§ã¹ã 1369 (function() { 1370 if (!document.getElementById('mailsugest_flg')) return false; 1371 1372 var maildomains = { 1373 a:[ 1374 ['au.com', 'au'] 1375 , 1376 ['augps.ezweb.ne.jp', 'au'] 1377 ] 1378 , 1379 b:[ 1380 ['biglobe.ne.jp', 'BIGLOBEã¡ã¼ã«'] 1381 , 1382 ['biz.ezweb.ne.jp', 'au'] 1383 ] 1384 , 1385 c:null 1386 , 1387 d:[ 1388 ['disney.ne.jp', 'ã½ãããã³ã¯'] 1389 , 1390 ['docomo.ne.jp', 'NTTãã³ã¢', true] 1391 , 1392 ['dwmail.jp', 'NTTãã³ã¢ï¼webã¡ã¼ã«ï¼'] 1393 ] 1394 , 1395 e:[ 1396 ['ezweb.ne.jp', 'au'] 1397 , 1398 ['emobile-s.ne.jp', 'Y!mobile'] 1399 , 1400 ['emobile.ne.jp', 'Y!mobile'] 1401 , 1402 ['emnet.ne.jp', 'Y!mobile'] 1403 , 1404 ['excite.co.jp', 'ã¨ããµã¤ãã¡ã¼ã«'] 1405 ] 1406 , 1407 f:null 1408 , 1409 g:[ 1410 ['gmail.com', 'Gmail', true] 1411 ] 1412 , 1413 h:[ 1414 ['hotmail.co.jp', 'Outlook.com'] 1415 , 1416 ['hotmail.com', 'Outlook.com'] 1417 ] 1418 , 1419 i:[ 1420 ['i.softbank.jp', 'ã½ãããã³ã¯', true] 1421 , 1422 ['icloud.com', 'Apple', true] 1423 ] 1424 , 1425 j:[ 1426 ['jp-c.ne.jp', 'Jãã©ã³'] 1427 , 1428 ['jp-d.ne.jp', 'Jãã©ã³'] 1429 , 1430 ['jp-h.ne.jp', 'Jãã©ã³'] 1431 , 1432 ['jp-k.ne.jp', 'Jãã©ã³'] 1433 , 1434 ['jp-n.ne.jp', 'Jãã©ã³'] 1435 , 1436 ['jp-q.ne.jp', 'Jãã©ã³'] 1437 , 1438 ['jp-r.ne.jp', 'Jãã©ã³'] 1439 , 1440 ['jp-s.ne.jp', 'Jãã©ã³'] 1441 , 1442 ['jp-t.ne.jp', 'Jãã©ã³'] 1443 ] 1444 , 1445 k:null 1446 , 1447 l:[ 1448 ['live.jp', 'Outlook.com'] 1449 ] 1450 , 1451 m:[ 1452 ['mopera.net', 'NTTãã³ã¢ï¼mopera Uï¼'] 1453 ] 1454 , 1455 n:[ 1456 ['nifty.com', 'ãããã£'] 1457 ] 1458 , 1459 o:[ 1460 ['outlook.com', 'Outlook.com'] 1461 , 1462 ['outlook.jp', 'Outlook.com'] 1463 ] 1464 , 1465 p:[ 1466 ['pdx.ne.jp', 'Y!mobile'] 1467 ] 1468 , 1469 q:null 1470 , 1471 r:null 1472 , 1473 s:[ 1474 ['softbank.ne.jp', 'ã½ãããã³ã¯', true] 1475 ] 1476 , 1477 t:null 1478 , 1479 u:[ 1480 ['uqmobile.jp', 'au'] 1481 ] 1482 , 1483 v:[ 1484 ['vodafone.ne.jp', 'ã½ãããã³ã¯'] 1485 ] 1486 , 1487 w:[ 1488 ['willcom.com', 'Y!mobile'] 1489 , 1490 ['wcm.ne.jp', 'Y!mobile'] 1491 ] 1492 , 1493 x:null 1494 , 1495 y:[ 1496 ['yahoo.co.jp', 'yahoo', true] 1497 , 1498 ['ymobile.ne.jp', 'Y!mobile'] 1499 , 1500 ['y-mobile.ne.jp', 'Y!mobile'] 1501 , 1502 ['ymobile1.ne.jp', 'Y!mobile'] 1503 ] 1504 , 1505 z:null 1506 }; 1507 1508 var targets = document.querySelectorAll('[type="email"]'); 1509 for(var i = 0; i < targets.length; i++) { 1510 1511 (function(target) { 1512 var parent = target.closest('.itemWrap'); 1513 1514 var mailsugestList = document.createElement('ul'); 1515 mailsugestList.className = 'mailsugestList'; 1516 parent.style.position = 'relative'; 1517 parent.appendChild(mailsugestList); 1518 var mailsugestArrowInput = document.createElement('div'); 1519 mailsugestArrowInput.className = 'mailsugestArrowInput'; 1520 parent.appendChild(mailsugestArrowInput); 1521 for (var key in maildomains) { 1522 if(maildomains[key]) {//nullä»¥å¤ 1523 for(var j = 0; j < maildomains[key].length; j++) { 1524 var li = document.createElement('li'); 1525 li.setAttribute('data-mailsugest-chara', key); 1526 li.setAttribute('data-mailsugest-mail', maildomains[key][j][0]); 1527 if(maildomains[key][j][2]) { 1528 li.setAttribute('data-mailsugest-first', 1); 1529 } 1530 li.className = 'mailsugestListLI'; 1531 li.innerHTML = '<span class="mailsugestListInput"></span><span class="mailsugestListMail">@' + maildomains[key][j][0] + '</span>'; 1532 li.innerHTML += '<span class="mailsugestListDesc">' + maildomains[key][j][1] + '</span>'; 1533 li.addEventListener('click', function(e){//ãµã¸ã§ã¹ãã¯ãªã㯠1534 var values = target.value.split('@'); 1535 if(2 <= values.length) { 1536 target.value = values[0] + '@' + e.currentTarget.getAttribute('data-mailsugest-mail'); 1537 }else{ 1538 target.value = target.value + '@' + e.currentTarget.getAttribute('data-mailsugest-mail'); 1539 } 1540 1541 target.blur(); 1542 });
1543 mailsugestList.appendChild(li); 1544 } 1545 } 1546 } 1547 1548 var mailsugestSelects = mailsugestList.querySelectorAll('.mailsugestListLI .mailsugestListInput'); 1549 var mailsugestSelectsLI = mailsugestList.querySelectorAll('.mailsugestListLI'); 1550 var inputHandler = function(){ 1551 //ãµã¸ã§ã¹ã表示 1552 if(target.value) { 1553 mailsugestList.classList.add('inputed'); 1554 mailsugestArrowInput.classList.add('inputed'); 1555 }else{ 1556 mailsugestList.classList.remove('inputed'); 1557 mailsugestArrowInput.classList.remove('inputed'); 1558 } 1559 1560 var values = target.value.split('@'); 1561 if(2 <= values.length) { 1562 //ãµã¸ã§ã¹ãã«æåãå ¥ãã 1563 for(var j = 0; j < mailsugestSelects.length; j++) { 1564 mailsugestSelects[j].innerText = values[0]; 1565 } 1566 1567 //ãµã¸ã§ã¹ããåãæ¿ãã 1568 if(values[1]) { 1569 for(var i = 0; i < mailsugestSelectsLI.length; i++) { 1570 mailsugestSelectsLI[i].classList.add('remove'); 1571 } 1572 var targetSugests = mailsugestList.querySelectorAll('.mailsugestListLI[data-mailsugest-chara="' + values[1].charAt(0) + '"]'); 1573 for(var h = 0; h < targetSugests.length; h++) { 1574 targetSugests[h].classList.remove('remove'); 1575 targetSugests[h].classList.add('active'); 1576 } 1577 }else{ 1578 for(var i = 0; i < mailsugestSelectsLI.length; i++) { 1579 mailsugestSelectsLI[i].classList.remove('remove','active'); 1580 } 1581 } 1582 }else{ 1583 //ãµã¸ã§ã¹ãã«æåãå ¥ãã 1584 for(var j = 0; j < mailsugestSelects.length; j++) { 1585 mailsugestSelects[j].innerText = target.value; 1586 } 1587 1588 //ãµã¸ã§ã¹ããåãæ¿ãã 1589 for(var i = 0; i < mailsugestSelectsLI.length; i++) { 1590 mailsugestSelectsLI[i].classList.remove('remove','active'); 1591 } 1592 } 1593 }; 1594 inputHandler(); 1595 1596 target.addEventListener('input', inputHandler); 1597 target.addEventListener('change', inputHandler); 1598 target.addEventListener('keyup', inputHandler); 1599 1600 target.addEventListener('focus', function(){ 1601 inputHandler(); 1602 mailsugestList.classList.add('active'); 1603 mailsugestArrowInput.classList.add('active'); 1604 }); 1605 target.addEventListener('blur', function(){ 1606 setTimeout(function(){ 1607 mailsugestList.classList.remove('active'); 1608 mailsugestArrowInput.classList.remove('active'); 1609 target.dispatchEvent(new Event('change')); 1610 target.dispatchEvent(new Event('keyup')); 1611 target.dispatchEvent(new Event('input')); 1612 }, 500); 1613 }); 1614 }(targets[i])); 1615 } 1616 }()); 1617}()); 1618});
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.