Last active
February 25, 2020 13:06
-
-
Save gtrufitt/864fdcda03e6e1d711f975c8b51bd63d to your computer and use it in GitHub Desktop.
Add thread link to threads in Google Chat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const insertThreads = () => { | |
| const roomId = document.querySelector('[data-soft-view-id]').getAttribute('data-soft-view-id') | |
| document.querySelectorAll('[data-topic-id]').forEach((topic) => { | |
| const topicId = topic.getAttribute('data-topic-id'); | |
| if (document.querySelectorAll(`[data-gu-thread="${topicId}"]`).length === 0 && !document.querySelector('[data-stream-group-id*="dm/"]')) { | |
| topic.insertAdjacentHTML('beforeend', `<a data-gu-thread="${topicId}" href="https://chat.google.com${roomId}/${topicId}">Thread link</a>`) | |
| } | |
| }); | |
| }; | |
| document.addEventListener("load", insertThreads, true); | |
| insertThreads(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment