1(function ($) { 2 'use strict'; 3 4 var $inputArea = $('.js-input-area'); 5 var $confirmArea = $('.js-confirm-area'); 6 var submit_flag = false; 7 8 var formPos = $('form').length ? $('form').offset().top : 0; 9 var step_i = 0; 10 11 // post 12 var dataPost = { 13 data: {} 14 }; 15 16 17 // validate 18 var messages = { 19 required: 'å¿ é é ç®ãå ¥åããã¦ãã¾ãã', 20 }; 21 22 var options = { 23 changeEvent: true, 24 submitEvent: true, 25 beforeSubmit: function () { 26 return true; 27 28 }, 29 notFalseSubmit: function () { 30 if ( submit_flag ) { 31 return true; 32 } 33 $('[name="Submit"]').click(); 34 35 return false; 36 } 37 }; 38 39 $('form').formValidate(messages, options); 40 41 // æ»ããã¿ã³ 42 $('.js-confirm-area .back-btn').click( function() { 43 history.back(); 44 return false; 45 }); 46 47 48 // éä¿¡ãã¿ã³ 49 $('.js-confirm-area .submit-btn').click( function() { 50 submit_flag = true; 51 // ãã§ãã¯ç¶æ ãç¢ºèª 52 const isChecked = $('.js-confirm-area input[name="confirm"]').is(':checked'); 53 54 if (!isChecked) { 55 alert('éä¿¡å 容ã«ã¤ãã¦ç¢ºèªãã¦ãã ããã'); 56 e.preventDefault(); 57 return false; 58 } 59 $('[name="Submit"]').click(); 60 }); 61 62 // ãã§ãã¯ããã¯ã¹ã®ç¶æ ã«å¿ãã¦ã¨ã©ã¼ããã¹ãã表示ã»é表示 63 $('.js-confirm-area input[name="confirm"]').on('change', function () { 64 const isChecked = $(this).is(':checked'); // ãã§ãã¯ç¶æ ãå¤å¥ 65 const $errorText = $('.js-confirm-area .error-txt'); // ã¨ã©ã¼ããã¹ãè¦ç´ ãåå¾ 66 67 if (isChecked) { 68 $errorText.hide(); 69 } else { 70 $errorText.show(); 71 } 72 }); 73 74 75 // 追å ããHTMLãæååã¨ãã¦å®ç¾© 76 // HTMLãã³ãã¬ã¼ã 77 const htmlTemplates = { 78 '#aform-1': ` 79<ul class="form-list form-confirm-list c-border01"> 80 <li class="confirm-category"><div class="head"><p>åéå½¢æ </p></div><div class="body"><p><span class="confirm-category">__category__</span></p></div></li> 81 <li class="confirm-name"><div class="head"><p>æ°å</p></div><div class="body"><p><span class="confirm-name">__name__</span></p></div></li> 82 <li class="confirm-name_kana"><div class="head"><p>æ°åï¼ããªã¬ãï¼</p></div><div class="body"><p><span class="confirm-name_kana">__name_kana__</span></p></div></li> 83 <li class="confirm-email"><div class="head"><p>ã¡ã¼ã«ã¢ãã¬ã¹</p></div><div class="body"><p><span class="confirm-email">__email__</span></p></div></li> 84 <li class="confirm-email_confirm"><div class="head"><p>ã¡ã¼ã«ã¢ãã¬ã¹ç¢ºèªç¨</p></div><div class="body"><p class="txt"><span class="confirm-email_confirm">__email_confirm__</span></p></div></li> 85 <li class="confirm-tel"><div class="head"><p>é»è©±çªå·</p></div><div class="body"><p><span class="confirm-tel">__tel__</span></p></div></li> 86</ul> 87<ul class="form-list form-confirm-list c-border01"> 88 <li class="confirm-question"><div class="head"><p>
88質åãªã©</p></div><div class="body"><p><span class="confirm-question">__question__</span></p></div></li> 89</ul> 90<ul class="form-list form-confirm-list c-border01"> 91 <li class="confirm-privacy_agree"><div class="head"><p>å人æ å ±ã®åãæ±ãã«ã¤ãã¦</p></div><div class="body"><p><span class="confirm-privacy_agree">__privacy_agree__</span></p></div></li> 92</ul> 93`, 94 '#aform-2': ` 95<ul class="form-list form-confirm-list c-border01"> 96 <li class="confirm-category"><div class="head"><p>ãåãåãã種å¥</p></div><div class="body"><p>__category__</p></div></li> 97 <li class="confirm-title"><div class="head"><p>ãåãåããã¿ã¤ãã«</p></div><div class="body"><p>__title__</p></div></li> 98 <li class="confirm-details"><div class="head"><p>ãåãåããå 容</p></div><div class="body"><p>__details__</p></div></li> 99 <li class="confirm-store_name"><div class="head"><p>åºèå</p></div><div class="body"><p>__store_name__</p></div></li> 100 <li class="confirm-product_name"><div class="head"><p>ååå</p></div><div class="body"><p>__product_name__</p></div></li> 101 <li class="confirm-barcode_number"><div class="head"><p>ãã¼ã³ã¼ãNo.</p></div><div class="body"><p class="txt">__barcode_number__</p></div></li> 102 <li class="confirm-maker_name"><div class="head"><p>ã¡ã¼ã«ã¼å</p></div><div class="body"><p>__maker_name__</p></div></li> 103</ul> 104<ul class="form-list form-confirm-list c-border01"> 105 <li class="confirm-media_name"><div class="head"><p>åªä½å</p></div><div class="body"><p>__media_name__</p></div></li> 106 <li class="confirm-request"><div class="head"><p>ãè¦æ</p></div><div class="body"><p>__request__</p></div></li> 107 <li class="confirm-company_name"><div class="head"><p>貴社å</p></div><div class="body"><p>__company_name__</p></div></li> 108 <li class="confirm-department"><div class="head"><p>é¨ç½²åã»å½¹è·å</p></div><div class="body"><p>__department__</p></div></li> 109 <li class="confirm-name"><div class="head"><p>æ°å</p></div><div class="body"><p>__name__</p></div></li> 110 <li class="confirm-name_kana"><div class="head"><p>æ°åï¼ããªã¬ãï¼</p></div><div class="body"><p>__name_kana__</p></div></li> 111 <li class="confirm-email"><div class="head"><p>ã¡ã¼ã«ã¢ãã¬ã¹</p></div><div class="body"><p>__email__</p></div></li> 112 <li class="confirm-email_confirm"><div class="head"><p>ã¡ã¼ã«ã¢ãã¬ã¹ç¢ºèªç¨</p></div><div class="body"><p>__email_confirm__</p></div></li> 113 <li class="confirm-tel"><div class="head"><p>é»è©±çªå·</p></div><div class="body"><p>__tel__</p></div></li> 114</ul> 115<ul class="form-list form-confirm-list c-border01"> 116 <li class="confirm-reply"><div class="head"><p>è¿ä¿¡è¦ã»ä¸è¦</p></div><div class="body"><p>__reply__</p></div></li> 117 <li class="confirm-privacy_agree"><div class="head"><p>å人æ å ±ã®åãæ±ãã«ã¤ãã¦</p></div><div class="body"><p>__privacy_agree__</p></div></li> 118</ul> 119`, 120'#aform-3': ` 121<ul class="form-list form-confirm-list c-border01"> 122 <li class="confirm-category"><div class="head"><p>ãåãåãã種å¥</p></div><div class="body"><p>__category__</p></div></li> 123 <li class="confirm-business"><div class="head"><p>è²©å£²äºæ¥ç¨®å¥</p></div><div class="body"><p>__business__</p></div></li> 124 <li class="confirm-from"><div class="head"><p>åºåºå½</p></div><div class="body"><p>__from__</p></div></li> 125 <li class="confirm-store_area"><div class="head"><p>åºåºã¨ãªã¢ï¼é½éåºçï¼</p></div><div class="body"><p>__store_area__</p></div></li> 126 <li class="confirm-title"><div class="head"><p>ãåãåããã¿ã¤ãã«</p></div><div class="body"><p>__title__</p></div></li> 127 <li class="confirm-details"><div class="head"><p>ãåãåããå 容</p></div><div class="body"><p>__details__</p></div></li> 128 <li class="confirm-pdf_upload"><div class="head"><p>æ·»ä»ãã¡ã¤ã«(PDF)</p></div><div class="body"><p>__pdf_upload__</p></div></li> 129</ul> 130<ul class="form-list form-confirm-list c-border01"> 131 <li class="confirm-company_name"><div class="head"><p>貴社å</p></div><div class="body"><p>__company_name__</p></div></li> 132 <li class="confirm-department"><div class="head"><p>é¨ç½²åã»å½¹è·å</p></div><div class="body"><p>__department__</p></div></li> 133 <li class="confirm-name"><div class="head"><p>æ°å</p></div><div class="body"><p>__name__</p></div></li> 134 <li class="confirm-name_kana"><div class="head"><p>
134æ°åï¼ããªã¬ãï¼</p></div><div class="body"><p>__name_kana__</p></div></li> 135 <li class="confirm-email"><div class="head"><p>ã¡ã¼ã«ã¢ãã¬ã¹</p></div><div class="body"><p>__email__</p></div></li> 136 <li class="confirm-email_confirm"><div class="head"><p>ã¡ã¼ã«ã¢ãã¬ã¹ç¢ºèªç¨</p></div><div class="body"><p>__email_confirm__</p></div></li> 137 <li class="confirm-tel"><div class="head"><p>é»è©±çªå·</p></div><div class="body"><p>__tel__</p></div></li> 138</ul> 139<ul class="form-list form-confirm-list c-border01"> 140 <li class="confirm-privacy_agree"><div class="head"><p>å人æ å ±ã®åãæ±ãã«ã¤ãã¦</p></div><div class="body"><p>__privacy_agree__</p></div></li> 141</ul> 142` 143 144 }; 145 146 const fieldSetsPerForm = { 147 '#aform-2': { 148 åå: ['category', 'title', 'details', 'product_name', 'barcode_number', 'maker_name', 'company_name', 'name', 'name_kana', 'email', 'email_confirm', 'tel', 'reply', 'privacy_agree'], 149 ã¡ãã£ã¢: ['category', 'media_name', 'company_name', 'department', 'name', 'name_kana', 'email', 'email_confirm', 'tel', 'request', 'privacy_agree'], 150 åºè: ['category', 'title', 'details', 'store_name', 'company_name', 'name', 'name_kana', 'email', 'email_confirm', 'tel', 'reply', 'privacy_agree'], 151 ãã®ä»: ['category', 'title', 'details', 'company_name', 'name', 'name_kana', 'email', 'email_confirm', 'tel', 'reply', 'privacy_agree'] 152 }, 153 '#aform-3': { 154 åºèç©ä»¶: ['category', 'store_area', 'title', 'details', 'pdf_upload', 'company_name', 'department', 'name', 'name_kana', 'email', 'email_confirm', 'tel', 'privacy_agree'], 155 FCå çåº: ['category', 'store_area', 'title', 'details', 'pdf_upload', 'company_name', 'department', 'name', 'name_kana', 'email', 'email_confirm', 'tel', 'privacy_agree'], 156 å§è¨è²©å£²äºæ¥ç¤¾: ['category', 'store_area', 'title', 'details', 'pdf_upload', 'company_name', 'department', 'name', 'name_kana', 'email', 'email_confirm', 'tel', 'privacy_agree'], 157 æµ·å¤è²©å£²äºæ¥ç¤¾: ['category', 'business', 'from', 'title', 'details', 'pdf_upload', 'company_name', 'department', 'name', 'name_kana', 'email', 'email_confirm', 'tel', 'privacy_agree'] 158 }, 159 160 }; 161 162 const currentFormId = ['#aform-1', '#aform-2', '#aform-3', '#aform-4'].find(id => $(id).length) || null; 163 const fieldSets = fieldSetsPerForm[currentFormId] || null; 164 const allFields = fieldSets ? Array.from(new Set(Object.values(fieldSets).flat())) : []; 165 166 // å¤åæå¦ç 167 function syncConfirmValues() { 168 $('[name]').each(function () { 169 const $sourceEl = $(this); 170 const name = $sourceEl.attr('name'); 171 // ID㯠`plg_` + name å½¢å¼ 172 const $targetEl = $('#plg_' + name); 173 if ($targetEl.length === 0 || $sourceEl[0] === $targetEl[0]) return; 174 175 const syncValue = function () { 176 let value = ''; 177 if ($sourceEl.attr('type') === 'checkbox') { 178 value = $(`[name="${name}"]`).filter(':checked').map(function () { 179 return $(this).val(); 180 }).get().join(', '); 181 } else { 182 value = $sourceEl.val(); 183 } 184 $targetEl.val(value); 185 }; 186 187 $sourceEl.on('input', syncValue); 188 if ($sourceEl.attr('type') === 'checkbox') { 189 $sourceEl.on('change', syncValue); 190 } 191 syncValue(); // åæåæ 192 }); 193 } 194 195 196 // å ¥åç»é¢å¶å¾¡ 197 function applyFieldVisibility() { 198 const selected = $('select[name="category"]').val(); 199 if (!fieldSets || !fieldSets[selected]) { 200 $('[name]').each(function () { 201 if ($(this).attr('name') == 'mail_post') return; // ãã§ãã¯ããã¯ã¹ã¯é¤å¤ 202 $(this).prop('disabled', false).closest('li').show(); 203 }); 204 return; 205 } 206 207 const enabledFields = fieldSets[selected]; 208 allFields.forEach(name => { 209 if (name == 'confirm' || name == 'mail_post') return; // ãã§ãã¯ããã¯ã¹ã¯é¤å¤ 210 $('[name="' + name + '"]').each(function () { 211 const $el = $(this); 212 if (enabledFields.includes(name)) { 213 $el.prop('disabled', false).closest('li').show(); 214 } else { 215 $el.prop('disabled', true).closest('li').hide().val('').prop('checked', false); 216 } 217 }); 218 });
219 } 220 221 // ãã¡ã¤ã«inputã¯ãªãã¯é£åè¨å® 222 function bindFileInputClick() { 223 const fileInput = document.getElementById('plg_pdf_upload'); 224 const fileNameDisplay = document.getElementById('file_name_display'); 225 const fileSelectButton = document.getElementById('file_select_button'); 226 const label = document.querySelector('label[for="pdf_upload"]'); 227 const errorText = document.querySelector('.file-upload-wrap .error-txt'); 228 229 if (!fileInput || !fileNameDisplay || !fileSelectButton || !label || !errorText) return; 230 231 // æå¤§ãã¡ã¤ã«ãµã¤ãº 232 const MAX_FILE_SIZE = 10 * 1024 * 1024; 233 234 // ãã¿ã³ãã¯ãªãã¯ãããfile inputãéã 235 fileSelectButton.addEventListener('click', function (e) { 236 e.preventDefault(); 237 fileInput.click(); 238 }); 239 240 // ã©ãã«ãã¯ãªãã¯ãã¦ãfile inputãéã 241 label.addEventListener('click', function (e) { 242 e.preventDefault(); 243 fileInput.click(); 244 }); 245 246 // ãã¡ã¤ã«é¸æå¾ã«ãã¡ã¤ã«åã表示 + PDFããªãã¼ã·ã§ã³ + ãµã¤ãºããªãã¼ã·ã§ã³ 247 fileInput.addEventListener('change', function () { 248 if (fileInput.files.length > 0) { 249 const file = fileInput.files[0]; 250 const fileName = file.name; 251 const fileType = file.type; 252 const fileSize = file.size; 253 254 const isPDF = fileName.toLowerCase().endsWith('.pdf') || fileType === 'application/pdf'; 255 const isSizeValid = fileSize <= MAX_FILE_SIZE; 256 257 if (!isPDF) { 258 fileNameDisplay.textContent = 'ãã¡ã¤ã«ã鏿ããã¦ãã¾ãã'; 259 fileInput.value = ''; // ãã¡ã¤ã«ãªã»ãã 260 errorText.textContent = 'PDFãã¡ã¤ã«ã®ã¿ã¢ãããã¼ãã§ãã¾ãã'; 261 } else if (!isSizeValid) { 262 fileNameDisplay.textContent = 'ãã¡ã¤ã«ã鏿ããã¦ãã¾ãã'; 263 fileInput.value = ''; // ãã¡ã¤ã«ãªã»ãã 264 errorText.textContent = 'ãã¡ã¤ã«ãµã¤ãºã¯10MB以ä¸ã«ãã¦ãã ããã'; 265 } else { 266 fileNameDisplay.textContent = fileName; 267 errorText.textContent = ''; 268 } 269 } else { 270 fileNameDisplay.textContent = 'ãã¡ã¤ã«ã鏿ããã¦ãã¾ãã'; 271 errorText.textContent = ''; 272 } 273 }); 274 } 275 276 277 // 確èªç»é¢å¶å¾¡ 278 function applyConfirmVisibility() { 279 const selectedCategory = $('.dl_plg_category .aform-confirm.plg_category').text().trim(); 280 const visibleFields = fieldSets?.[selectedCategory] || null; 281 if (!fieldSets || !visibleFields) { 282 $('.js-confirm-area li[class^="confirm-"]').show(); 283 return; 284 } 285 286 $('.js-confirm-area li[class^="confirm-"]').each(function () { 287 const classList = $(this).attr('class').split(/\s+/); 288 const confirmClass = classList.find(c => c.startsWith('confirm-')); 289 if (!confirmClass) return; 290 const field = confirmClass.replace('confirm-', ''); 291 $(this).toggle(visibleFields.includes(field)); 292 }); 293 } 294 295 // ãã§ãã¯ããã¯ã¹ã®ç¶æ ã«å¿ãã¦éä¿¡ãã¿ã³ãå¶å¾¡ 296 function toggleSubmitButton() { 297 const isChecked = $('.confirm-area input[name="confirm"]').is(':checked'); 298 $('.btn-area .submit-btn').prop('disabled', !isChecked); 299 } 300 301 302 // ã«ãã´ãªå¤æ´æã«å ¥åæ¬å¶å¾¡ 303 $('.contact-apply-section select[name="category"]').on('change', applyFieldVisibility); 304 applyFieldVisibility(); 305 // ãã³ãã¬ã¼ãæ¿å ¥ã¨å å®¹åæ 306 if (currentFormId && htmlTemplates[currentFormId]) { 307 308 let html = htmlTemplates[currentFormId]; 309 310 $('[class^="dl_"]').each(function () { 311 const $dl = $(this); 312 const classAttr = $dl.attr('class') || ''; 313 const classList = classAttr.split(/\s+/); 314 const dlClass = classList.find(cls => cls.startsWith('dl_plg_')); 315 316 if (!dlClass) return; 317 const name = dlClass.replace('dl_plg_', ''); 318 const value = $dl.find('.aform-confirm.plg_' + name).html(); 319 const regex = new RegExp(`__${name}__`, 'g'); 320 html = html.replace(regex, value); 321 });
322 323 $('#js-confirm-data').append(html); 324 applyConfirmVisibility(); // æ¿å ¥å¾ã«é表示å¶å¾¡ 325 326 toggleSubmitButton(); 327 $('.confirm-area input[name="confirm"]').on('change', toggleSubmitButton); 328 // ã¿ã¤ãã«æ¸ãæãï¼c-ttl01ç¨ï¼ 329 const formHeadTitles = { 330 '#aform-1': 'ã¨ã³ããªã¼ãã©ã¼ã ', 331 '#aform-2': 'ååã»åºè<br class="sp">ã»ã¡ãã£ã¢å種<br>ãåãåãã', 332 '#aform-3': 'ä¸åç£ã»å°å£²äºæ¥ç¤¾<br>ãåãåãã', 333 }; 334 335 // ã¿ã¤ãã«ã®æ¸ãæãï¼c-breadcrumbsç¨ï¼ 336 const formBreadTitles = { 337 '#aform-1': 'ã¨ã³ããªã¼ãã©ã¼ã ', 338 '#aform-2': 'ååã»åºèã»ã¡ãã£ã¢å種ãåãåãã', 339 '#aform-3': 'ä¸åç£ã»å°å£²äºæ¥ç¤¾ãåãåãã', 340 }; 341 342 if (currentFormId) { 343 // c-ttl01ç¨ 344 $('.c-ttl01.js-title').html(formHeadTitles[currentFormId]); 345 // c-breadcrumbsç¨ 346 $('.c-breadcrumbs .js-title').html(formBreadTitles[currentFormId]); 347 } 348 } 349 350 syncConfirmValues(); 351 352 bindFileInputClick(); 353 354 $(window).on('pageshow', function () { 355 applyFieldVisibility(); 356 applyConfirmVisibility(); 357 syncConfirmValues(); 358 }); 359 360 361})(jQuery);
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.