PageSourceSearch

https://ano-kono.ehime.jp/design/assets/common/js/common.js?v=salary-filter-5

js ano-kono.ehime.jp collected 2026-10-05 21:41:27 UTC 21,428 bytes, 684 lines download raw bytes

1/**
2 * common.js
3 *
4 */
5
6
7/* ----------------------------------------------------------
8 init
9---------------------------------------------------------- */
10$(function(){
11  "use strict";
12  // スムーススクロール
13  chkScreenSize();
14
15  pageScroll();
16
17  checkTel();
18
19  heroFull();
20
21  //js_clearChecked();
22
23  js_nav_accordion();
24
25  js_list_accordion();
26
27  js_btn_nav();
28
29  footerFix();
30
31  js_footerPopup();
32
33  posArticleNew();
34
35  clearInput();
36
37  navBread();
38
39  btnSelect();
40
41  js_placeholer();
42
43  uploadFile();
44
45  exlinkDialog();
46
47  openAnotherWindow();
48
49  addTitleAttributeToInputTag();
50});
51
52$(window).on("load", function(){
53  "use strict";
54  chkScreenSize();
55
56  slideJobs();
57
58  js_detailSlider();
59
60  heroFull();
61
62  heroTopOffset();
63
64  footerFix();
65});
66
67$(window).on("resize", function(){
68  "use strict";
69
70  chkScreenSize();
71
72  heroFull();
73
74  heroTopOffset();
75
76  posArticleNew();
77
78  js_footerPopup();
79});
80/* ----------------------------------------------------------
81 pageScroll
82---------------------------------------------------------- */
83var pageScroll = function(){
84  $('.js-scroll').click(function() {
85    var speed = 400; // スクロールスピード
86    var href= $(this).attr("href");
87    var target = $(href == "#" || href == "" ? 'html' : href);
88    var position = target.offset().top;
89    if(href == '#'){
90      // リンク#のときはページの先頭へ
91      $('body,html').animate({scrollTop:0}, speed, 'swing');
92    } else {
93      // それ以外は指定idへ
94      $('body,html').animate({scrollTop:position}, speed, 'swing');
95    }
96    return false;
97  });
98}
99
100/* ----------------------------------------------------------
101 Check screen size
102---------------------------------------------------------- */
103var $MQ = "PC";
104var oldMQ = $MQ;
105function chkScreenSize() {
106  var mWidth = $("body").css("min-width");
107  switch(mWidth) {
108    case "1px":
109      $MQ = "SP";
110      break;
111    default:
112      $MQ = "PC";
113  }
114   // trigger custom event when breakpoint change
115  if (oldMQ !== $MQ) {
116    oldMQ = $MQ;
117    $(window).trigger("breakpointChange");
118  }
119}
120
121/* ----------------------------------------------------------
122 clear input
123---------------------------------------------------------- */
124var clearInput = function(){
125  $('.box-input').on("keyup touched click",function(){
126    var formSearchInput = $(this).find('input');
127    var btnClear = $(this).find('.btn-clear');
128    btnClear.fadeIn(200);
129    btnClear.on("click",function(){
130      formSearchInput.val('');
131      btnClear.fadeOut(200);
132    });
133    formSearchInput.on("blur",function() {
134      if (formSearchInput.val() == '') {
135        btnClear.fadeOut(200);
136      }
137    });
138    btnClear.on("blur",function() {
139      if (formSearchInput.val() == '') {
140        btnClear.fadeOut(200);
141      }
142    });
143  });
144};
145
146/* ----------------------------------------------------------
147 nav breadcrumb
148---------------------------------------------------------- */
149var navBread = function() {
150  if($MQ == "SP") {
151    $('.nav-breadcrumb').each(function(){
152    var i = 0;
153      $(this).find('li').each(function(){
154        $(this).css({
155          'padding-left': i + 'px'
156        });
157        i = i + 12;
158      });
159      $('.nav-breadcrumb li.last').removeAttr('style');
160    });
161  }
162  $(window).on("breakpointChange",function(){
163    $('.nav-breadcrumb li').removeAttr('style');
164  });
165};
166/* ----------------------------------------------------------
167 js_clearChecked
168---------------------------------------------------------- */
169//var js_clearChecked = function() {
170//  var btn_clear = $('.btn-clear-selected');
171//  btn_clear.on('click',function(){
172//    if($('.list-select .btn-filter').hasClass('is-checked')) {
173//      $('.list-select .btn-filter').removeClass('is-checked');
174//    }
175//  });
176//}
177/* ----------------------------------------------------------
178 screen lock
179---------------------------------------------------------- */
180var lockTop = 0;
181var screenLock = function () {
182  lockTop = $(window).scrollTop();
183  $("html").addClass("is-screen-locked").css({ top: -lockTop });
184};
185
186/* ----------------------------------------------------------
187 screen unlock
188---------------------------------------------------------- */
189var screenUnlock = function () {
190  $("html").removeClass("is-screen-locked").removeAttr("style");
191  $(window).scrollTop(lockTop);
192};
193/* ----------------------------------------------------------
194 js-btn-nav
195---------------------------------------------------------- */
196var js_btn_nav = function() {
197  var btnNav = $('.js-btn-nav');
198  var btnClose = $('.btn-close');
199  var navG = $('.nav-global-wrap');
200  btnNav.on("click", function(){
201    if(!navG.hasClass('is-open')) {
202      let controls = $(this).attr('aria-controls');
203      $(this).attr('aria-expanded', true);
204      $('#' + controls).attr('aria-hidden', false);
205      $(this).next(navG).addClass('is-open').fadeIn();
206        js_nav_accordion_division();
207      if($MQ == "SP") {
208        screenLock();
209      }
210    }
211    if($MQ == "SP") {
212      if($('.contents').find('.is-overlay').length == 0) {
213        $('.contents').prepend('<div class="is-overlay"></div>');
214      }
215    }
216    $(window).on("breakpointChange",function(){
217      screenUnlock();
218      navG.removeClass('is-open').fadeOut();
219      $('.is-overlay').remove();
220    });
221  });
222  btnClose.on("click", function(){
223    if(navG.hasClass('is-open')){
224      btnNav.attr('aria-expanded', false);
225      $('.nav-global-wrap').attr('aria-hidden', true);
226      navG.removeClass('is-open').fadeOut();
227      if($MQ == "SP") {
228        screenUnlock();
229      }
230    }
231    $('.is-overlay').remove();
232  });
233};
234/* ----------------------------------------------------------
235 js-nav-accordion-division
236 ---------------------------------------------------------- */
237var js_nav_accordion_division = function () {
238    var current_division = $('.hero-top-title-wrap .top-title span.text').text();
239    var result;
240
241    $('.list-nav-map.map-01 li').each(function () {
242        if($(this).find('a').text() == current_division) {
243            $('.js-nav-accordion.map-01 ').trigger("click");
244            result=true;
245            return false;
246        }
247    });
248
249    if (result) return;
250
251    $('.list-nav-map.map-02 li').each(function () {
252        if($(this).find('a').text() == current_division) {
253            $('.js-nav-accordion.map-02 ').trigger("click");
254            result=true;
255            return false;
256        }
257    });
258
259    if (result) return;
260
261    $('.list-nav-map.map-03 li').each(function () {
262        if($(this).find('a').text() == current_division) {
263            $('.js-nav-accordion.map-03 ').trigger("click");
264            return false;
265        }
266    });
267};
268/* ----------------------------------------------------------
269 js-nav-accordion
270---------------------------------------------------------- */
271var js_nav_accordion = function() {
272  var $ttlNav = $('.js-nav-accordion');
273  var $listNav = $('.list-nav-map');
274  $ttlNav.each(function () {
275    if ($(this).hasClass('is-open')) {
276      $(this).next($listNav).stop().slideDown();
277      let controls = $(this).attr('aria-controls');
278      $(this).attr('aria-expanded', true);
279      $('#' + controls).attr('aria-hidden', false);
280    }
281  });
282  $ttlNav.on('click',function(){
283    if(!$(this).hasClass('is-open')) {
284      $(this).addClass('is-open');
285      $(this).next($listNav).stop().slideDown();
286      let controls = $(this).attr('aria-controls');
287      $(this).attr('aria-expanded', true);
288      $('#' + controls).attr('aria-hidden', false);
289    } else {
290      $(this).removeClass('is-open');
291      $(this).next($listNav).stop().slideUp();
292      let controls = $(this).attr('aria-controls');
293      $(this).attr('aria-expanded', false);
294      $('#' + controls).attr('aria-hidden', true);
295    }
296  });
297};
298/* ----------------------------------------------------------
299 js-list-accordion
300---------------------------------------------------------- */
301var js_list_accordion = function() {
302  var ttlAccordion = $('.js-toggle-accordion');
303  var btnAccordion = ttlAccordion.find('.btn-in');
304  var listAccordion = $('.js_list_accordion');
305    $(document).on('click' ,'.btn-in' ,function(){
306      if(!$(this).hasClass('is-close')) {
307        $(this).addClass('is-close');
308        $(this).parents('.js-toggle-accordion').addClass('is-close');
309        if($MQ == "SP") {
310          $(this).parents('.js-toggle-accordion').css('margin-bottom','36px');
311        }
312        $(this).parents('.js-toggle-accordion').next('.js_list_accordion').stop().slideUp();
313      } else {
314        $(this).removeClass('is-close');
315        $(this).parents('.js-toggle-accordion').removeClass('is-close');
316        if($MQ == "SP") {
317          $(this).parents('.js-toggle-accordion').removeAttr('style');
318        }
319        $(this).parents('.js-toggle-accordion').next('.js_list_accordion').stop().slideDown();
320      }
321    });
322};
323/* ----------------------------------------------------------
324 Jobsslider
325---------------------------------------------------------- */
326var slideJobs = function(){
327  var $jobSlider = $('.list-jobs');
328  var jobSlider_opt = {
329    arrows: true,
330    centerMode: true,
331    centerPadding: '100px',
332    slidesToShow: 2,
333    variableWidth: false,
334    responsive: [
335      {
336        breakpoint: 768,
337        settings: {
338          arrows: false,
339          infinite: true,
340          centerMode: true,
341          centerPadding: '30px',
342          slidesToShow: 1,
343        }
344      }
345    ]
346  };
347  if ($jobSlider.length) {
348    $jobSlider.slick(jobSlider_opt);
349  }
350};
351/* ----------------------------------------------------------
352 detailSlider
353 ---------------------------------------------------------- */
354var js_detailSlider = function(){
355    var $detailSlideMain = $('.detail-slide-main'),
356        $detailSlideNav = $('.detail-slide-nav'),
357        slideMain_opt = {
358            arrows: false,
359            slidesToShow: 1,
360            slidesToScroll: 1,
361            fade: true,
362            asNavFor: '.detail-slide-nav',
363        },
364        slideNav_opt = {
365            arrows: true,
366            centerMode: true,
367            centerPadding: '0',
368            slidesToShow: 3,
369            asNavFor: '.detail-slide-main',
370            infinite: true,
371            focusOnSelect: true,
372            variableWidth: true
373        };
374    if ($('.detail-slide').length) {
375        $detailSlideMain.not('.slick-initialized').slick(slideMain_opt);
376        $detailSlideNav.not('.slick-initialized').slick(slideNav_opt);
377    }
378};
379/* ----------------------------------------------------------
380 icon new position
381---------------------------------------------------------- */
382var posArticleNew = function() {
383  if ($MQ == "SP"){
384    $('.list-article-item').each(function(){
385      var btmUPdate = $(this).find('.title').outerHeight();
386      $(this).find('.icon-new-wrap').css('bottom',btmUPdate + 10);
387    });
388  }
389  $(window).on("breakpointChange",function(){
390    $('.list-article-item .icon-new-wrap').removeAttr('style');
391  });
392};
393/* ----------------------------------------------------------
394 js-footer-popup
395---------------------------------------------------------- */
396var js_footerPopup = function() {
397  var btnPopup = $('.js-btn-footer-popup'),
398      footerPopup = $('.js-footer-popup');
399  if($MQ == "SP") {
400    btnPopup.on('click',function(){
401      //alert('z');
402      footerPopup.stop().fadeOut();
403      $(this).next(footerPopup).stop().fadeIn();
404    });
405    $(document).on('click touchend',function (e) {
406      if ($(e.target).closest('.footer').length == 0) {
407         $('.js-footer-popup').stop().fadeOut(300);
408      }
409    });
410  }
411  $(window).on("breakpointChange",function(){
412    footerPopup.removeAttr('style');
413  });
414};
415/* ----------------------------------------------------------
416 footer fixed
417---------------------------------------------------------- */
418var footerFix = function () {
419  $(window).scroll(function() {
420    var Offtop = $('html').offset().top;
421    var footerH = ($MQ == "PC") ? 212 : 176;
422    var screenH = $(window).height();
423    var wrapperH = $('.wrapper').outerHeight();
424    var posStart = (wrapperH - screenH) - footerH;
425    var detailTextH = $('.detail-text-wrap').outerHeight();
426    var organizeDetailH = $('.box-organize-detail').outerHeight();
427    var otherJobH = (typeof $('.box-other-job').outerHeight() !== "undefined" ? $('.box-other-job').outerHeight() : 0);
428    var contactWrapH = $('.box-contact-wrap').outerHeight();
429    var footerHide = (typeof organizeDetailH === "undefined" ? detailTextH + 200 : organizeDetailH + otherJobH + contactWrapH);
430    var formJobH = $('.box-form-job').outerHeight();
431    var footerShow = footerHide + formJobH;
432    if ($(this).scrollTop() >= posStart) {
433      $('.footer-logo:not(:animated)').slideDown(200);
434    } else {
435      $('.footer-logo:not(:animated)').slideUp(200);
436    }
437    if ($(this).scrollTop() > 200) {
438        if (typeof formJobH !== "undefined" && $MQ != "PC") {
439            if ($(this).scrollTop() > footerHide && $(this).scrollTop() < footerShow) {
440                $(".footer:not(:animated)").slideUp(200,function(){
441                    $(this).removeClass("fixed");
442                });
443            } else {
444                $(".footer:not(:animated)").slideDown(200).addClass("fixed");
445            }
446        } else {
447            $(".footer:not(:animated)").slideDown(200).addClass("fixed");
448        }
449    } else {
450      $(".footer:not(:animated)").slideUp(200,function(){
451        $(this).removeClass("fixed");
452      });
453    }
454  });
455};
456
457/* ----------------------------------------------------------
458 btn select
459---------------------------------------------------------- */
460var btnSelect = function(){
461  $('.ttl-select--pc').not('.salary-filter-button').on('click',function(){
462    $('.salary-filter-button.is-active').removeClass('is-active');
463    $('.salary-filter-panel:visible').slideUp();
464    if(!$(this).hasClass('is-active')) {
465      $('.ttl-select--pc.is-active').not(this).removeClass('is-active').next('.list-select-in').slideUp();
466      $(this).addClass('is-active');
467      $(this).next('.list-select-in:not(:animated)').slideDown();
468    } else {
469      $(this).next('.list-select-in:not(:animated)').slideUp(function(){
470        $(this).prev('.ttl-select--pc').removeClass('is-active');
471      });
472    }
473    if($MQ == "SP") {
474      $('.ttl-select--sp').on('click',function(){
475        $(this).parents('.list-select-in').prev('.ttl-select--pc').removeClass('is-active');
476        $(this).parents('.list-select-in:not(:animated)').slideUp();
477      });
478    }
479  });
480  $('.list-select-in .btn-filter').on('click',function(e){
481    e.preventDefault();
482    $(this).toggleClass('is-checked');
483  });
484
485  var checkCount = $('.contentType-list').find('.is-checked').length;
486  var targetRefineVal = $('.contentType-list').find('.is-checked').attr('data-value');
487  if(checkCount == 0 || targetRefineVal == "ALL"){
488      var contentTypeAll = $('.btn-filter[data-value="ALL"]').text();
489      $('.refineContentType--pc').text(contentTypeAll);
490      $('.refineContentType--sp').text(contentTypeAll);
491  }else{
492      var targetRefineText = $('.contentType-list').find('.is-checked').text();
493      $('.refineContentType--pc').text(targetRefineText);
494      $('.refineContentType--sp').text(targetRefineText);
495      $('.refineContentType--pc').addClass('is-refine');
496  }
497}
498/* ----------------------------------------------------------
499 heroFull
500---------------------------------------------------------- */
501var $hero_top;
502var heroFull = function(){
503  $hero_top = $(".js-hero-top");
504  $hero_botom_H = $('.js-hero-bottom').outerHeight();
505
506  if($MQ == 'PC'){
507
508    var scrWidth  = $(window).width();
509    var scrHeight = $(window).height() - $hero_botom_H / 2;
510
511    var vdoWidth, vdoHeight;
512    if(scrWidth > scrHeight * (16/9)) {
513      vdoWidth  = scrWidth;
514      vdoHeight = scrWidth * (9/16);
515    } else {
516      vdoWidth  = scrHeight * (16/9);
517      vdoHeight = scrHeight;
518    }
519
520    $hero_top.css({
521      'height': scrHeight
522    });
523  }
524  //$(window).on("breakpointChange",function(){
525  //  $hero_top.css({
526  //    'height': 'auto'
527  //  });
528  //});
529};
530/* ----------------------------------------------------------
531 heroTopOffset
532---------------------------------------------------------- */
533var heroTopOffset = function(){
534  var OffTop = $('.form-search').offset().top,
535      boxTtl_H = $('.hero-top-title-wrap').outerHeight(),
536      countBoxTtl_H = $('.job-count-box').outerHeight();
537
538  var jobCountTopDefault = 160,
539      jobCountTop        =0;
540
541  if ($MQ == "PC") {
542      var heroTop_Margin =  (OffTop - (boxTtl_H + 10 + countBoxTtl_H));
543      var heroTop       = heroTop_Margin / 2;
544      var JobTop_margin  = (heroTop_Margin + 10) / 3;
545
546      if(JobTop_margin>20){
547          jobCountTop = jobCountTopDefault + 60;
548      }else{
549          jobCountTop = jobCountTopDefault + JobTop_margin;
550      }
551
552      $('.hero-top-title-wrap').css('top', heroTop);
553      $('.job-count-box').css('top',jobCountTop);
554  } else {
555    $('.hero-top-title-wrap').css('top','0px');
556      $('.job-count-box').css('top','130px');
557  }
558};
559/* ----------------------------------------------------------
560 js placholder
561---------------------------------------------------------- */
562var js_placeholer = function(){
563    "use strict";
564    if($('.js-placeholder').length) {
565        $('.js-placeholder').placeholder({ customClass: 'my-placeholder' });
566    }
567};
568/* ----------------------------------------------------------
569 js uploadFile
570 ---------------------------------------------------------- */
571var uploadFile = function () {
572    $('.form-btn-upload .input-files-upload').change(function() {
573        var filename = $(this).val().split('\\').pop();
574        $('.form-btn-upload  .txt-filename').html(filename);
575    });
576};
577/* ----------------------------------------------------------
578 JS-checkTel
579 ---------------------------------------------------------- */
580var checkTel = function(){
581    if($('.js-checktel').length !== 0){
582        $('.js-checktel').each(function(){
583            var $new;
584            var $el = $(this);
585            var str = $el.html();
586            var cls = $el.attr('class');
587            var tel = $el.attr('href');
588            var checkTel_int = function () {
589                if ($MQ == "PC") {
590                    $new = $( '<span class="' + cls + ' tel-switch">'+ str + '</span>' );
591                    $el.replaceWith($new);
592                } else {
593                    $new = $( '<a href="'+ tel + '" class="' + cls + ' telEntry">' + str + '</a>');
594                    $el.replaceWith($new);
595                }
596                $el = $new;
597            }
598            checkTel_int();
599            $(window).on("breakpointChange",function(){
600                checkTel_int();
601            });
602        });
603    }
604}
605
606/* ----------------------------------------------------------
607 openAnotherWindow
608 ---------------------------------------------------------- */
609var openAnotherWindow = function(){
610  $('.article-type').attr("target", "_blank");
611}
612
613/* ----------------------------------------------------------
614 シェアボタン
615 ---------------------------------------------------------- */
616$('.share-btn').on('click', function() {
617
618    currentUrl = location.href;
619    campaignParam = $(this).data('campaign-param');
620    conjunction = '?';
621
622    if(currentUrl.match(/\?/)){
623        conjunction = '&'
624    }
625
626    title = document.title;
627    shareUrl = currentUrl;
628    if( campaignParam ){
629        shareUrl = shareUrl + conjunction + campaignParam;
630    }
631
632    targetHref = $(this).data('href');
633    targetHref = targetHref.replace('$(encodedTitle)', encodeURIComponent(title));
634    targetHref = targetHref.replace('$(encodedUrl)', encodeURIComponent(shareUrl));
635
636    $(this).attr('href', targetHref);
637
638    return true;
639});
640
641/* ----------------------------------------------------------
642 exlinkDialog
643 ---------------------------------------------------------- */
644var exlinkDialog = function() {
645    $(document).on('click', '.exlink-dialog', function(e) {
646        e.preventDefault();
647        var target = $(this);
648        var url = target.attr('href');
649        var externalLinkType = target.data('external-link-type') || '';
650        var externalLinkSourceGroupId = target.data('external-link-source-group-id') || '';
651        var externalLinkSourceId = target.data('external-link-source-id') || '';
652        var messageText =  "ここから先は外部サイトとなります\nURL:"+ url;
653        var result = window.confirm(messageText);
654        if(result) {
655            window.dataLayer = window['dataLayer'] || [];
656            window.dataLayer.push({
657                'event': 'externalLinkClick',
658                'externalLinkUrl': url,
659                'externalLinkFrom': window.location.href,
660                'externalLinkType': externalLinkType + '',
661                'externalLinkSourceGroupId': externalLinkSourceGroupId + '',
662                'externalLinkSourceId': externalLinkSourceId + ''
663            });
664            window.open(url);
665        }
666    });
667};
668
669var addTitleAttributeToInputTag = function(){
670    var win = $(this); //this = window
671    var title = 'title';
672
673    if($('.form-search .box-search .box-input-wrap .ttl-search').length) {
674        if (win.width() > 768) {
675            $('#search-01').removeAttr(title);
676            $('#search-02').removeAttr(title);
677        } else {
678            $('#search-01').attr(title, 'キーワード');
679            $('#search-02').attr(title, '勤務地');
680        }
681    }
682}
683
684$(window).on('resize', addTitleAttributeToInputTag);

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.