PageSourceSearch

https://www.shirodatamedia.co.jp/wp-content/themes/shirodatamedia.co.jp_theme/assets/js/main.js?

js shirodatamedia.co.jp collected 2026-10-04 13:41:28 UTC 13,933 bytes, 462 lines download raw bytes

1$(function() {
2  (function($) {
3    var cName;
4    switch (true) {
5      case (window._ua.Tablet):
6        cName = 'tablet';
7        break;
8      case (window._ua.Mobile):
9        cName = 'mobile';
10        break;
11      default:
12        cName = '';
13    }
14    $('body').addClass(cName);
15    var isTouchDevice = (function(d) {
16      var iframe = d.createElement('iframe');
17      d.body.appendChild(iframe);
18      var result = ('ontouchstart' in iframe.contentWindow);
19      d.body.removeChild(iframe);
20      return result;
21    })(document);
22    if (!isTouchDevice) {
23      $('body').addClass('touch-disabled');
24    }
25  })($)
26
27  var headerHeight = 0;
28  var headerOffset = 0;
29  var footerOffset = 0;
30  $('header').addClass('low');
31  $('footer').addClass('low');
32  $('.pagetop').hide().addClass('hidden');
33
34  var ua = navigator.userAgent;
35  if (ua.indexOf('Android') !== -1) {
36    $('.menu_icon a').addClass('fix');
37  }
38  if (ua.indexOf('iPhone') !== -1 || ua.indexOf('iPad') !== -1) {
39    $('.parallax').addClass('ios');
40  }
41
42  // scrollbar
43  var scrollbarWidth = window.innerWidth - document.body.clientWidth;
44
45  // sp gnav
46  $('.menu_icon a').on('click', function(e) {
47    e.preventDefault();
48    $(this).toggleClass('close').parent().prev()
49    $('body').removeClass('down').addClass('up');
50    $(this).closest('header').toggleClass('menu_open');
51  });
52
53  // gnav
54  var navi_event = 'click';
55  if ($('.global_nav').css('list-style-position') === 'inside') {
56    navi_event =
57      (!$('body.mobile').length && !$('body.tablet').length) ?
58      'mouseenter mouseleave' : 'touchend';
59    $('.has_under').on('click', function(e) {
60      var tagName = e.target.tagName.toLowerCase();
61      if (!tagName === 'a' || $(e.target.parentNode).hasClass('has_under')) {
62        e.preventDefault();
63      }
64    });
65  }
66  $('.has_under').on(navi_event, function(e) {
67    var tagName = e.target.tagName.toLowerCase();
68    if (tagName === 'a' && !$(e.target.parentNode).hasClass('has_under')) {
69      return;
70    }
71    e.preventDefault();
72    var $self = $('>a', $(this));
73    //var $self = $(this);
74    if (!$self.hasClass('menu_under_open') && $('.menu_under_open').length) {
75      $('.menu_under_open')
76        .removeClass('menu_under_open')
77        .next().stop().slideToggle(200);
78    }
79    $self.toggleClass('menu_under_open');
80    $self.next().stop().slideToggle(200);
81  });
82  $('.gnav_search>a').on('click', function(e) {
83    e.preventDefault();
84    //$(this).toggleClass('menu_under_open');
85    $(this).next().slideToggle(200);
86  });
87
88  // pagetop
89  $('.pagetop a').on('click', function(e) {
90    e.preventDefault();
91    $('html, body').animate({
92      scrollTop: 0
93    });
94  });
95
96  // iOS svg tap fix
97  if ($('body.mobile').length || $('body.tablet').length) {
98    $('header .title a').on('touchend', function(e) {
99      e.preventDefault();
100      location.href = this.href;
101    });
102  }
103
104  // swipebox
105  if ($.isFunction($().swipebox)) {
106    var swipebox = $('.swipebox').swipebox();
107    $(document).on('click touchend', '#swipebox-overlay', function(e) {
108      e.preventDefault();
109      if ($(e.target).hasClass('slide')) $.swipebox.close();
110    })
111  }
112
113  // slider
114  if ($.isFunction($().sliderPro)) {
115    var sliderDefaults = {
116      center: {
117        width: 1000,
118        height: 450,
119        slideDistance: 0,
120        visibleSize: '100%',
121        arrows: true,
122        fadeArrows: false,
123        autoScaleLayers: false,
124        breakpoints: {}
125      },
126      wide: {
127        width: '100%',
128        autoHeight: true,
129        slideDistance: 0,
130        arrows: true,
131        fadeArrows: false,
132        fade: true,
133        autoScaleLayers: false,
134        touchSwipe: false,
135        breakpoints: {}
136      },
137      contents: {
138        width: 450,
139        height: 300,
140        aspectRatio: 1.5,
141        slideDistance: 10,
142        visibleSize: '100%',
143        arrows: true,
144        fadeArrows: false,
145        buttons: false,
146        fadeCaption: false,
147        breakpoints: {}
148      }
149    };
150    $('.slider-pro').each(function() {
151      var opt = $(this).data();
152      var number_of_slide = $(this).find('.sp-slide').length;
153      $(this).addClass(opt.type || 'center');
154      if (!this.hasAttribute('data-type')) {
155        return true;
156      }
157      var options = $.extend(true, (sliderDefaults[opt.type] || sliderDefaults.center), {});
158      if (opt.width) {
159        options.width = opt.width
160      }
161      if (opt.height) {
162        options.height = opt.height
163      }
164      if (typeof opt.distance !== 'undefined') {
165        options.slideDistance = opt.distance
166      }
167      if (opt.type == 'contents') {
168        if (opt.width || opt.height) {
169          options.aspectRatio = Math.round(options.width / options.height * 100) / 100;
170        }
171        if (number_of_slide % 2 === 0) {
172          options.visibleSize = options.width * (number_of_slide - 1) + options.slideDistance * (number_of_slide - 2);
173        }
174      }
175      if (typeof opt.autoplay !== 'undefined') {
176        options.autoplay = opt.autoplay
177      }
178      if (typeof opt.arrows !== 'undefined') {
179        switch (opt.arrows) {
180          case false:
181            options.arrows = false;
182            $(this).addClass('disable-arrows');
183            break;
184          case 'pc-only':
185            var bp = 768 - scrollbarWidth - 1;
186            options.breakpoints[bp] = options.breakpoints[bp] || {};
187            options.breakpoints[bp].arrows = false;
188            $(this).addClass('sp-disable-arrows');
189            break;
190        }
191      }
192      if (typeof opt.buttons !== 'undefined') {
193        switch (opt.buttons) {
194          case false:
195            options.buttons = false;
196            break;
197          case 'pc-only':
198            var bp = 768 - scrollbarWidth - 1;
199            options.breakpoints[bp] = options.breakpoints[bp] || {};
200            options.breakpoints[bp].buttons = false;
201            break;
202        }
203      }
204      $(this).sliderPro(options);
205    });
206  }
207
208  $('.slide_scroll').click(function(e) {
209    e.preventDefault();
210    var pos = $(this).closest('section').next().offset().top;
211    $('html, body').animate({
212      scrollTop: pos
213    });
214  });
215
216  // Q&A
217  // $('.qa:not(.qa-open) .question').click(function() {
218  //   $(this).toggleClass('open').next('.answer').slideToggle();
219  // });
220
221  // responsive scroll table
222  $('table.responsive-scroll').wrap(
223    '<div><div class="responsive-scroll-container"><div class="responsive-scroll-inner"></div></div><p class="sp-only text-center text-small">※横スクロールで全体を表示します。</p></div>'
224  );
225
226  // responsive list table
227  $('table.responsive-list').each(function() {
228    var header = [];
229    $(this).find('thead th').each(function() {
230      header.push($(this).text());
231    });
232    $(this).find('tbody td').each(function() {
233      $(this).attr('data-title', header[$(this).index()]);
234    });
235  });
236
237  // combine table
238  $('table.combine').closest('.col').css('margin-bottom', 0);
239
240  // Fix SP Menu
241  function fixSpMenu() {
242    var win_h = $(window).height();
243    var hdr_h = $('header').height();
244    if ($('.menu_icon').is(':visible') && $('header').css('z-index') != 'auto') { // SP && Fixed
245      $('header .global_nav>ul').css('max-height', win_h - hdr_h);
246    } else {
247      $('header .global_nav>ul').css('max-height', 'none');
248    }
249  }
250
251  function fixPageTop(window) {
252    var currentPos = $(window).scrollTop();
253    var $pagetop = $('.pagetop');
254    if (currentPos > 200) {
255      $pagetop.fadeIn(200, function() {
256        // $(this).removeClass('hidden');
257      });
258    } else {
259      $pagetop.fadeOut(200, function() {
260        // $(this).addClass('hidden');
261      });
262    }
263  }
264
265  function fixMainSize() {
266    if ($('.main_visual').length) {
267      var mainPadding = +$('.main_visual').css('padding-top').replace('px', '');
268      var mainHeight = $('.main_visual').height();
269      return (mainPadding > mainHeight) ? mainPadding : mainHeight;
270    } else {
271      return false;
272    }
273  }
274
275  // Load Event
276  $(window).load(function() {
277    headerOffset = fixMainSize();
278    footerOffset = $('footer').offset().top;
279    headerHeight = $('header').height();
280    $('body').removeClass('down').addClass('up').css('paddingTop', function() {
281      return $('header').css('position') == 'fixed' ? $('header').height() : 0;
282    });
283    if (typeof WOW !== 'undefined') {
284      new WOW().init();
285    }
286    fixSpMenu();
287    $('.tile').each(function() {
288      $(this).children().tile();
289    });
290  })
291
292  // Scroll Event
293  var scrolltimer = false;
294  var prevPos = 0;
295  $(window).on('scroll touchmove', function() {
296    $('body').addClass('scroll');
297    var currentPos = $(this).scrollTop();
298
299    headerOffset = fixMainSize();
300    footerOffset = $('footer').offset().top;
301
302    if (currentPos > headerOffset) {
303      $('header').removeClass('low').addClass('high');
304    } else {
305      $('header').removeClass('high').addClass('low');
306    }
307
308    if ((currentPos + $(this).height()) > footerOffset) {
309      $('footer').removeClass('low').addClass('high');
310    } else {
311      $('footer').removeClass('high').addClass('low');
312    }
313
314    fixPageTop(this);
315
316    if (currentPos > prevPos && currentPos > 0) { // down
317      $('body').removeClass('up').addClass('down') //.css('paddingTop', 0);
318      if (currentPos > headerHeight) {
319        // $('header').addClass('hidden');
320      }
321    } else { // up
322      $('body').removeClass('down').addClass('up').css('paddingTop', function() {
323        return $('header').css('position') == 'fixed' ? headerHeight : 0;
324      });
325      // $('header').removeClass('hidden');
326    }
327    if (!currentPos) {
328      $('body').addClass('scrollTop');
329    } else {
330      $('body').removeClass('scrollTop');
331    }
332    prevPos = currentPos;
333
334    if (scrolltimer !== false) {
335      clearTimeout(scrolltimer);
336    }
337    scrolltimer = setTimeout(function() {
338      $('body').removeClass('scroll');
339      $('body').removeClass('down').addClass('up').css('paddingTop', function() {
340        return $('header').css('position') == 'fixed' ? headerHeight : 0;
341      });
342      // $('header').removeClass('hidden');
343    }, 500);
344  });
345
346  // Resize Event
347  var resizetimer = false;
348  $(window).resize(function() {
349    if (resizetimer !== false) {
350      clearTimeout(resizetimer);
351    }
352    resizetimer = setTimeout(function() {
353      fixSpMenu();
354      $('.tile').each(function() {
355        $(this).children().tile();
356      });
357      headerHeight = $('header').height();
358      headerOffset = $('header').offset().top;
359      footerOffset = $('footer').offset().top;
360      $('.tile').each(function() {
361        $(this).children().tile();
362      });
363    }, 200);
364  });
365
366  // main_slider
367  if ($.isFunction($().slick)) {
368    (function($) {
369      if ($('.main_visual_slick li').length <= 1) return;
370      if ($('.main_visual').css('transform') !== 'none') {
371        var html = $('.main_visual_slick').html();
372        var $ul = $('<ul class="main_visual_slick_thumb">');
373        $('.main_visual').append($ul.html(html));
374      }
375      var fade = false;
376      var arrows = false;
377      var dots = false;
378      var speed = 500;
379      var appendArrows = $('.main_visual_slick');
380      if ($('.main_visual').css('table-layout') === 'fixed') {
381        fade = true;
382        speed = 1000;
383      }
384      if ($('.main_visual').css('list-style-position') === 'inside') {
385        arrows = true;
386        $('.main_visual').append('<div class="main_visual_arrow"></div>');
387        appendArrows = $('.main_visual_arrow');
388      }
389      if ($('.main_visual').css('list-style-type') === 'circle') {
390        dots = true;
391      }
392      var slick = $('.main_visual_slick').slick({
393        slidesToShow: 1,
394        autoplay: true,
395        fade: fade,
396        arrows: arrows,
397        dots: dots,
398        appendArrows: appendArrows,
399        autoplaySpeed: 5000,
400        speed: speed,
401      }).on('beforeChange', function(e, slick, currentSlide, nextSlide) {
402        if ($('.main_visual_slick_thumb').length) {
403          $('.main_visual_slick_thumb_current').removeClass('main_visual_slick_thumb_current');
404          $('.main_visual_slick_thumb>li').eq(nextSlide).addClass('main_visual_slick_thumb_current');
405        }
406        if ($('.main_visual_copy').css('transform') !== 'none') {
407          var $copy = $('.main_visual_copy li');
408          $copy.eq(currentSlide).removeClass('active');
409          $copy.eq(nextSlide).addClass('active');
410        }
411      });
412      if ($('.main_visual_copy').css('transform') !== 'none') {
413        $('.main_visual_copy li').eq(0).addClass('active').show();
414      }
415      $('.main_visual_slick_thumb>li').on('click', function() {
416        var index = $(this).index();
417        slick.slick('slickGoTo', index);
418      });
419    })($);
420  }
421
422  if (typeof skrollr !== 'undefined' && !$('body').hasClass('tablet') && !$('body').hasClass('mobile')) {
423    skrollr.init();
424  }
425
426  if (typeof objectFitImages !== 'undefined') {
427    objectFitImages('.ofi img');
428  }
429
430  // pc-only等のタグ前後に出てくる改行コードを除去
431  $('br.pc-only, br.sp-only, br.tablet-only, br.pc-hide, br.sp-hide, br.tablet-hide, sup, sub').each(function(){
432    var $parent = $(this).parent();
433    if( !$parent.length ) return true;
434    var html = $parent.html();
435    html = html
436      .replace(/\n/g, '')
437      .replace(/\s*?(<br class="(sp|pc|tablet)-(only|hide)([^>+?])>)\s*/g, '$1')
438      .replace(/(,|\.)(<br class="(sp|pc|tablet)-(only|hide))/g, '$1 $2')
439      .replace(/(\d)(<br class="(sp|pc|tablet)-(only|hide))/g, '$1 $2')
440      .replace(/\s*?<(sup|sub)/g, '<$1');
441    $parent.html( html );
442  });
443
444  // 遅延読み込み時のtile強制発火
445  if (typeof MutationObserver !== 'undefined') {
446    // IE10-
447    var observer = new MutationObserver(function() {
448      $(window).trigger('resize')
449    })
450
451    var config = {
452      attributes: true,
453      childList: true,
454      characterData: true,
455    }
456
457    $('.tile .lazy-hidden').each(function() {
458      observer.observe(this, config)
459    })
460  }
461
462});

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.