1// form.js 2// -- é常 3$(function(){ 4 // -- ã«ãããµã³ãã« 5 // åé¤ãã¿ã³ãã¯ãªãã¯ã§ãµã³ãã«åé¤ 6 // $( '.cutSmploptionBox_item tbody td a' ).on( 'click', function() { 7 // var $item = $( this ).parent().parent().parent(); 8 // $item.remove(); 9 10 // // ãµã³ãã«ããªãå ´å 11 // if( !$( '.cutSmploptionBox_item tbody tr' ).length ){ 12 // $( '.cutSmploptionBox_item' ).remove(); 13 // $( '.cutSmploptionBox_txt' ).show(); 14 // $( '.cutSmploptionBox_btn a' ).text( 'ãµã³ãã«ã鏿ãã' ); 15 // } 16 // return false; 17 // }); 18 // ãµã³ãã«ããªãå ´å 19 if( !$( '.cutSmploptionBox_item tbody tr' ).length ){ 20 $( '.cutSmploptionBox_item' ).remove(); 21 $( '.cutSmploptionBox_txt' ).show(); 22 $( '.cutSmploptionBox_btn a' ).text( 'ãµã³ãã«ã鏿ãã' ); 23 } 24 25 // -- ã»ã¬ã¯ãããã¯ã¹é¸æã§è¦ç´ ã表示 26 // var $firstShowItem = $( '.firstShowItem select' ); 27 // $firstShowItem.on( 'change' ,function() { 28 // if( $firstShowItem.children( 'option:selected' ).text() !== '' ) { 29 // $( '.nextShowItem' ).fadeIn( 600 ); 30 // $( '.firstShowItem_txt' ).fadeOut( 600 ); 31 // } else { 32 // $( '.nextShowItem' ).fadeOut( 600 ); 33 // $( '.firstShowItem_txt' ).fadeIn( 600 ); 34 // } 35 // }); 36 37 // -- ãã©ã¼ã ã¨ã©ã¼ãããå ´å 38 //ã¯ã©ã¹ 39 const error_class = 'errors'; 40 41 //ã¨ã©ã¼ã¡ãã»ã¼ã¸ 42 const required_message = 'å¿ é é ç®ãæªå ¥åã§ã'; 43 const mail_message = 'æå¹ãªã¡ã¼ã«ã¢ãã¬ã¹ãå ¥åãã¦ãã ãã'; 44 const mailagain_message = 'ã¡ã¼ã«ã¢ãã¬ã¹ãä¸è´ãã¾ãã'; 45 const tel_message = 'åè§æ°åã§å ¥åãã¦ãã ãã'; 46 const checkbox_message = 'ãå人æ å ±ã®åæ±ããã®å 容ã«åæã®ä¸ããã§ãã¯ãå ¥ãã¦ãã ããã'; 47 48 //æ£è¦è¡¨ç¾ 49 const mail_check = "^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$"; 50 const tel_check = "^[0-9]+$"; 51 52 //ããªãã¼ã·ã§ã³ã®é¢æ°ãå®ç¾© 53 function validate( attr , message , check ) { 54 if( attr.val() == "" ){ 55 if( attr.parent().hasClass( error_class ) ) { 56 attr.parent().find( '.errorMsg' ).text( required_message ); 57 } else { 58 attr.parent().addClass( error_class ); 59 attr.parent().find( 'input:last-child , button:last-child' ).after( '<p class="errorMsg">' + required_message + '</p>' ); 60 } 61 } else if (!attr.val().match(check)) { 62 if( attr.parent().hasClass( error_class ) ) { 63 attr.parent().find( '.errorMsg' ).text( message ); 64 } else { 65 attr.parent().addClass( error_class ); 66 attr.parent().find( 'input:last-child , button:last-child' ).after( '<p class="errorMsg">' + message + '</p>' ); 67 } 68 } else { 69 attr.parent().removeClass(error_class); 70 attr.parent().find( '.errorMsg' ).remove(); 71 } 72 } 73 // åè§æ°åã®é¢æ° 74 function hankaku( $outer , $this ) { 75 if( $this.val() ){ 76 if( !$this.val().match( tel_check ) ) { 77 if( $this.parent().hasClass( error_class ) ) { 78 $this.parent().find( '.errorMsg' ).text( tel_message ); 79 } else { 80 $this.parent().addClass( error_class ); 81 $this.parent().find( 'input:last-child , button:last-child' ).after( '<p class="errorMsg">' + tel_message + '</p>' ); 82 } 83 } else { 84 $this.parent().removeClass(error_class); 85 $this.parent().find( '.errorMsg' ).remove(); 86 } 87 } else { 88 if( $outer.hasClass( 'required' ) ) { 89 if( $this.parent().hasClass( error_class ) ) { 90 $this.parent().find( '.errorMsg' ).text( required_message ); 91 } else { 92 $this.parent().addClass( error_class ); 93 $this.parent().find( 'input:last-child , button:last-child' ).after( '<p class="errorMsg">' + required_message + '</p>' ); 94 } 95 } else { 96 $this.parent().removeClass(error_class); 97 $this.parent().find( '.errorMsg' ).remove(); 98 } 99 } 100 } 101 102 // submiãããæã«ãã§ã㯠103 $( '#form' ).submit( function() { 104 // ç´ä¸ã®input[type="text"] 105 $( 'tr.required td > input[type="text"]:not(.noreq)' ).each( function() { 106 var $outer = $( this ).parent(); 107 if( $( this ).val() ){ 108 $outer.removeClass( error_class ); 109 $outer.find( '.errorMsg' ).remove(); 110 } else { 111 if( !$outer.hasClass( error_class ) ) { 112 $outer.addClass( error_class ); 113 $outer.append( '<p class="errorMsg">' + required_message + '</p>' ); 114 } 115 } 116 }); 117 118 // 2ã«ã©ã ã®input[type="text"] 119 $( 'tr.required td > .inputTxtCrm2 input[type="text"]:not(.noreq)' ).each( function() { 120 var $outer = $( this ).parent(); 121 if( $( this ).val() ){ 122 $( this ).removeClass( 'errr' ); 123 if( !$outer.find( '.errr' ).length ){ 124 $outer.removeClass( error_class ); 125 $outer.find( '.errorMsg' ).remove(); 126 } 127 } else { 128 $( this ).addClass( 'errr' ); 129 if( $outer.find( '.errr' ).length ){ 130 if( !$outer.hasClass( error_class ) ) { 131 $outer.addClass( error_class ); 132 $outer.append( '<p class="errorMsg">' + required_message + '</p>' ); 133 } 134 } 135 } 136 }); 137 138 // dlå ã®input[type="text"] 139 $( 'tr.required td dd input[type="text"]:not(.noreq)' ).each( function() { 140 var $outer = $( this ).parent(); 141 if( $( this ).val() ){ 142 $outer.removeClass( error_class ); 143 $outer.find( '.errorMsg' ).remove(); 144 } else { 145 if( !$outer.hasClass( error_class ) ) { 146 $outer.addClass( error_class ); 147 $outer.append( '<p class="errorMsg">' + required_message + '</p>' ); 148 } 149 } 150 }); 151 152 // select 153 $( 'tr.required select' ).each( function() { 154 var $outer = $( this ).parent().parent(); 155 if( $( this ).val() ){ 156 $outer.removeClass( error_class ); 157 $outer.find( '.errorMsg' ).remove(); 158 } else { 159 if( !$outer.hasClass( error_class ) ) { 160 $outer.addClass( error_class ); 161 $outer.append( '<p class="errorMsg">' + required_message + '</p>' ); 162 } 163 } 164 }); 165 166 // ã¡ã¼ã« 167 validate( $( '#email' ) , mail_message , mail_check); 168 169 // ã¡ã¼ã«åå ¥åã®ãã§ã㯠170 var email_address = $( '#email' ).val(), 171 $email_again = $( '#email_again' ), 172 again_address = $email_again.val(); 173 174 if( $email_again.val() == "" ){ 175 if( $email_again.parent().hasClass( error_class ) ) { 176 $email_again.parent().find( '.errorMsg' ).text( required_message ); 177 } else { 178 $email_again.parent().addClass( error_class ); 179 $email_again.parent().find( 'input:last-child , button:last-child' ).after( '<p class="errorMsg">' + required_message + '</p>' ); 180 } 181 } else if ( email_address == again_address ) { 182 $email_again.parent().removeClass( error_class ); 183 $email_again.parent().find( '.errorMsg' ).remove(); 184 } else { 185 if( $email_again.parent().hasClass( error_class ) ) { 186 $email_again.parent().find( '.errorMsg' ).text( mailagain_message ); 187 } else { 188 $email_again.parent().addClass( error_class ); 189 $email_again.parent().find( 'input:last-child , button:last-child' ).after( '<p class="errorMsg">' + mailagain_message + '</p>' ); 190 } 191 } 192 193 // åè§æ°åã®å ´å 194 $( 'input.hankaku' ).each( function() { 195 if( $( this ).parent().hasClass( 'postCode' ) ){ 196 var $outer = $( this ).parent().parent().parent(); 197 hankaku( $outer , $( this ) ); 198 199 } else { 200 var $outer = $( this ).parent().parent(); 201 hankaku( $outer , $( this ) ); 202 } 203 }); 204 205 206 // ãã§ãã¯ããã¯ã¹ã®å¿ é ãã§ãã¯ï¼ï¼ã¤ä»¥ä¸ï¼ 207 $('.required input[type="checkbox"]').each(function () { 208 let checkedsum; 209 let name = $( this ).attr( 'name' ); 210 var $outer = $( this ).parent(); 211 checkedsum = $( "input[name='" + name + "']:checked" ).length; 212 if( checkedsum > 0 ){ 213 $outer.removeClass( error_class ); 214 $outer.find( '.errorMsg' ).remove(); 215 } else { 216 if( !$outer.hasClass( error_class ) ) { 217 $outer.addClass( error_class ); 218 $outer.append( '<p class="errorMsg">' + checkbox_message + '</p>' ); 219 } 220 } 221 }); 222 223 // ã¨ã©ã¼ãããã°submitã忢 224 if( $( '.' + error_class ).length > 0 ){ 225 var speed = 1000, 226 position = $( '.formTable .errors:first-of-type' ).offset().top, 227 headerHeight = $( 'header' ).innerHeight(); 228 $( 'body , html' ).animate({ scrollTop : position - headerHeight } , speed , 'swing' ); 229 return false;
230 } 231 }); 232});
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.