Skip to content

Commit

Permalink
Build URL with room and thread id instead of relying on concatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
rlazar committed Apr 24, 2020
1 parent 35f2140 commit 122ff25
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,9 @@ function main() {
`;
copyButton.addEventListener('click', function() {
const el = document.createElement('textarea');
el.value = window.location.origin +
window.location.pathname +
(window.location.pathname[window.location.pathname.length - 1] === '/' ? '' : '/') +
e.getAttribute("data-topic-id");
const roomId = window.location.pathname.match(/\/room\/([^\?\/]*)/)[1];
const threadId = e.getAttribute("data-topic-id");
el.value = `https://chat.google.com/room/${roomId}/${threadId}`;
document.body.appendChild(el);
el.select();
document.execCommand('copy');
Expand Down

0 comments on commit 122ff25

Please sign in to comment.