PageSourceSearch

https://www.smbc-gp.co.jp/js/common.js

js smbc-gp.co.jp collected 2026-10-02 02:52:28 UTC 6,377 bytes, 196 lines download raw bytes

1'use strict';
2
3var window_width = $(window).innerWidth();
4var window_height = $(window).innerHeight();
5var SP_MEDIA_QUERY = window.matchMedia("(max-width:768px)");
6var ua = window.navigator.userAgent.toLowerCase();
7var isIE = ua.indexOf('msie') >= 0 || ua.indexOf('trident') >= 0;
8var isSP = ua.indexOf('iphone') > 0 || ua.indexOf('ipod') > 0 || ua.indexOf('android') > 0 && ua.indexOf('mobile') > 0;
9var isIpadOS = ua.indexOf('ipad') > -1 || ua.indexOf('macintosh') > -1 && 'ontouchend' in document;
10var isTABLET = !isSP && (isIpadOS || ua.indexOf("android") > 0);
11$(function () {
12  jQuery.event.special.touchstart = {
13    setup: function setup(_, ns, handle) {
14      this.addEventListener("touchstart", handle, {
15        passive: !ns.indexOf("noPreventDefault")
16      });
17    }
18  };
19  jQuery.event.special.touchmove = {
20    setup: function setup(_, ns, handle) {
21      this.addEventListener("touchmove", handle, {
22        passive: !ns.indexOf("noPreventDefault")
23      });
24    }
25  };
26  /*! ===========================================================
27    // # include
28    // =========================================================== */
29  var path = location.pathname.split('/');
30  var currentPath = path[1];
31  // console.log(currentPath)
32  $("#header").load("/include/header.html", function () {
33    if (currentPath == 'service') {
34      $('.js-navLink-service').addClass('current');
35    } else if (currentPath == 'company') {
36      $('.js-navLink-company').addClass('current');
37    } else if (currentPath == 'ir') {
38      $('.js-navLink-ir').addClass('current');
39    } else if (currentPath == '' || currentPath == 'index.html') {
40      $('.js-navLink-top').addClass('current');
41    }
42  });
43  $("#footer").load("/include/footer.html");
44  /*! ===========================================================
45    // # userAgentFlag
46    // =========================================================== */
47
48  function userAgentFlag() {
49    if (isIE) {
50      $('body').addClass('is-ie');
51    }
52
53    if (!isSP && !isTABLET) {
54      $('body').addClass('is-pc');
55    } else {
56      $('body').addClass('is-sp');
57    }
58  }
59
60
61  function contentsMinHeight() {
62    window_height = $(window).innerHeight();
63    var body_height = $('body').innerHeight();
64
65    if (body_height < window_height) {
66      var min_height;
67      var header_height = $('header').innerHeight();
68      var footer_height = $('footer').innerHeight();
69
70      min_height = window_height - header_height - footer_height;
71      $('main').css('min-height', min_height + 'px');
72    }
73  }
74
75  /*! ===========================================================
76    // # drawer
77    // =========================================================== */
78
79
80  $('body').on('click', '.js-drawer-btn', function () {
81    if (!$(this).hasClass('is-open')) {
82      $(this).addClass('is-open');
83
84      $('.js-drawer-contents').addClass('is-transition');
85      $('.js-drawer-contents').fadeIn(200);
86    } else {
87      $(this).removeClass('is-open');
88      $('.js-drawer-text').html('menu');
89
90      $('.js-drawer-contents').addClass('is-transition');
91      $('.js-drawer-contents').fadeOut(200);
92    }
93  });
94  $('body').on('click', '.js-header-link', function () {
95    $('.js-drawer-btn').removeClass('is-open');
96    $('.js-drawer-text').html('menu');
97
98    $('.js-drawer-contents').fadeOut(200);
99  });
100  /*! ===========================================================
101    // # header pulldown
102    // =========================================================== */
103
104  $('body').on('click', '.js-header-pulldown-btn', function (event) {
105    if (SP_MEDIA_QUERY.matches) {
106      event.preventDefault();
107      $(this).toggleClass('is-open');
108      $(this).next('.js-header-pulldown-contents').toggleClass('is-open').slideToggle();
109    }
110  });
111  $('body').on('mouseover', '.js-header-hover-btn', function (event) {
112    if (!SP_MEDIA_QUERY.matches) {
113      $(this).addClass('is-open');
114      $(this).find('.js-header-pulldown-contents').addClass('is-open');
115    }
116  });
117  $('body').on('mouseout', '.js-header-hover-btn', function (event) {
118    if (!SP_MEDIA_QUERY.matches) {
119      $(this).removeClass('is-open');
120      $(this).find('.js-header-pulldown-contents').removeClass('is-open');
121    }
122  });
123
124  function headerReset() {
125    $('.js-header-pulldown-btn').removeClass('is-open');
126
127    if ($('.js-header-pulldown-contents').hasClass('is-open')) {
128      $('.js-header-pulldown-btn').next('.js-header-pulldown-contents').removeClass('is-open').css('display', 'none');
129    }
130
131    if (!SP_MEDIA_QUERY.matches) {
132      $('.js-drawer-btn').addClass('is-open');
133      $('.js-drawer-contents').css('display', 'flex');
134    } else {
135      $('.js-drawer-btn').removeClass('is-open');
136      $('.js-drawer-contents').css('display', 'none');
137    }
138  }
139  /*! ===========================================================
140    // # smoothScroll
141    // =========================================================== */
142  $('body').on('click', 'a[href^="#"]', function () {
143    var href = $(this).attr("href");
144    var target = $(href == "#" || href == "" ? 'html' : href);
145    var position = target.offset().top;
146    $("html, body").animate({
147      scrollTop: position
148    }, 600, "swing");
149    return false;
150  });
151
152  $('.js-page-top').hide();
153  $(window).on('scroll', function () {
154    if ($(this).scrollTop() > 100) {
155      $('.js-page-top').fadeIn();
156    } else {
157      $('.js-page-top').fadeOut();
158    }
159  });
160
161  $('body').on('click', '.js-pulldown-btn', function (event) {
162    $(this).toggleClass('is-open');
163    $(this).next('.js-pulldown-contents').toggleClass('is-open').slideToggle();
164  });
165
166  $(window).on('orientationchange resize', function () {
167    if (isSP) {
168      var resize_width = $(window).innerWidth();
169
170      if (window_width != resize_width) {
171        resizeInit();
172        window_width = resize_width;
173      }
174    } else {
175      resizeInit();
176    }
177  });
178  /*! ===========================================================
179    // # resize(mediaQueryOnly)
180    // =========================================================== */
181  SP_MEDIA_QUERY.addListener(headerReset);
182  /*! ===========================================================
183    // # init
184    // =========================================================== */
185
186  function resizeInit() {
187    contentsMinHeight();
188  }
189
190  function init() {
191    userAgentFlag();
192    contentsMinHeight();
193  }
194
195  init();
196});

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.