PageSourceSearch

https://tenhama.co.jp/wp-content/themes/cms/js/main.js?ver=20201021_1

js tenhama.co.jp collected 2026-10-02 04:02:51 UTC 10,921 bytes, 347 lines download raw bytes

1// http://paulirish.com/2009/markup-based-unobtrusive-comprehensive-dom-ready-execution/
2// Modified to only fire on body class (not body class + ID, working off strictly WordPress body_class)
3
4// ブラウザ判別
5var ua = navigator.userAgent.toLowerCase();
6var ver = navigator.appVersion.toLowerCase();
7var isMSIE = (ua.indexOf('msie') > -1) && (ua.indexOf('opera') == -1);
8var isIE6 = isMSIE && (ver.indexOf('msie 6.') > -1);
9var isIE7 = isMSIE && (ver.indexOf('msie 7.') > -1);
10var isIE8 = isMSIE && (ver.indexOf('msie 8.') > -1);
11var isIE9 = isMSIE && (ver.indexOf('msie 9.') > -1);
12var isIE10 = isMSIE && (ver.indexOf('msie 10.') > -1);
13var isIE11 = (ua.indexOf('trident/7') > -1);
14var isIE = isMSIE || isIE11;
15var isEdge = (ua.indexOf('edge') > -1);
16var isChrome = (ua.indexOf('chrome') > -1) && (ua.indexOf('edge') == -1);
17var isFirefox = (ua.indexOf('firefox') > -1);
18var isSafari = (ua.indexOf('safari') > -1) && (ua.indexOf('chrome') == -1);
19var isOpera = (ua.indexOf('opera') > -1);
20
21// タブレットの場合はviewport書き換える
22if(navigator.userAgent.indexOf('iPad') > 0 || (navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') == -1) || navigator.userAgent.indexOf('A1_07') > 0 || navigator.userAgent.indexOf('SC-01C') > 0){
23  jQuery('head').find('meta[name="viewport"]').remove();
24  jQuery('head').prepend('<meta name="viewport" content="width=1100">');
25}
26
27Roots = {
28  // all pages
29  common: {
30    init: function(){
31      jQuery('.c-photoslider').slick({
32        dots: true,
33        arrows: false
34      });
35
36      jQuery('.c-spot-hor-lists').slick({
37        arrows: true,
38        slidesToShow: 4,
39        slidesToScroll: 1,
40        infinite: false,
41        autoplay: true,
42        autoplaySpeed: 5000,
43        responsive: [
44          {
45            breakpoint: 767,
46            settings: {
47              arrows: false,
48              slidesToShow: 2,
49              slidesToScroll: 1
50            }
51          }
52        ]
53      });
54
55      jQuery('.fancybox').fancybox();
56      jQuery('.basictable').basictable();
57
58      jQuery('img[usemap]').rwdImageMaps();
59
60      // サイト内検索表示切替
61      jQuery('#siteSearchButton').hover(
62        function () {
63          jQuery('#siteSearchForm').show();
64        },
65        function () {
66          jQuery('#siteSearchForm').hide();
67        }
68      );
69
70      jQuery('.p-gallery-post__link').fancybox({
71        margin: [30, 10, 30, 10],
72        scrolling: 'no',
73        padding: 0,
74        closeBtn: false,
75        arrows: false,
76        wrapCSS: 'p-gallery-post-inline__fancybox-wrap'
77      });
78
79      jQuery('.youtube_iframe').fancybox({
80        maxWidth: 800,
81        maxHeight: 600,
82        fitToView: false,
83        width: '70%',
84        height: '70%',
85        autoSize: false,
86        closeClick: false,
87        openEffect: 'none',
88        closeEffect: 'none'
89      });
90
91      jQuery('#homeEventSelect').change(function () {
92        jQuery('#homeEventTab a[href="#' + jQuery(this).val() +'"]').tab('show');
93      });
94
95      jQuery('#gallerySearchSelect').change(function () {
96        location.href = jQuery(this).val();
97      });
98
99      // ページトップへ
100      jQuery('#page-top').click(function () {
101        jQuery('body, html').animate({
102          scrollTop: 0
103        }, 250);
104        return false;
105      });
106
107      // スマホ横スクロールテーブル
108      jQuery('table.c-table--hor-scroll').wrap('<div class="c-table--hor-scroll-wrapper"></div>');
109
110      // スマホメニュー
111      jQuery('#show-main-menu').click(function () {
112        jQuery(this).toggleClass('is-active');
113        jQuery('#main-menu-sp').slideToggle();
114      });
115
116      jQuery('.mw_wp_form')
117        .find("input[name='郵便番号[data][0]'],input[name='郵便番号[data][1]']")
118        .on('change', function () {
119          AjaxZip3.zip2addr(
120            '郵便番号[data][0]',
121            '郵便番号[data][1]',
122            '都道府県',
123            '市区町村',
124            '番地など'
125          );
126        });
127
128      // サイドメニュー固定
129      if (jQuery('#contents-side').size() > 0) {
130        var fix = jQuery('#contents-side'),
131            side = jQuery('#contents-side').closest('div'),
132            main = jQuery('#main-container'),
133            fixTop = fix.offset().top,
134            fixWidth = fix.outerWidth();
135            sideTop = side.offset().top,
136            mainTop = main.offset().top,
137            w = jQuery(window);
138
139        var adjust = function () {
140		      // 768以上の時に実行
141          if (jQuery(window).width() > 767) {
142            fixTop = fix.css('position') === 'static' ? sideTop + fix.position().top : fixTop;
143            var fixHeight = fix.outerHeight(true),
144                mainHeight = main.outerHeight(),
145                winTop = w.scrollTop();
146            if (winTop + fixHeight > mainTop + mainHeight) {
147              fix.css({
148              	'margin-left': '0',
149                width: fixWidth + 'px',
150                position: 'absolute',
151                top: mainHeight - fixHeight
152              });
153            }
154            else if (winTop >= fixTop) {
155              fix.css({
156                width: fixWidth + 'px',
157                position: 'fixed',
158                top: 10
159              });
160              if (isSafari) {
161                fix.css({
162                  'margin-left': '735px'
163                });
164              }
165            }
166            else {
167              fix.css({
168              	'margin-left': '0',
169                'position': 'static'
170              });
171            }
172          }
173        }
174        w.on('scroll', adjust);
175      }
176
177      // ページトップへの表示/非表示
178      jQuery(window).on('scroll', function () {
179	      // 768以上の時に実行
180        if (jQuery(window).width() > 767) {
181          if (jQuery(this).scrollTop() > 100) {
182            jQuery('#page-top').fadeIn();
183          } else {
184            jQuery('#page-top').fadeOut();
185          }
186
187          var scrollHeight = jQuery(document).height(),
188              scrollPosition = jQuery(window).height() + jQuery(window).scrollTop(),
189              footHeight = jQuery('#footer2').outerHeight() + 39;
190
191          if (scrollHeight - scrollPosition <= footHeight) {
192            jQuery('#page-top').css({
193              'position': 'absolute',
194              'bottom': footHeight
195            });
196          } else {
197            jQuery('#page-top').css({
198              'position': 'fixed',
199              'bottom': '30px'
200            });
201          }
202        }
203      });
204
205    },
206  },
207  // Home page
208  home: {
209    init: function(){
210      // スライダー
211      jQuery('#home-slider > .container > div').slick({
212        autoplay: true,
213        autoplaySpeed: 5000,
214        pauseOnHover: true,
215        dots: true
216      });
217
218      jQuery('#home-slider-sp > div').slick({
219        autoplay: true,
220        autoplaySpeed: 5000,
221        pauseOnHover: true,
222        arrows: false,
223        dots: true
224      });
225
226      jQuery('.p-home-banner > div').slick({
227        autoplay: true,
228        autoplaySpeed: 5000,
229        pauseOnHover: true,
230        dots: true,
231        slidesToShow: 3,
232        slidesToScroll: 1,
233        responsive: [
234          {
235            breakpoint: 640,
236            settings: {
237              arrows: false,
238              slidesToShow: 1,
239              slidesToScroll: 1
240            }
241          }
242        ]
243      });
244
245      // 運行状況
246      jQuery('.marquee').marquee();
247
248      // ピックアップ
249      jQuery('#pickupListSp').slick({
250        slidesToShow: 2,
251        dots: false
252      });
253
254      // 路線情報
255      var $stationInfoBlock = jQuery('#stationInfoBlock'),
256          $stationInfoBlockInner = jQuery('#stationInfoBlock .inner'),
257          pHomeStationInfoMapWidth = 0;
258          jQuery('.p-home-station-info__name', $stationInfoBlockInner).each(function () {
259            pHomeStationInfoMapWidth += jQuery(this).outerWidth(true);
260          });
261      jQuery('.p-home-station-info__map', $stationInfoBlockInner).width(pHomeStationInfoMapWidth);
262      jQuery('.arrow-right', $stationInfoBlock).mousedown(function () {
263        stationInfoBlockScrollRight();
264      }).mouseup(function () {
265        $stationInfoBlockInner.stop();
266      });
267      function stationInfoBlockScrollRight() {
268        $stationInfoBlockInner.stop().animate({scrollLeft: '+=10px'}, 15, stationInfoBlockScrollRight);
269      }
270      jQuery('.arrow-left', $stationInfoBlock).mousedown(function () {
271        stationInfoBlockScrollLeft();
272      }).mouseup(function () {
273        $stationInfoBlockInner.stop();
274      });
275      function stationInfoBlockScrollLeft() {
276        $stationInfoBlockInner.stop().animate({scrollLeft: '-=10px'}, 15, stationInfoBlockScrollLeft);
277      }
278    }
279  },
280  // English
281  'page-template-english': {
282    init: function(){
283      // スライダー
284      jQuery('#home-slider > .container > div').slick({
285        autoplay: true,
286        autoplaySpeed: 5000,
287        pauseOnHover: true,
288        dots: true
289      });
290      jQuery('#home-slider-sp > div').slick({
291        autoplay: true,
292        autoplaySpeed: 5000,
293        pauseOnHover: true,
294        arrows: false,
295        dots: true
296      });
297
298      // 観光マップ
299      var $pEnglishTourismmap = jQuery('.p-english-tourismmap'),
300          $pEnglishTourismmapInner = jQuery('.p-english-tourismmap__inner'),
301          $pEnglishTourismmapArrowLeft = jQuery('.p-english-tourismmap__arrow-left'),
302          $pEnglishTourismmapArrowRight = jQuery('.p-english-tourismmap__arrow-right');
303      $pEnglishTourismmapInner.scrollLeft(1000);
304      $pEnglishTourismmapArrowLeft.mousedown(function () {
305        pEnglishTourismmapArrowLeft();
306      }).mouseup(function () {
307        $pEnglishTourismmapInner.stop();
308      });
309      function pEnglishTourismmapArrowLeft() {
310        $pEnglishTourismmapInner.stop().animate({scrollLeft: '-=10px'}, 15, pEnglishTourismmapArrowLeft);
311      }
312      $pEnglishTourismmapArrowRight.mousedown(function () {
313        pEnglishTourismmapArrowRight();
314      }).mouseup(function () {
315        $pEnglishTourismmapInner.stop();
316      });
317      function pEnglishTourismmapArrowRight() {
318        $pEnglishTourismmapInner.stop().animate({scrollLeft: '+=10px'}, 15, pEnglishTourismmapArrowRight);
319      }
320    }
321  }
322}
323
324UTIL = {
325  fire : function(func,funcname, args){
326    var namespace = Roots;  // indicate your obj literal namespace here
327    funcname = (funcname === undefined) ? 'init' : funcname;
328    if (func !== '' && namespace[func] && typeof namespace[func][funcname] == 'function'){
329      namespace[func][funcname](args);
330    }
331  },
332  loadEvents : function(){
333
334    // hit up common first.
335    UTIL.fire('common');
336
337    // do all the classes too.
338    jQuery.each(document.body.className.split(/\s+/),function(i,classnm){
339      UTIL.fire(classnm);
340    });
341
342    UTIL.fire('common','finalize');
343  }
344};
345
346// kick it all off here
347jQuery(document).ready(UTIL.loadEvents);

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.