function a(e) { e ? (0 < (i = $(window).scrollTop()) && o.addClass("is-modal-active"), $("body").addClass("is-fixed").css({ top: -i }), !0) : (o.hasClass("is-modal-active") && o.removeClass("is-modal-active"), $("body").removeClass("is-fixed").removeAttr("style"), window.scrollTo(0, i), !1) } var e, i, t, s2, n, o; $(document).ready((() => { //SNSアイコンリンク var page_url = window.location.href; $(".m-sns-icon a").each(function (i) { var tar_link_url = ""; if (i === 0) {//Twitter tar_link_url = "http://twitter.com/share?url=" + page_url; } else if (i === 1) {//Facebook tar_link_url = "https://www.facebook.com/share.php?u=" + page_url; } else if (i === 2) {//LINE tar_link_url = "https://social-plugins.line.me/lineit/share?url=" + page_url; } else if (i === 3) {//LinkedIn tar_link_url = "https://www.linkedin.com/sharing/share-offsite/?url=" + page_url; } $(this).attr("href", tar_link_url); }); //end SNSアイコンリンク //スライダーの子要素がなかったら削除 $(".js-slider ul").each(function () { var tar = $(this); if (tar.children().length === 0) { tar.closest("section.content").remove(); } }); //end スライダーの子要素がなかったら削除 e, i, t = $(window).width(), s2 = $(window).height(), n = $(window).scrollTop(), o = $(".l-header"); $(window).on("load", (function () { setTimeout((function () { o.removeClass("is-hide") } ), 500) } )), $(window).scroll((function () { n = $(window).scrollTop(), e() } )), (e = function () { var e = o.height() , i = $(".js-main-visual"); i.length > 0 && (mainVisualheight = i.outerHeight(!0), n > mainVisualheight / 10 && (o.removeClass("is-hide"), o.removeClass("is-transparent")), n < mainVisualheight / 10 && o.addClass("is-transparent")), $(".js-move").each((function () { var i = $(this).offset().top - (e + s / 3); n > i && $(this).addClass("is-move") } )) } )(); /** * @js gnav */ $('.js-gnav-parent').focus(function () { $(this).siblings('.global-nav_drawer').addClass('is-focused'); }).blur(function () { $(this).siblings('.global-nav_drawer').removeClass('is-focused'); }); $('.global-nav_drawer a').focus(function () { $(this).parents('.global-nav_drawer').addClass('is-focused'); }).blur(function () { $(this).parents('.global-nav_drawer').removeClass('is-focused'); }); let l = !1; $(".js-menu").on("click", (function () { return l ? (a(!1), $(this).removeClass("is-active"), $(this).next().removeClass("is-active"), l = !1) : (a(!0), $(this).addClass("is-active"), $(this).next().addClass("is-active"), l = !0), !1 } )); let c = !1; if ($(".js-side-anchor").on("click", (function () { return c ? ($(this).removeClass("is-active"), $(this).parent(".js-side-anchor-wrap").removeClass("is-active"), c = !1) : ($(this).addClass("is-active"), $(this).parent(".js-side-anchor-wrap").addClass("is-active"), c = !0), !1 } )), $(".js-side-anchor-wrap a").on("click", (function () { return c ? ($(".js-side-anchor").removeClass("is-active"), $(".js-side-anchor").parent(".js-side-anchor-wrap").removeClass("is-active"), c = !1) : ($(".js-side-anchor").addClass("is-active"), $(".js-side-anchor").parent(".js-side-anchor-wrap").addClass("is-active"), c = !0), !1 } )), $(".js-modal").on("click", (function () { return a(!0), modalId = $(this).data("modal"), $(modalId).addClass("is-active"), $(document).on("click", (function (e) { $(e.target).closest(".m-modal_wrapper").length || (a(!1), $(".js-modal-box").removeClass("is-active")) } )), $(".m-modal_wrapper").on("click", (function (e) { e.stopPropagation() } )), !1 } )), $(".js-modal-close").on("click", (function () { a(!1), $(".js-modal-box").removeClass("is-active") } )), $(".js-toggle").on("click", (function () { $(this).toggleClass("is-active"), $(this).next().slideToggle() } )), $(".js-toggle-close").on("click", (function () { $(this).parents().find(".js-toggle-box").slideUp(), $(this).parents().find(".js-toggle").removeClass("is-active") } )), t < 768 && $(".js-sp-toggle").on("click", (function () { $(this).toggleClass("is-active"), $(this).next().slideToggle() } )), $(".js-slider").length > 0) { let e = 7500; $(".js-horizontal-slider").each((function () { new Swiper(this, { slidesPerView: "auto", spaceBetween: 8, pagination: { el: $(this).parent().find(".swiper-pagination").get(0), clickable: !0 }, navigation: { nextEl: $(this).parent().find(".swiper-button-next").get(0), prevEl: $(this).parent().find(".swiper-button-prev").get(0) }, breakpoints: { 768: { spaceBetween: 16 } } }) } )), $(".js-horizontal-loop-slider").each((function () { new Swiper(this, { loop: !0, centeredSlides: !0, autoplay: { delay: e, disableOnInteraction: !1 }, slidesPerView: "auto", spaceBetween: 16, pagination: { el: $(this).parent().find(".swiper-pagination").get(0), clickable: !0 }, navigation: { nextEl: $(this).parent().find(".swiper-button-next").get(0), prevEl: $(this).parent().find(".swiper-button-prev").get(0) }, breakpoints: { 768: { spaceBetween: 16 } } }) } )), $(".js-center-slider").each((function () { new Swiper(this, { centeredSlides: !0, slidesPerView: 1, spaceBetween: 20, pagination: { el: $(this).parent().find(".swiper-pagination").get(0), clickable: !0 }, navigation: { nextEl: $(this).parent().find(".swiper-button-next").get(0), prevEl: $(this).parent().find(".swiper-button-prev").get(0) }, breakpoints: { 768: { slidesPerView: 3, spaceBetween: 40 } } }) } )) } // 2024/12 footerカルーセルバナー追加部分↓ if($('.js-footer-banner-slider').length > 0) { // スライダーアイテムが存在している場合スライダーを実行 new Swiper ('.js-footer-banner-slider', { // PC/SP setting loop: true, slidesPerView: 1.5, spaceBetween: 12, centeredSlides: true, pagination: { el: '.js-footer-banner-pagination', clickable: !0 }, navigation: { nextEl: '.js-footer-banner-button-next', prevEl: '.js-footer-banner-button-prev' }, breakpoints: { // PC setting 768: { slidesPerView: 5, spaceBetween: 16, // centeredSlides: false } } }); } let r = $(".js-fade-slider"); r.length > 0 && r.each((function () { fadeSliderSwiper = new Swiper(this, { loop: !0, autoplay: { delay: 3e3, disableOnInteraction: !1 }, effect: "fade", speed: 3e3, fadeEffect: { crossFade: !0 } }) } )); var p = $(".js-position-job"); if (p.length > 0) { var d = {} , h = {}; p.each((function () { var e = $(this) , i = e.attr("data-job-id"); d[i] || (d[i] = [], h[i] = []), e.find("dt label").on("click", (function () { var t = $(this).prev('input[type="checkbox"]'); d[i] = [], h[i] = [], setTimeout((function () { // Update チェックボックスの連動処理無効 // e.find("dd li input").prop("checked", !1), $(this).parent("dt").removeClass("is-selected"), // Update チェックボックスの連動処理無効 t.prop("checked") && ( /* e.find("dd li input").prop("checked", !0), */ $(this).parent("dt").addClass("is-selected"), e.find("dd li").each((function () { labelText = $(this).find("label").text(), inputVal = $(this).find("input").val(), -1 === d[i].indexOf(labelText) && (d[i].push(labelText), h[i].push(inputVal)) } ))) } ), 0) } )), e.find("dd li label").on("click", (function () { var t = $(this).prev('input[type="checkbox"]') , s = $(this).prev('input[type="checkbox"]').val() , n = $(this).text(); setTimeout((function () { if (t.prop("checked")) -1 === d[i].indexOf(n) && (d[i].push(n), h[i].push(s)); else { var o = d[i].indexOf(n); -1 !== o && (d[i].splice(o, 1), h[i].splice(o, 1)) } // Update チェックボックスの連動処理無効 d[i].length > 0 ? ( /* e.find("dt input").prop("checked", !0), */ // Update チェックボックスの連動処理無効 e.find("dt").addClass("is-selected")) : ( /* e.find("dt input").prop("checked", !1), */ e.find("dt").removeClass("is-selected")) } ), 0) } )) } )), $(".js-position-job-set").on("click", (function () { var e = Object.values(d).map((e => e.join(","))).join(",") , i = Object.values(h).map((e => e.join(" "))).join(" "); $(".js-form").attr("action"); e = e.replace(/,{2,}/g, ","), i = i.replace(/\s{2,}/g, " "), e = (e = e.replace(/^,/, "")).trim(), i = i.trim(), e.trim() ? $(".js-job-input").addClass("is-input") : $(".js-job-input").removeClass("is-input"), $(".js-job-input").text(e), a(!1), $(".js-modal-box").removeClass("is-active") } )), $(".js-position-job-reset").on("click", (function () { // Update リセット処理無効 // p.find("dt input").prop("checked", !1), // p.find("dd li input").prop("checked", !1), // Update 配列の初期化処理が間違ってるので修正 // d = [], // h = [] d && Object.keys(d).forEach((_k) => d[_k] = []); h && Object.keys(h).forEach((_k) => h[_k] = []); } )) } var u = $(".js-position-area"); if (u.length > 0) { var f = [] , v = []; u.find("dt label").on("click", (function () { var e = $(this).prev('input[type="checkbox"]') , i = $(this).prev('input[type="checkbox"]').val() , t = $(this).text(); setTimeout((function () { if (e.prop("checked")) -1 === f.indexOf(t) && (f.push(t), v.push(i)); else { var s = f.indexOf(t); -1 !== s && (f.splice(s, 1), v.splice(s, 1)) } } ), 0) } )), $(".js-position-area-set").on("click", (function () { var e = Object.values(f).join(","); Object.values(v).join(" "), $(".js-form").attr("action"); e.trim() ? $(".js-area-input").addClass("is-input") : $(".js-area-input").removeClass("is-input"), $(".js-area-input").text(e), a(!1), $(".js-modal-box").removeClass("is-active") } )), $(".js-position-area-reset").on("click", (function () { // Update リセット処理無効 // u.find("dt input").prop("checked", !1), f = [], v = [] } )) } var m = $(".js-position-location"); if (m.length > 0) { var j = [] , b = []; m.find("li label").on("click", (function () { var e = $(this).prev('input[type="checkbox"]') , i = $(this).prev('input[type="checkbox"]#locAll') , t = $(this).prev('input[type="checkbox"]').val() , s = $(this).text() , n = $(this).attr("for"); setTimeout((function () { j = [] , b = []; // Update チェックボックスの連動処理無効 // if ("locAll" === n && (i.prop("checked") ? ( /* m.find("li input:not(#locAll)").prop("checked", !0), */ // m.find('li label'/*'li label:not([for="locAll"])'*/).each((function() { // if($(this).prev("input").prop('checked')){ // s = $(this).text(), // t = $(this).prev("input").val(), // -1 === j.indexOf(s) && (j.push(s), // b.push(t)) // } // } // // Update チェックボックスの連動処理無効 // ))) : ( /* m.find("li input:not(#locAll)").prop("checked", !1), */ // m.find('li label'/*'li label:not([for="locAll"])'*/).each((function() { // // s = $(this).text(); // // var e = j.indexOf(s); // // -1 !== e && (j.splice(e, 1), // // b.splice(e, 1)) // console.log(j) // if($(this).prev("input").prop('checked')){ // s = $(this).text(), // t = $(this).prev("input").val(), // -1 === j.indexOf(s) && (j.push(s), // b.push(t)) // } // } // )))), // e.prop("checked")) // -1 === j.indexOf(s) && (j.push(s), // b.push(t)); // else { // // Update チェックボックスの連動処理無効 // // m.find("li input#locAll").prop("checked", !1); // var o = j.indexOf(s); // -1 !== o && (j.splice(o, 1), // b.splice(o, 1)) // } m.find('li label'/*'li label:not([for="locAll"])'*/).each(function () { if ($(this).prev("input").prop('checked')) { s = $(this).text(), t = $(this).prev("input").val(), -1 === j.indexOf(s) && (j.push(s), b.push(t)) } }) } ), 0) } )), $(".js-position-location-set").on("click", (function () { var e = Object.values(j).join(","); Object.values(b).join(" "); e.trim() ? $(".js-location-input").addClass("is-input") : $(".js-location-input").removeClass("is-input"), $(".js-location-input").text(e), a(!1), $(".js-modal-box").removeClass("is-active") } )), $(".js-position-location-reset").on("click", (function () { // Update リセット処理無効 // m.find("li input").prop("checked", !1), j = [], b = [] } )) } var g = $(".js-position-commitment"); if (g.length > 0) { var k = [] , w = []; g.find("li label").on("click", (function () { var e = $(this).prev('input[type="checkbox"]') , i = $(this).prev('input[type="checkbox"]').val() , t = $(this).text(); setTimeout((function () { if (e.prop("checked")) -1 === k.indexOf(t) && (k.push(t), w.push(i)); else { var s = k.indexOf(t); -1 !== s && (k.splice(s, 1), w.splice(s, 1)) } } ), 0) } )), $(".js-position-commitment-set").on("click", (function () { var e = Object.values(k).join(","); Object.values(w).join(" "); e.trim() ? $(".js-commitment-input").addClass("is-input") : $(".js-commitment-input").removeClass("is-input"), $(".js-commitment-input").text(e), a(!1), $(".js-modal-box").removeClass("is-active") } )), $(".js-position-commitment-reset").on("click", (function () { // Update リセット処理無効 // g.find("li input").prop("checked", !1), k = [], w = [] } )) } if ($(".js-position-set").on("click", (function () { /* * Update submitのaction設定処理を無効 * var e = Object.values(h).map((e=>e.join(" "))).join(" ") , i = Object.values(v).join(" ") , t = Object.values(b).join(" ") , s = Object.values(w).join(" ") , n = $(".js-form").attr("action").startsWith("/employment/mid-career/position/") ? "/employment/mid-career/position/" : "" , o = []; function a(e, i) { "" !== i && o.push(e + "/" + i) } a("job", e = (e = e.replace(/\s{2,}/g, " ")).trim()), a("area", i), a("location", t), a("commitment", s); var l = n + o.join("/").replace(/\s/g, "/"); $(".js-form").attr("action", l), console.log(l) */ } )), $(".js-pagetop").on("click", (function () { return window.scrollTo({ top: 0, left: 0, behavior: "smooth" }), !1 } )), urlHash = location.hash, urlHash) { var x = urlHash , C = $("#" == x || "" == x ? "html" : x).offset().top - o.outerHeight() - 20; $("body,html").animate({ scrollTop: C }, 300, "swing") } $('a[href*="#"]').on("click", (function () { var e = $(this).attr("href"); e = e.replace(/\./g, "").replace(/\/+[0-9a-z]+\//gi, ""); var i = $("#" == e || "" == e ? "html" : e).offset().top - o.outerHeight() - 20; return $("body,html").animate({ scrollTop: i }, 300, "swing"), !1 } )), $(".js-url-display a").each((function () { var e = $(this).attr("href"); $(this).append("
" + e) } )) //検索条件を反映 if ($('.js-position-job').length > 0) {//募集職種一覧で使用 var url_queryStr = window.location.search.slice(1);//URLクエリ var url_queries = {};//URLクエリ_オブジェクト var match = location.href.match(/job-([0-9]+)/) if (match) { url_queries['job'] = match[1] } var match = location.href.match(/jobs-([0-9]+)/) if (match) { url_queries['jobs'] = match[1] } var match = location.href.match(/div-([0-9]+)/) if (match) { url_queries['div'] = match[1] } var match = location.href.match(/loc-([0-9]+)/) if (match) { url_queries['loc'] = match[1] } var match = location.href.match(/con-([0-9]+)/) if (match) { url_queries['con'] = match[1] } if (url_queryStr || Object.keys(url_queries)) { $(".m-modal input").prop("checked", false);//チェックを全て外す url_queryStr.split('&').forEach(function (url_queryStr) { var queryArr = url_queryStr.split('='); url_queries[queryArr[0]] = queryArr[1]; }); var is_checked_query = false;//URLクエリからチェックをしたか $.each(url_queries, function (key, values) { var tar_modal; if (key === "jobs" || key === "job") { tar_modal = $("#JOB"); } else if (key === "div") { tar_modal = $("#AREA"); } else if (key === "loc") { tar_modal = $("#LOCATION"); } else if (key === "con") { tar_modal = $("#COMMITMENT"); } var val_ary = decodeURIComponent(values).split(","); if (tar_modal && values) { $.each(val_ary, function (valkey, value) { var tar = tar_modal.find('input[value="' + value + '"]'); if (tar.length > 0) { is_checked_query = true; $('label[for="' + tar.attr("id") + '"]').click(); if (key === "job") {//親職種の時 tar.closest("dt").siblings("dd").find("input").each(function () { $('label[for="' + $(this).attr("id") + '"]').click(); }); } } }); } }); if (is_checked_query) { setTimeout(function () { $(".js-position-job-set").click(); $(".js-position-area-set").click(); $(".js-position-location-set").click(); $(".js-position-commitment-set").click(); }, 100); } } } //end 検索条件を反映 } )); /* ------------------------------ */ /* * Add 絞り込み検索処理 */ (function () { // ベースになるパス var BasePath = '/employment/mid-career/position/'; // ID var IdJob = 'JOB'; var IdArea = 'AREA'; var IdLocation = 'LOCATION'; var IdCommitment = 'COMMITMENT'; // セレクター var SelectorForm = 'form.js-form'; var SelectorResetButton = '.m-modal_footer button.m-modal_reset-btn'; // 絞り込んだ項目を保存させるためのURLSearchParams var BufferParams = new URLSearchParams(); // initialize $(document).ready(__init); /* * 初期化 */ function __init() { __jobSetting(); __areaSetting(); __locationSetting(); __commitmentSetting(); __addSubmit(); } /* * 職種の絞り込み処理 */ function __jobSetting() { // パラメータの初期化 $(".js-position-set.js-modal-close").on("click", (function () { setParamsJob(); getCount(); })); var wrap = document.getElementById(IdJob); if (!wrap) { return; } var parentAll = $(wrap).find('dt input[type="checkbox"]'); if (parentAll.length < 1) { return; } var parentName = parentAll.get(0).name; if (!parentName) { return; } // セレクター var containerSelector = '.js-position-job'; var parentSelector = 'dt input[type="checkbox"]'; var childSelector = 'dd input[type="checkbox"]'; // パラメータの初期化 setParamsJob(); getCount(); // イベントの追加 $(wrap).find(containerSelector).each(function () { // チェックボックスの取得 var parent = $(this).find(parentSelector); var child = $(this).find(childSelector); if (parent.length < 1 || child.length < 1) { return; } parent.on('click', function () { // 小項目の name を取得 var childName = child.get(0).name; if (!childName) { setParamsJob(); getCount(); return; } // パラメータのリセット BufferParams.delete("jobs"); BufferParams.delete("job"); // 小項目の再チェック child.prop('checked', this.checked); // パラメータをセット setParamsJob(); getCount(); }); child.on('click', function () { // 小項目の name を取得 var childName = child.get(0).name; if (!childName) { setParamsJob(); getCount(); return; } // パラメータのリセット BufferParams.delete(parentName); BufferParams.delete(childName); // 小項目が全て選択されているか var isAllChecked = child.filter(':checked').length === child.length; // 大項目の再チェック parent.prop('checked', isAllChecked); // パラメータをセット setParamsJob(); getCount(); }); }); // リセット $(wrap).find(SelectorResetButton).on('click', function () { // チェックボックスの取得 var parent = $(wrap).find(parentSelector); var child = $(wrap).find(childSelector); if (parent.length < 1 || child.length < 1) { return; } // 小項目の name を取得 var childName = child.get(0).name; if (!childName) { return; } // パラメータのリセット BufferParams.delete(parentName); BufferParams.delete(childName); // チェック解除 parent.prop('checked', false); child.prop('checked', false); }); //チェックボックスむりやり付与 var t = $(window).width() if (t < 768) { setTimeout(function () { jQuery('.js-position-job').each(function () { var $this = $(this) var $input = $this.find("dt .m-checkbox input") var $label = $this.find("dt .m-checkbox label") var $dd_ul = $this.find('dd ul') var $li = $('
  • ') $li.find('input').prop('checked', $input.prop('checked')) $dd_ul.find('li input:not([name=dummy])').on("change",function () { var isAllChecked = $dd_ul.find('li input:not([name=dummy])').length === $dd_ul.find('li input:not([name=dummy]):checked').length; var noChecked = $dd_ul.find('li input:not([name=dummy]):checked').length === 0; $li.find('input').prop('checked', isAllChecked) $input.prop('checked', isAllChecked) if(noChecked){ setTimeout(function () { $this.find('dt').removeClass('is-selected') }) } }); $dd_ul.prepend($li) $li.find('input').each(function () { // var checked = $(this).prop('checked') // $input.prop('checked', checked) // $dd_ul.find('input').prop('checked', checked) // BufferParams.delete($input.attr('id')); // setTimeout(function () { // reloadCheck(); // setParamsJob() // getCount() // }) $(this).on("click", function () { var checked = $(this).prop('checked') setTimeout(function () { if (checked) { $this.find('dt').addClass('is-selected') } else { $this.find('dt').removeClass('is-selected') } }) $input.prop('checked', checked) $dd_ul.find('input').prop('checked', checked) BufferParams.delete("job"); BufferParams.delete("jobs"); setTimeout(function () { reloadCheck(); setTimeout(function () { setParamsJob() getCount() }); }) }) function reloadCheck() { var p = $(".js-position-job"); if (p.length > 0) { var d = {} , h = {}; p.each((function () { var e = $(this) , i = e.attr("data-job-id"); d[i] || (d[i] = [], h[i] = []), e.find("dt label").each((function () { var t = $(this).prev('input[type="checkbox"]'); d[i] = [], h[i] = [], setTimeout((function () { // Update チェックボックスの連動処理無効 // e.find("dd li input").prop("checked", !1), $(this).parent("dt").removeClass("is-selected"), // Update チェックボックスの連動処理無効 t.prop("checked") && ( /* e.find("dd li input").prop("checked", !0), */ $(this).parent("dt").addClass("is-selected"), e.find("dd li").each((function () { labelText = $(this).find("label").text(), inputVal = $(this).find("input").val(), -1 === d[i].indexOf(labelText) && (d[i].push(labelText), h[i].push(inputVal)) } ))) } ), 0) } )), e.find("dd li label").on("click", (function () { var t = $(this).prev('input[type="checkbox"]') , s = $(this).prev('input[type="checkbox"]').val() , n = $(this).text(); setTimeout((function () { if (t.prop("checked")) -1 === d[i].indexOf(n) && (d[i].push(n), h[i].push(s)); else { var o = d[i].indexOf(n); -1 !== o && (d[i].splice(o, 1), h[i].splice(o, 1)) } // Update チェックボックスの連動処理無効 d[i].length > 0 ? ( /* e.find("dt input").prop("checked", !0), */ // Update チェックボックスの連動処理無効 e.find("dt").addClass("is-selected")) : ( /* e.find("dt input").prop("checked", !1), */ e.find("dt").removeClass("is-selected")) } ), 0) } )) } )), $(".js-position-job-set").on("click", (function () { var e = Object.values(d).map((e => e.join(","))).join(",") , i = Object.values(h).map((e => e.join(" "))).join(" "); $(".js-form").attr("action"); e = e.replace(/,{2,}/g, ","), i = i.replace(/\s{2,}/g, " "), e = (e = e.replace(/^,/, "")).trim(), i = i.trim(), e.trim() ? $(".js-job-input").addClass("is-input") : $(".js-job-input").removeClass("is-input"), $(".js-job-input").text(e), a(!1), $(".js-modal-box").removeClass("is-active") } )), $(".js-position-job-reset").on("click", (function () { // Update リセット処理無効 // p.find("dt input").prop("checked", !1), // p.find("dd li input").prop("checked", !1), // Update 配列の初期化処理が間違ってるので修正 // d = [], // h = [] d && Object.keys(d).forEach((_k) => d[_k] = []); h && Object.keys(h).forEach((_k) => h[_k] = []); } )) } } }) }) }); } /* * パラメータのセット * 小項目が全てチェックされていたら大項目のパラメータのみ * 小項目が全てチェックされていなければ小項目のパラメータのみ */ function setParamsJob() { $(wrap).find(containerSelector).each(function () { // チェックボックスの取得 var parent = $(this).find(parentSelector); var child = $(this).find(childSelector); if (parent.length < 1 || child.length < 1) { return; } // チェック済みの項目をセット if (child.filter(':checked').length === child.length) { parent.filter(':checked').each(function () { BufferParams.append(this.name, this.value); }); } else { child.filter(':checked').each(function () { BufferParams.append(this.name, this.value); }); } }) } } /* * 事業領域の絞り込み処理 */ function __areaSetting() { var wrap = document.getElementById(IdArea); if (!wrap) { return; } var parent = $(wrap).find('input[type="checkbox"]'); var reset = $(wrap).find(SelectorResetButton); if (parent.length < 1 || reset.length < 1) { return; } // パラメータの初期化 parent.filter(':checked').each(function () { BufferParams.append(this.name, this.value); }); // イベントの追加 parent.on('click', function () { // パラメータのリセット BufferParams.delete(this.name); // パラメータをセット parent.filter(':checked').each(function () { BufferParams.append(this.name, this.value); }); }); // リセット reset.on('click', function () { // 項目の name を取得 var parentName = parent.get(0).name; if (!parentName) { return; } // パラメータのリセット BufferParams.delete(parentName); // チェック解除 parent.prop('checked', false); }) } /* * 勤務地の絞り込み処理 */ function __locationSetting() { $(".js-location-set.js-modal-close").on("click", (function () { setParams(); getCount(); })); var wrap = document.getElementById(IdLocation); if (!wrap) { return; } var parent = $(wrap).find('input[type="checkbox"][value="000"]'); var child = $(wrap).find('input[type="checkbox"]').not('[value="000"]'); var reset = $(wrap).find(SelectorResetButton); if (parent.length < 1 || child.length < 1 || reset.length < 1) { return; } // パラメータの初期化 setParams(); parent.on('click', function () { // パラメータのリセット BufferParams.delete(this.name); // 小項目の再チェック //child.prop('checked', this.checked); // パラメータをセット setParams(); getCount(); }); child.on('click', function () { // パラメータのリセット BufferParams.delete(this.name); // 小項目が全て選択されているか var isAllChecked = child.filter(':checked').length === child.length; // 大項目の再チェック //parent.prop('checked', isAllChecked); // パラメータをセット setParams(); getCount(); }); // リセット reset.on('click', function () { // 項目の name を取得 var parentName = parent.get(0).name; if (!parentName) { return; } // パラメータのリセット BufferParams.delete(parentName); // チェック解除 parent.prop('checked', false); child.prop('checked', false); }) /* * パラメータのセット * 小項目が全てチェックされていたら大項目のパラメータのみ * 小項目が全てチェックされていなければ小項目のパラメータのみ */ function setParams() { parent.filter(':checked').each(function () { BufferParams.append(this.name, this.value); }); child.filter(':checked').each(function () { BufferParams.append(this.name, this.value); }); // // パラメータの初期化 // if (child.filter(':checked').length === child.length) { // parent.filter(':checked').each(function() { // BufferParams.append(this.name, this.value); // }); // } else { // child.filter(':checked').each(function() { // BufferParams.append(this.name, this.value); // }); // } } } /* * こだわり条件の絞り込み処理 */ function __commitmentSetting() { var wrap = document.getElementById(IdCommitment); if (!wrap) { return; } var parent = $(wrap).find('input[type="checkbox"]'); var reset = $(wrap).find(SelectorResetButton); if (parent.length < 1 || reset.length < 1) { return; } // パラメータの初期化 parent.filter(':checked').each(function () { BufferParams.append(this.name, this.value); }); // イベントの追加 parent.on('click', function () { // パラメータのリセット BufferParams.delete(this.name); // パラメータをセット parent.filter(':checked').each(function () { BufferParams.append(this.name, this.value); }); }); // リセット reset.on('click', function () { // 項目の name を取得 var parentName = parent.get(0).name; if (!parentName) { return; } // パラメータのリセット BufferParams.delete(parentName); // チェック解除 parent.prop('checked', false); }) } /** * 件数カウント */ function getCount() { var params = {}; var keys = []; // パラメータを正しい情報に変換 for (var key of [...new Set(BufferParams.keys())]) { if (key === "dummy") { continue; } if (key === undefined) { continue; } if (keys.indexOf(key) < 0) { keys.push(key); params[key] = [...new Set(BufferParams.getAll(key))].join(','); } } var path = ''; var query = ''; // パラメータが1つの場合は `/${name}-${value}/` のパスに変換 if (keys.length === 1 && params[keys[0]] && params[keys[0]].indexOf(',') < 0) { path = keys[0] + '-' + params[keys[0]]; } else { query = new URLSearchParams(params); query = query.toString(); } // ページ遷移 var APIPATH = ''; if (path) { APIPATH = BasePath + "api/job/count/" + path + '/'; } else if (query) { APIPATH = BasePath + "api/job/count/" + '?' + query; } else { APIPATH = BasePath + "api/job/count/" } $.ajax({ url: APIPATH, success: function (result) { if (result.data.count) { $("form.js-form button").text(result.data.count + "件を絞り込む"); $("form.js-form button").css("pointer-events", "") } else { $("form.js-form button").text("該当する募集はありません"); //pointer-events: none; $("form.js-form button").css("pointer-events", "none"); } } }); } /* * submitしたときのイベント */ function __addSubmit() { $(SelectorForm).on('submit', handler); function handler() { var params = {}; var keys = []; // パラメータを正しい情報に変換 for (var key of [...new Set(BufferParams.keys())]) { if (key === "dummy") { continue; } if (keys.indexOf(key) < 0) { keys.push(key); params[key] = [...new Set(BufferParams.getAll(key))].join(','); } } var path = ''; var query = ''; // パラメータが1つの場合は `/${name}-${value}/` のパスに変換 if (keys.length === 1 && params[keys[0]] && params[keys[0]].indexOf(',') < 0) { path = keys[0] + '-' + params[keys[0]]; } else { query = new URLSearchParams(params); query = query.toString(); } // ページ遷移 if (path) { location.href = BasePath + path + '/'; } else if (query) { location.href = BasePath + '?' + query; } else { location.href = BasePath; } // フォームのactionを無効化 return false; } } })();