Skip to content

Instantly share code, notes, and snippets.

@syamn
Created May 30, 2025 17:36
Show Gist options
  • Select an option

  • Save syamn/fcf263dda33d07a6c6f28c5aac59545b to your computer and use it in GitHub Desktop.

Select an option

Save syamn/fcf263dda33d07a6c6f28c5aac59545b to your computer and use it in GitHub Desktop.
const checkAndClick = () => {
const moreButton = Array.from(document.querySelectorAll('span'))
.find(el => el.textContent.trim() === 'もっと見る');
const button = moreButton?.closest('button');
const isDisabled = button?.disabled || button?.hasAttribute('disabled');
if (moreButton && !isDisabled) {
moreButton.click();
} else if (isDisabled) {
// ビープ音を鳴らす(音量アップ)
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
const oscillator = audioContext.createOscillator();
const gainNode = audioContext.createGain();
oscillator.connect(gainNode);
gainNode.connect(audioContext.destination);
oscillator.frequency.setValueAtTime(800, audioContext.currentTime);
gainNode.gain.setValueAtTime(0.8, audioContext.currentTime);
gainNode.gain.exponentialRampToValueAtTime(0.01, audioContext.currentTime + 0.2);
oscillator.start();
oscillator.stop(audioContext.currentTime + 0.2);
// 要素をフィルター
document.querySelectorAll('button img[src*="calendar_none.svg"]').forEach(img => img.parentElement.parentElement.style.display = 'none');
document.querySelectorAll('button img[src*="calendar_few.svg"]').forEach(img => img.parentElement.parentElement.style.backgroundColor = 'red');
// ページを一番上へスクロール
window.scrollTo(0, 0);
// インターバルを停止
clearInterval(interval);
// 0.3秒待ってからダイアログ表示
setTimeout(() => {
if (confirm('ページを更新しますか?')) {
Array.from(document.querySelectorAll('span')).find(el => el.textContent.trim() === '検索')?.click();
}
}, 300);
}
};
// 0.1秒(100ミリ秒)ごとにチェック
const interval = setInterval(checkAndClick, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment