Skip to content

Instantly share code, notes, and snippets.

@chalkygames123
Last active December 6, 2022 09:26
Show Gist options
  • Save chalkygames123/ce3256b034b7aa570fe1f9505756da2e to your computer and use it in GitHub Desktop.
Save chalkygames123/ce3256b034b7aa570fe1f9505756da2e to your computer and use it in GitHub Desktop.
Chatwork: メッセージをすべて既読にする
javascript: (function () {const settingsButton = document.querySelector('[data-testid="room-header_room-settings-button"]',);const unreadRooms = document.querySelectorAll('#RoomList [role="listitem"]:has(._unreadBadge)',);let currentUnreadRoomIndex = 0;const handleHashChange = () => {settingsButton.click();Array.from(document.querySelector('[role="menu"]').children).find((item) => item.textContent.includes('メッセージをすべて既読にする')).click();if (currentUnreadRoomIndex < unreadRooms.length) {unreadRooms[currentUnreadRoomIndex].click();currentUnreadRoomIndex += 1;} else {window.removeEventListener('hashchange', handleHashChange);}};window.addEventListener('hashchange', handleHashChange);handleHashChange();})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment