Skip to content

Instantly share code, notes, and snippets.

@jonesnxt
Last active March 11, 2021 02:54
Show Gist options
  • Save jonesnxt/f82f8fa69a1b86b60cf3828e46a94d1b to your computer and use it in GitHub Desktop.
Save jonesnxt/f82f8fa69a1b86b60cf3828e46a94d1b to your computer and use it in GitHub Desktop.
Add a reply button to messages on google chat

Google Chat Replies

To enable:

  1. Right click google meet and click "Inspect"
  2. Go to the "Console" tab
  3. Paste the script featured below into the console
  4. Ignore the message telling you not to do this
  5. Hit enter and it should work until next time you open the app

var node=document.createElement("div");node.appendChild(document.createTextNode("→")),node.className="replybutton",node.style="padding: 8px; cursor: pointer; font-size: 20px;";var msgCount=0;function caretToEnd(){var e=document.getElementsByClassName("oAzRtb krjOGe")[0],t=document.createRange(),n=window.getSelection();t.setStart(e.childNodes[0],e.textContent.length),t.collapse(!0),n.removeAllRanges(),n.addRange(t),e.focus()}function checkupdate(){var e=Array.from(document.getElementsByClassName("U26fgb mUbCce fKz7Od orLAid PFn4wd")).length;e!=msgCount&&(msgCount=e,Array.from(document.getElementsByClassName("replybutton")).forEach(e=>e.remove()),Array.from(document.getElementsByClassName("U26fgb mUbCce fKz7Od orLAid PFn4wd")).forEach(e=>e.parentNode.appendChild(node.cloneNode(!0))),Array.from(document.getElementsByClassName("replybutton")).forEach(e=>e.onclick=function(e){e="```"+e.target.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.getElementsByClassName("njhDLd")[0].textContent+': "'+e.target.parentElement.parentElement.parentElement.textContent.slice(0,-1)+'" ``` ';document.getElementsByClassName("oAzRtb krjOGe")[0].focus(),document.getElementsByClassName("oAzRtb krjOGe")[0].innerHTML="",document.getElementsByClassName("oAzRtb krjOGe")[0].appendChild(document.createTextNode(e)),document.getElementsByClassName("Ct5IYc qs41qe")[0].innerText="",caretToEnd()}))}setInterval(checkupdate,5e3),checkupdate();

  • its a little janky but I like it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment