PageSourceSearch

https://paypay.ne.jp/ot/wp-content/themes/paypay/assets/common/js/common_22.js?v=4

js paypay.ne.jp collected 2026-09-24 08:25:23 UTC 14,864 bytes, 417 lines download raw bytes

1$(function() {
2
3  // anchorLink
4  var gl_scroll_speed = 600;
5  var gl_fade_speed = 400;
6
7  $('a[href^="#"]').on('click',function(e) {
8    var href = $(this).attr('href');
9    var target = $(href == '#' || href == '' ? 'html' : href);
10    smoothScroll(0,target);
11    target.attr('tabindex', '-1');
12    target.focus();
13    e.preventDefault();
14  });
15
16  // ヘッダー下スクロール時に隠す
17  (function() {
18    var $header
19    var startPos = 0;
20
21    // /store-online/は除外
22    if (location.href.match(/store-online/)) return;
23
24    // /store/cashless//lp-02/と/store/offer/direct-lp-02/以外の場合
25    if (location.href.match('/store/(?!cashless/lp-02/)(?!offer/direct-lp-02/)')) return;
26
27    // 固定ヘッダーがない
28    if (location.search.match(/appwebview/)) return;
29
30    var $header = getHeaderElement();
31    if (!$header.length) return;
32
33    $(window).on('load scroll', function(e) {
34      var currentPos = $(this).scrollTop();
35      var headerHeight = $header.outerHeight();
36
37      // メニューが開いている場合は除外
38      if (!$('body').hasClass('isHeaderMenuActive')) {
39        // ヘッダーの高さよりスクロール済みで、かつさらに下にスクロール
40        // ページ遷移時
41        if ('load' === e.type) {
42          if (currentPos > headerHeight) slideUp();
43          else slideDown();
44
45        // スクロール時
46        } else if ('scroll' === e.type) {
47          // 下スクロール
48          if (currentPos > headerHeight && currentPos > startPos) {
49            slideUp();
50          }
51          // 上スクロール
52          else if (currentPos < startPos) {
53            slideDown();
54          }
55        }
56      }
57
58      startPos = currentPos;
59
60      // ヘッダースライドして隠れる
61      function slideUp() {
62        $header.css('top', '-' + headerHeight + 'px');
63        $(".c-header__search-box, .c-header__search-link").removeClass("is-active");
64      }
65      // ヘッダースライドして現れる
66      function slideDown() {
67        $header.css('top', '0');
68      }
69    });
70
71    // 固定ヘッダー取得
72    function getHeaderElement() {
73      var $header;
74      $header = $('.header--lp');
75      if (!$header.length) $header = $('.header');
76      if (!$header.length) $header = $('.headerVer2');
77      if (!$header.length) $header = $('.c-header');
78      return $header;
79    }
80  }());
81
82  // ヘッダー後続要素の位置調整
83  (function () {
84    var observer;
85    var $header;
86    var showClassName = 'header--show';
87
88    // 固定ヘッダーがない
89    if (location.search.match(/appwebview/)) return;
90
91
92    $header = getHeaderElement();
93    if (!$header.length) return;
94
95    observer = new MutationObserver(function (records) {
96      var targetState = $header.is(':visible');
97      if (targetState) {
98        if (!$header.hasClass(showClassName)) $header.addClass(showClassName);
99        unAddedStyles = false;
100      } else {
101        if ($header.hasClass(showClassName)) $header.removeClass(showClassName);
102      }
103    });
104
105    observer.observe($header[0], {
106      attributes: true,
107      attributeFilter: ['style']
108    });
109
110    // 固定ヘッダー取得
111    function getHeaderElement() {
112      var $header;
113      $header = $('.header--lp');
114      if (!$header.length) $header = $('.header');
115      if (!$header.length) $header = $('.headerVer2');
116      if (!$header.length) $header = $('.c-header');
117      return $header;
118    }
119  }());
120
121  // 検索結果ページのページネーション後、位置調整
122  (function () {
123    var observer;
124    var $target = $('#searchResult');
125
126    // 固定ヘッダーがない
127    if (location.search.match(/appwebview/)) return;
128    if (!$('.header--lp').length && !$('.header').length && !$('.headerVer2').length) return;
129    // 検索結果がない
130    if (!$target.length) return;
131
132    observer = new MutationObserver(function (records) {
133      // リスト追加更新時のみ対象
134      $.each(records, function (i, v) {
135        if ('childList' === records[i].type && records[i].addedNodes.length) {
136          addEvent();
137        }
138      });
139    });
140
141    observer.observe($target[0], {
142      childList: true,
143      subtree: true
144    });
145
146    function addEvent() {
147      var $context = $('.mt-site-search-pagination-item__link');
148      if (!$target.length) return;
149      $context.off('click.position.pagenation');
150      $context.on('click.position.pagenation', function (e) {
151        setTimeout((function() {
152          window.scroll(0, calcPosition());
153        }).bind(this, e), 100);
154      });
155    }
156
157    function calcPosition() {
158      var headerGap = 0;
159      if ($('.header--lp').length) headerGap += $target.offset().top - $('.header--lp').outerHeight();
160      else if ($('.header').length) headerGap += $target.offset().top - $('.header').outerHeight();
161      else if ($('.headerVer2').length) headerGap += $target.offset().top - $('.headerVer2').outerHeight();
162      return headerGap;
163    }
164  }()); // 検索結果ページのページネーション後、位置調整ここまで
165
166  // smoothScroll
167  var smoothScroll = function(offset,target) {
168    if (target.length) {
169      var targetPos = target.offset().top - offset - calcheaderGap(target.prop("tagName").toLowerCase());
170      $('body,html').animate({scrollTop: targetPos}, gl_scroll_speed);
171    }
172
173    function calcheaderGap(tagName) {
174      var headerGap = 0;
175      var targetPos;
176      var currentPos;
177
178      if (location.search.match(/appwebview/)) return headerGap; // 0
179
180      if ('html' === tagName) return headerGap; // 0
181
182      targetPos = target.offset().top - offset;
183      currentPos = $(window).scrollTop() - offset;
184
185      // ヘッダー表示状態(スライドダウン)のときは
186      // ヘッダー高さ分のスクロールを確保
187      if (currentPos > targetPos) {
188        if ($('.header--lp').length) headerGap += $('.header--lp').outerHeight();
189        else if ($('.header').length) headerGap += $('.header').outerHeight();
190        else if ($('.headerVer2').length) headerGap += $('.headerVer2').outerHeight();
191        else if ($('.c-header').length) headerGap += $('.c-header').outerHeight();
192      }
193
194      return headerGap;
195    }
196  }
197
198  // pagetop
199  var $top = $(".top");
200  $top.hide();
201  $(window).on("scroll", function() {
202    if ($(this).scrollTop() > 100) {
203      $top.fadeIn(300);
204    } else {
205      $top.fadeOut(300);
206    }
207  });
208
209  // 旧 parameterDecision
210  if(location.search.match(/appwebview/)) {
211    $(".app-none-display").hide();
212    $(".app-show-display").show();
213  } else {
214    $(".app-erase-display").show();
215    $(".app-show-display").hide();
216  }
217
218  // appwebview parameterDecision
219  if(location.search.match(/appwebview/)) {
220    $(".appView--hide").hide();
221    $(".appView--show").show();
222  } else {
223    $(".appView--hide").show();
224    $(".appView--show").hide();
225  }
226
227  // 旧 userAgentDecision
228  var ua = navigator.userAgent;
229  if(ua.search(/iPhone/) !== -1 || ua.search(/iPad/) !== -1) {
230    $(".ua-device-ios").show();
231    $(".ua-device-ios-only").show();
232  } else if(ua.search(/Android/) !== -1) {
233    $(".ua-device-android").show();
234    $(".ua-device-android-only").show();
235  } else {
236    $(".ua-device-ios").show();
237    $(".ua-device-android").show();
238  }
239
240  // userAgentDecision
241  var ua = navigator.userAgent;
242  if(ua.search(/iPhone/) !== -1 || ua.search(/iPad/) !== -1) {
243    $(".userDevice--ios").show();
244    $(".userDevice--iosOnly").show();
245  } else if(ua.search(/Android/) !== -1) {
246    $(".userDevice--android").show();
247    $(".userDevice--androidOnly").show();
248  } else {
249    $(".userDevice--ios").show();
250    $(".userDevice--android").show();
251    userDeviceOtherDisplayPC(); // userDevice--otherDisplayPc
252  }
253
254  function userDeviceOtherDisplayPC() {
255    var mediaQuery = matchMedia('(max-width: 750px)');
256    handleMediaQuery(mediaQuery);
257    mediaQuery.addListener(handleMediaQuery);
258
259    function handleMediaQuery(mq) {
260      if (!$(".userDevice--otherDisplayPc").length) return;
261      if(location.search.match(/appwebview/)) return;
262      if (mq.matches) {
263        $(".userDevice--otherDisplayPc").hide();
264      } else {
265        $(".userDevice--otherDisplayPc").show();
266      }
267    }
268  }
269
270  // sticky appDownload
271  var $body = $("body");
272  var $sticky = $(".stickyApp");
273  var $closeSticky = $(".stickyApp__close");
274  var $top = $(".top");
275  var $footer = $(".footerVer2");
276
277  if ($sticky.css("display") == "block") {
278    $body.addClass("page--appSticky");
279    $footer.addClass("footerVer2--sticky");
280    $top.addClass("top--sticky");
281  }
282
283  $closeSticky.click(function(e){
284    $sticky.remove();
285    $body.removeClass("page--appSticky");
286    $footer.removeClass("footerVer2--sticky");
287    $top.removeClass("top--sticky");
288  });
289
290  // globalTransitionがある場合の後続要素の位置調整
291  var $globalTransition = $(".globalTransition");
292  if($globalTransition.length && $globalTransition.css("display") == "block"){
293    $(".headerVer2").addClass("globalTransition--show");
294  }
295
296  // ロード後に画面幅が可変したとき固定要素の位置調整(スティッキーの状態変化を監視)
297  // ※common.js上で既にページロード時のスティッキー(非)表示処理完了済み、それ以降の状態のみを監視
298  (function () {
299    var observer;
300    var $target = $('.stickyApp');
301    var $footer = $('.footer');
302    var $footerVer2 = $('.footerVer2');
303    var $top = $('.top');
304
305    if (!$target.length) return;
306    observer = new MutationObserver(function (records) {
307      var targetState = $target.is(':visible');
308      if (targetState) {
309        if (!$footer.hasClass('footer--sticky')) $footer.addClass('footer--sticky');
310        if (!$footerVer2.hasClass('footerVer2--sticky')) $footerVer2.addClass('footerVer2--sticky');
311        if (!$top.hasClass('top--sticky')) $top.addClass('top--sticky');
312      } else {
313        $footer.removeClass('footer--sticky');
314        $footerVer2.removeClass('footerVer2--sticky');
315        $top.removeClass('top--sticky');
316      }
317    });
318
319    observer.observe($target[0], {
320      attributes: true,
321      attributeFilter: ['style']
322    });
323  }());
324
325  // OneTrust Cookie バナーが表示されたときに、言語切替ボタン, ページトップへ戻るボタン, チャットボットボタンの位置を変更する。
326  // バナー表示中は <head> に id付き <style> を追加し、バナーが非表示になれば <style> を削除
327  (function () {
328    var observer;
329    var $body = $("body");
330    removeBannerFlag = false;
331
332    observer = new MutationObserver(function (mutations) {
333      Array.prototype.forEach.call(mutations, function (mutation) {
334        Array.prototype.forEach.call(mutation.addedNodes, function (node) {
335          if (!isNode(node)) { return false }
336          if (!node.querySelector('#onetrust-banner-sdk')) { return false }
337
338          _generateStyleElement()
339          $(window).on('resize', function () {
340            _generateStyleElement()
341          })
342
343          function _generateStyleElement() {
344            var windowHeight = $(window).height();
345            var bannerHeight = $(node).find('#onetrust-banner-sdk').outerHeight()
346            var pageTopButtonHeight = 50;
347            var style = '';
348            style += '<style id="cookieBannerStyle">';
349            style += '@media screen and (min-width: 751px) {'
350            style += '#wovn-translate-widget, .page--appSticky #wovn-translate-widget { bottom: ' + (bannerHeight + 16) + 'px !important; }'
351            style += '}'
352          	style += '#wovn-translate-widget, .page--appSticky #wovn-translate-widget { bottom: ' + (bannerHeight + 16) + 'px !important; }'
353            style += 'body #wovn-translate-widget.mobile.wovn--slide-in { bottom: ' + (bannerHeight + 16) + 'px !important; }'
354            style += 'body #wovn-translate-widget.mobile.wovn--slide-out { bottom: ' + (bannerHeight + 8) + 'px !important; }'
355            style += '.chatbotFrame--sticky {transform: none !important;}'
356            style += '#va-window { z-index: 2147483646 !important; }'
357
358            // ブラウザの高さ 640px以下 チャットボットボタンを画面上の要素とかぶらないよう、非表示にする
359            if(windowHeight >= 640){
360              style += '#va-container.va-theme-overlay #va-launcher, #va-container.va-theme-toast #va-launcher{ bottom: ' + (bannerHeight + pageTopButtonHeight + 16 * 3) + 'px !important; }'
361              style += '.chatbotFrame--sticky { bottom: ' + bannerHeight + 'px !important; right: '+ ( 16 * 2 + pageTopButtonHeight) +'px !important;}'
362              style += '.chatbotFrame--side { bottom: ' + (bannerHeight + pageTopButtonHeight + 16 * 2) + 'px !important; }'
363              style += '.top{ bottom: ' + (bannerHeight + 16 + 8) + 'px; }'
364            }else{
365              style += '#va-container.va-theme-overlay #va-launcher, #va-container.va-theme-toast #va-launcher{ bottom: ' + (bannerHeight + 16) + 'px !important; }'
366              style += '.chatbotFrame--sticky { display: none !important; }'
367              style += '.chatbotFrame--side { display: none !important; }'
368              style += '.top{ bottom: ' + (bannerHeight + 16) + 'px; }'
369              style += '@media screen and (min-width: 751px) {'
370              style += '.chatbotFrame--sticky { right: '+ ( 16 * 2 + pageTopButtonHeight) +'px !important;}'
371              style += '}'
372              style += '@media screen and (orientation: portrait){'
373              style += '.top{ bottom: ' + (bannerHeight + 16) + 'px; }'
374              style += '}'
375              style += '@media screen and (orientation: landscape) and (max-width: 750px) {'
376              style += '#va-container.va-theme-overlay #va-launcher, #va-container.va-theme-toast #va-launcher{ bottom: 16px !important; }'
377              style += '}'
378            }
379
380            style += '</style>';
381
382            if( removeBannerFlag ){ return false }
383            if ($('#cookieBannerStyle').length) {
384              $('#cookieBannerStyle').remove();
385              $('head').append(style);
386            } else {
387              $('head').append(style);
388            }
389          }
390
391          observer.disconnect();
392        });
393      });
394    });
395
396    observer.observe($body[0], {
397      childList: true,
398      attributes: false,
399      characterData: false,
400      subtree: false
401    });
402    function isNode(obj) {
403      return obj && obj.nodeType && obj.nodeType === 1;
404    }
405    $(document).on('click', '#onetrust-accept-btn-handler', function () {
406      $('#cookieBannerStyle').remove()
407      removeBannerFlag = true;
408    }).on('click', '.ot-pc-refuse-all-handler', function () {
409      $('#cookieBannerStyle').remove()
410      removeBannerFlag = true;
411    }).on('click', '.onetrust-close-btn-handler', function () {
412      $('#cookieBannerStyle').remove()
413      removeBannerFlag = true;
414    })
415
416  }());
417});

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.