PageSourceSearch

https://fortune-cookie.tokyo/assets/ECommerce/js/common.js?v=1.0.610

js fortune-cookie.tokyo collected 2026-10-07 17:58:02 UTC 3,429 bytes, 113 lines download raw bytes

1/**
2 * asset/ECommerce/js/common.js
3 */  
4window.addEventListener('load', function(){//HTML読み込み完了後に実行
5  new ScrollHint('.scrollTable');
6});
7
8var elements = document.getElementsByClassName('menu-btn');
9elements = Array.from( elements ) ;
10elements.forEach(menu_btn => {
11  menu_btn.addEventListener('click', function(e) {
12    var elem = e.target;
13
14    //toggleをクリック
15    if(elem.className.match(/menu-btn/)){
16      e.preventDefault();
17      if(elem.className.match(/active/)){
18        control_mobile_nav('',elem);
19      }else{
20        control_mobile_nav('open',elem);
21      }
22    }
23
24  });
25});
26
27document.addEventListener('click', function (e) {
28  var elem = e.target;
29
30  //モバイルメニューのカテゴリー「+」をクリック(共通)
31  if (elem && elem.className == 'sub-nav-toggle') {
32    //次の要素を取得
33    var next_elem = elem.nextElementSibling;
34    if (next_elem.className.match(/active/)) {
35      next_elem.classList.remove('active');
36      for (let i = 0; i < elem.children.length; i++) {
37        elem.children[i].classList.remove('fa-minus');
38        elem.children[i].classList.add('fa-plus');
39      }
40    } else {
41      next_elem.classList.add('active');
42      for (let i = 0; i < elem.children.length; i++) {
43        elem.children[i].classList.remove('fa-plus');
44        elem.children[i].classList.add('fa-minus');
45      }
46    }
47  }
48
49});
50
51//カートコンテンツ開く
52function control_mobile_nav(mode){
53  var mobile_nav = document.getElementById("mobile-nav");
54  var toggle = document.getElementById("toggle-close");
55  if(mode == 'open'){
56    mobile_nav.style.left = '0';
57    control_gray_layer('display');
58    toggle.style.display = 'block';
59  }else{
60    mobile_nav.style.left = '-90vw'; 
61    control_gray_layer(); 
62    toggle.style.display = 'none';
63  }  
64}
65
66
67//glaylayer操作
68function control_gray_layer(mode){
69  var gray_layer = document.getElementById("gray-layer");
70  if(mode == 'display'){
71  gray_layer.style.opacity = 0.5;
72  gray_layer.style.zIndex = 1000; 
73  }else{
74  gray_layer.style.opacity = 0;
75  gray_layer.style.zIndex = -1;    
76  }
77}
78
79
80//sidebar固定
81function sidebar(adjust = 0) {
82
83  var sidebar = document.getElementById("fixed-wrap");//サイドバーを指定
84  var wrap = document.getElementById("main-wrap");//ラッパーを指定
85
86  var adjustTop = 0;
87  var sidebarTop = parseInt(sidebar.offsetTop);
88  var sidebarMax = wrap.clientHeight + adjust - sidebar.clientHeight;
89
90  window.addEventListener('scroll', function(e) {
91
92    var windowHeight = window.innerHeight-100;//windowの高さ
93    var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
94    var h = sidebarTop + scrollTop;//サイドバーの上辺の位置+親要素の一番上から見たときのスクロールの位置
95
96    /**
97     * サイドバー固定の発火条件
98     * 1.サイドバーの位置 < サイドバーの最大移動距離 且つ
99     * 2.windowsの高さ > サイドバーの高さ  且つ
100     * 3.スクロール位置 > 調整値
101     */
102    //
103    if (h < sidebarMax && windowHeight > sidebar.clientHeight && scrollTop > adjust) {
104      if(scrollTop < adjust) {
105        adjustTop = 0;
106      } else {
107        adjustTop = adjust;//スクロール時のトップ位置調整用
108      }
109      var offset = sidebarTop-adjustTop + scrollTop + 'px';
110      sidebar.style.top = offset;
111    }
112  });
113}

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.