PageSourceSearch

https://mixhost.jp/wp-content/plugins/hustle-redisplay/js/popup.js?ver=v1.2

js mixhost.jp collected 2026-09-24 17:34:20 UTC 3,853 bytes, 180 lines download raw bytes

1/* クーポンは自動表示なし、指定時間待ってクーポンタブを表示するように動作変更したVer.(20250425) */
2
3document.addEventListener("DOMContentLoaded", function () {
4
5  if (sessionStorage.getItem('my-hustlepopup-deactive')) {
6
7    // my-hustlepopup-deactiveセッション中なら
8    // .hide_for_af_visitorクラスを持つ要素を非表示に
9    const elements = document.querySelectorAll('.hide_for_af_visitor');
10    elements.forEach(element => {
11    element.style.display = 'none';
12    });
13    
14    // ポップアップ無しで終了
15    return;
16
17  } else if (deactive_popup == 1 || checkCookie('popup_coupon_controll') ) {
18
19    // プラグイン本体から渡されたdeactive_popupが1またはクーポン非表示ciikieがあれば
20    // .hide_for_af_visitorクラスを持つ要素を非表示に
21    const elements = document.querySelectorAll('.hide_for_af_visitor');
22    elements.forEach(element => {
23    element.style.display = 'none';
24    });
25    
26    // ポップアップ無しにするセッションストレージを保存して終了
27    sessionStorage.setItem('my-hustlepopup-deactive', "no_popup");
28
29    return;
30
31  }
32
33
34    
35
36  function checkCookie(cookieName) {
37
38    var cookies = document.cookie.split(';');
39
40    for (var i = 0; i < cookies.length; i++) {
41
42      var cookie = cookies[i].trim();
43
44      // Check if this cookie starts with the desired name
45
46      if (cookie.startsWith(cookieName + '=')) {
47
48        return true; // Found the cookie
49
50      }
51
52    }
53
54    return false; // Cookie not found
55
56  }
57
58
59
60  // ポップアップを閉じるボタン
61
62  const myHustleCloseButton = document.querySelectorAll('.hustle-button-close');
63
64  // ポップアップを再表示するボタン
65
66  const myHustleRedisplayButton = document.getElementById('hustle-redisplay-button');
67
68  // クーポンコードのコピーボタン
69
70  const myHustleCouponCopyButton = document.querySelectorAll('.my-hustle-copy-coupon-button');
71
72
73
74
75
76  // クーポンを閉じたsessionStorageがあれば、クーポン再表示用のボタンを表示
77
78  // sessionStorageがなければ指定秒数後にクーポン再表示用のボタンを表示
79
80  if (sessionStorage.getItem('my-hustlepopup-closed')) {
81
82    myHustleRedisplayButton.classList.add('show');
83
84  } else {
85
86    myHustleCouponCopyButton.forEach(function (button) {
87
88      const waitTime = button.dataset.wait;
89
90      window.setTimeout(function () {
91
92        //myHustleRedisplayButton.click();
93          myHustleRedisplayButton.classList.add('show');
94
95      }, waitTime);
96
97    });
98
99  }
100
101
102
103
104
105  /* 
106
107   * クーポンポップアップの閉じるボタンが押されたら
108
109   * ・再表示用のボタンを表示 
110
111   */
112
113
114
115  myHustleCloseButton.forEach(function (button) {
116
117    button.addEventListener('click', function () {
118
119      // クーポン再表示ボタンを出現させる
120
121      myHustleRedisplayButton.classList.add('show');
122
123
124
125      // ブラウザを閉じるまで再表示させないためのsessionStorage
126
127      sessionStorage.setItem('my-hustlepopup-closed', true);
128
129    });
130
131  });
132
133
134
135
136
137  /* クーポンポップアップ内のコピーボタン動作 */
138
139
140
141  myHustleCouponCopyButton.forEach(function (button) {
142
143    button.addEventListener('click', function (e) {
144
145      e.preventDefault();
146
147
148
149      // クリップボードにコピー
150
151      const copytext = button.dataset.code;
152
153      const copyTextInput = document.createElement('textarea');
154
155      copyTextInput.value = copytext;
156
157      document.body.appendChild(copyTextInput);
158
159      copyTextInput.select();
160
161      document.execCommand('copy');
162
163      document.body.removeChild(copyTextInput);
164
165
166
167      // コピーボタンの表示変更
168
169      button.classList.add('copied');
170
171      button.textContent = 'コピーしました';
172
173    });
174
175  })
176
177
178
179});
180

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.