/** Shopify CDN: Minification failed Line 17:2 Transforming let to the configured target environment ("es5") is not supported yet Line 28:2 Transforming let to the configured target environment ("es5") is not supported yet Line 29:2 Transforming let to the configured target environment ("es5") is not supported yet Line 41:4 Transforming let to the configured target environment ("es5") is not supported yet Line 42:4 Transforming let to the configured target environment ("es5") is not supported yet Line 56:4 Transforming let to the configured target environment ("es5") is not supported yet Line 57:4 Transforming let to the configured target environment ("es5") is not supported yet Line 123:4 Transforming let to the configured target environment ("es5") is not supported yet Line 124:4 Transforming let to the configured target environment ("es5") is not supported yet Line 227:2 Transforming let to the configured target environment ("es5") is not supported yet ... and 5 more hidden warnings **/ $(function () { let lang = $('html').attr('lang'); $('.js-language').text(lang.toUpperCase()); $('.footer .footer__blocks-wrapper > div:nth-child(2) li:nth-child(5) a').addClass('js-contact-open'); $('.modal-template .modal-main-text a[title="contact"]').addClass('js-contact-link-open'); $('.modal-main-text p:has(strong)').addClass('subtitle-margin'); $('.footer .footer__blocks-wrapper > div:nth-child(1) a').addClass('js-modal-open'); if (lang !== 'ja') { $('.footer .footer__blocks-wrapper > div:nth-child(2) li:nth-child(3)').hide(); } let link = new URL(window.location.href); let params = link.searchParams; // footerモーダル表示 if (params.get('id')) { // 本文固定 scrollPosition = $(window).scrollTop(); $('body').addClass('fixed').css({'top': -scrollPosition}); // footerモーダル表示 $('.js-modal').show(); // 対象のコンテンツ表示 let id = '#' + params.get('id'); let idPosition = $(id).position(); $(".js-modal-content").animate({scrollTop:idPosition.top}, 300); } // contactモーダル表示 if (params.get('contact')) { // 本文固定 scrollPosition = $(window).scrollTop(); $('body').addClass('fixed').css({'top': -scrollPosition}); $('.contact-modal').show(); } // PCナビ押下 $('.js-pc-nav').on('click',function () { let id = $(this).attr('href'); let idPosition = $(id).position(); $('html').animate({scrollTop:idPosition.top}, 300); return false; }); // ナビモーダルリンク押下 $('.js-nav-open').on('click',function () { // 本文固定 scrollPosition = $(window).scrollTop(); $('body').addClass('fixed').css({'top': -scrollPosition}); // モーダル表示 $('.pc-nav-block').addClass('sp-nav-show'); return false; }); // top言語ボックスをマウスオーバーする $('.top-language-box').hover(function () { // モーダル表示 $('.top-select-language').toggle(); }); // story言語ボックスをマウスオーバーする $('.story-language-box').hover(function () { // モーダル表示 $('.story-select-language').toggle(); }); // sp言語ボックスをクリックする $('.language-box').on('click', function () { // モーダル表示 $('.select-language').toggle(); }); // 事前申込モーダルリンク押下 $('.js-application-open').on('click',function () { // 本文固定 scrollPosition = $(window).scrollTop(); $('body').addClass('fixed').css({'top': -scrollPosition}); // モーダル表示 $('.application-modal').fadeIn(); return false; }); // tastingモーダルリンク押下 $('.js-tasting-open').on('click',function () { // 本文固定 scrollPosition = $(window).scrollTop(); $('body').addClass('fixed').css({'top': -scrollPosition}); // モーダル表示 $('.tasting-modal').fadeIn(); return false; }); // footerリンク押下 $('.js-modal-open').on('click',function () { // 本文固定 scrollPosition = $(window).scrollTop(); $('body').addClass('fixed').css({'top': -scrollPosition}); // footerモーダル表示 $('.js-modal').show(); // 対象のコンテンツ表示 let id = $(this).attr('href'); let idPosition = $(id).position(); $(".js-modal-content").animate({scrollTop:idPosition.top}, 300); return false; }); // footer contactリンク押下 $('.js-contact-open').on('click',function () { // 本文固定 scrollPosition = $(window).scrollTop(); $('body').addClass('fixed').css({'top': -scrollPosition}); // モーダル表示 $('.contact-modal').fadeIn(); return false; }); // footer contactリンク押下 $('.js-privacypolicy-open').on('click',function () { // 本文固定 scrollPosition = $(window).scrollTop(); $('body').addClass('fixed').css({'top': -scrollPosition}); // モーダル表示 $('.privacypolicy-modal').fadeIn(); return false; }); // モーダル中のcontactリンク押下 $('.js-contact-link-open').on('click',function () { // contactモーダル表示 $(".js-modal-content").scrollTop(0); $('.js-modal').fadeOut(); $('.contact-modal').fadeIn(); return false; }); // ナビモーダル閉じる $('.js-nav-close').on('click',function () { // モーダル非表示 $('.pc-nav-block').removeClass('sp-nav-show'); // 本文固定解除 $('body').removeClass('fixed'); window.scrollTo(0 , scrollPosition); }); // 事前申込モーダル閉じる $('.js-application-close').on('click',function () { // モーダル非表示 $('.application-modal').hide(); $('.application-modal .modal-template').show(); $('.application-modal .complate-modal').hide(); $('.application-modal .close-btn').removeClass('application-modal-close'); // 入力データ初期化 $('.application-modal .entry-table input[type=text]').val(''); $('.application-modal .entry-table input[type=checkbox]').prop('checked', false); $('.application-modal .entry-table dd span').hide(); $('.application-modal .modal-post-error').hide(); // 本文固定解除 $('body').removeClass('fixed'); window.scrollTo(0 , scrollPosition); return false; }); // tastingモーダル閉じる $('.js-tasting-close').on('click',function () { // モーダル非表示 $('.tasting-modal').fadeOut(); // 本文固定解除 $('body').removeClass('fixed'); window.scrollTo(0 , scrollPosition); return false; }); // モーダル閉じる $('.js-modal-close').on('click',function () { // footerモーダル非表示 $(".js-modal-content").scrollTop(0); $('.js-modal').hide(); // 本文固定解除 $('body').removeClass('fixed').css({'top': 0}); window.scrollTo(0 , scrollPosition); return false; }); // お問い合わせモーダル閉じる $('.js-contact-close').on('click',function () { // モーダル非表示 $('.contact-modal').hide(); $('.contact-modal .modal-template').show(); $('.contact-modal .complate-modal').hide(); $('.contact-modal .close-btn').removeClass('contact-modal-close'); // 入力データ初期化 $('.contact-modal .entry-table input[type=text]').val(''); $('.contact-modal .entry-table input[type=checkbox]').prop('checked', false); $('.contact-modal .entry-table textarea').val(''); $('.contact-modal .entry-table dd span').hide(); $('.contact-modal .modal-post-error').hide(); // 本文固定解除 $('body').removeClass('fixed'); window.scrollTo(0 , scrollPosition); return false; }); }); // 事前申込の入力内容をチェックする function checkApplicationInput() { let result = true; let mail = $('.application-entry .application-form-email > input').val(); // 名前入力確認 if ($('.application-entry .application-form-name > input').val() == '') { $('.application-entry .application-form-name + span').show(); result = false; } // メール入力確認 if (mail == '') { $('.application-entry .error-required').show(); result = false; } // メール形式確認 if (mail != '' && mail.match(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/) == null) { $('.application-entry .error-format').show(); result = false; } // 年齢確認チェック確認 if (!$('.application-entry #application-age').prop("checked")) { $('.application-entry .application-form-age + span').show(); result = false; } // 利用規約同意チェック確認 if (!$('.application-entry #application-privacy').prop("checked")) { $('.application-entry .application-form-privacy + span').show(); result = false; } return result; } // お問い合わせの入力内容をチェックする function checkContactInput() { let result = true; let mail = $('.contact-entry .contact-form-email > input').val(); // メール入力確認 if (mail == '') { $('.contact-entry .error-required').show(); result = false; } // メール形式確認 if (mail != '' && mail.match(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/) == null) { $('.contact-entry .error-format').show(); result = false; } // 名前入力確認 if ($('.contact-entry .contact-form-name > input').val() == '') { $('.contact-entry .contact-form-name + span').show(); result = false; } // 国名入力確認 if ($('.contact-entry .contact-form-country > input').val() == '') { $('.contact-entry .contact-form-country + span').show(); result = false; } // 件名入力確認 if ($('.contact-entry .contact-form-subject > input').val() == '') { $('.contact-entry .contact-form-subject + span').show(); result = false; } // 内容入力確認 if ($('.contact-entry .contact-form-body > textarea').val() == '') { $('.contact-entry .contact-form-body + span').show(); result = false; } // 利用規約同意チェック確認 if (!$('.contact-entry #contact-privacy').prop("checked")) { $('.contact-entry .contact-form-privacy + span').show(); result = false; } return result; } $(document).ready(function () { // エラーメッセージを消す関数 function clearErrors() { $('.error-required, .error-format, .application-form-name + span, .application-form-age + span, .application-form-privacy + span, .contact-form-name + span, .contact-form-country + span, .contact-form-subject + span, .contact-form-body + span, .contact-form-privacy + span').hide(); } // エラーメッセージを消すイベントリスナ $('input, textarea').on('input', function () { clearErrors(); }); // チェックボックスのエラーメッセージを消すイベントリスナ $('input[type=checkbox]').on('change', function () { clearErrors(); }); $('#preorder-submit-btn').on('click', function (e) { // 入力内容のチェックを行う const isApplicationValid = checkApplicationInput(); // どちらかのフォームにエラーがある場合 if (!isApplicationValid) { e.preventDefault(); } }); $('#contact-submit-btn').on('click', function (e) { // 入力内容のチェックを行う const isContactValid = checkContactInput(); // どちらかのフォームにエラーがある場合 if (!isContactValid) { e.preventDefault(); } }); }); $(document).ready(function () { function handleRedirection() { var formType = getFormTypeFromStorage(); removeFormTypeFromStorage(); var langCode = obtainLanguageCode(); var targetUrl; switch (formType) { case 'preorder': if (!langCode) { targetUrl = 'https://kurokohaku.com//pages/preorder-posted'; } else { switch (langCode) { case 'en': targetUrl = 'https://kurokohaku.com/en/pages/preorder-posted'; break; case 'fr': targetUrl = 'https://kurokohaku.com/fr/pages/preorder-posted'; break; case 'zh-cn': targetUrl = 'https://kurokohaku.com/zh-cn/pages/preorder-posted'; break; case 'zh-tw': targetUrl = 'https://kurokohaku.com/zh-tw/pages/preorder-posted'; break; default: console.error('Unsupported language code:', langCode); return; } } break; case 'contact': if (!langCode) { targetUrl = 'https://kurokohaku.com//pages/contact-posted'; } else { switch (langCode) { case 'en': targetUrl = 'https://kurokohaku.com/en/pages/contact-posted'; break; case 'fr': targetUrl = 'https://kurokohaku.com/fr/pages/contact-posted'; break; case 'zh-cn': targetUrl = 'https://kurokohaku.com/zh-cn/pages/contact-posted'; break; case 'zh-tw': targetUrl = 'https://kurokohaku.com/zh-tw/pages/contact-posted'; break; default: console.error('Unsupported language code:', langCode); return; } } break; default: console.error('Unsupported form type:', formType); return; } var a = document.createElement('a'); a.href = targetUrl; a.target = '_blank'; a.rel = 'noopener noreferrer'; a.click(); } function fetchQueryParameter(paramName) { var queryString = window.location.search.substring(1); var parameters = queryString.split('&'); for (var i = 0; i < parameters.length; i++) { var pair = parameters[i].split('='); if (pair[0] == paramName) { return pair[1]; } } return false; } function obtainLanguageCode() { var urlPath = window.location.pathname.split('/'); return urlPath[1]; } function getFormTypeFromStorage() { return localStorage.getItem('form_type'); } function setFormTypeToStorage(formType) { localStorage.setItem('form_type', formType); } function removeFormTypeFromStorage() { localStorage.removeItem('form_type'); } if (fetchQueryParameter('form_posted') === 'true' || fetchQueryParameter('contact_posted') === 'true') { handleRedirection(); } $('form[data-form-type]').on('submit', function (event) { var formType = $(this).data('form-type'); setFormTypeToStorage(formType); }); });