Skip to content

Instantly share code, notes, and snippets.

@gtrufitt
Last active February 25, 2020 13:06
Show Gist options
  • Select an option

  • Save gtrufitt/864fdcda03e6e1d711f975c8b51bd63d to your computer and use it in GitHub Desktop.

Select an option

Save gtrufitt/864fdcda03e6e1d711f975c8b51bd63d to your computer and use it in GitHub Desktop.
Add thread link to threads in Google Chat
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