実現したいこと
下記コードが日付を指定した範囲内をクリック除外で、他のボタンを全てクリックする状態になっているのですが、
クリック数を5回までに絞る事は可能でしょうか?
自分なりに色々な方法で試したり、調べてみたのですが上手く起動しませんでした。
ご教授頂ければと思いますので、宜しくお願い致します。
javascript:(()=>{ const userPages = document.querySelectorAll('.userpage'); const targetUserPages = [...userPages].filter(e => isDateOutside(e)); console.log(`クリック対象`, targetUserPages.map(e=>e.querySelector('.answer.compatibility').textContent)); targetUserPages.map(e => e.querySelector('a.kitene_send_btn__text_wrapper').click()); function isDateOutside(userPage){ const textSplit = userPage.querySelector('.answer.compatibility').textContent.split(` `); const userDate = new Date(textSplit[0]); const startDate = new Date('2023/09/11'); const endDate = new Date('2023/10/31'); if(startDate <= userDate && userDate <= endDate){return false;} return true; } })();

0 コメント