Skip to content

Instantly share code, notes, and snippets.

Created March 3, 2014 23:08
Show Gist options
  • Save ZMYaro/9336554 to your computer and use it in GitHub Desktop.
Save ZMYaro/9336554 to your computer and use it in GitHub Desktop.
Click when reading a message in Gmail to turn the message into a wave where you can continue the conversation. Note that it will only take the first expanded message.
javascript:(function() {
var sub = document.getElementById("canvas_frame").contentDocument.getElementsByClassName("hP")[0].innerHTML;
var url = location.href.replace("#", "%23");
var msg = "";
var msgDiv = document.getElementById("canvas_frame").contentDocument.getElementsByClassName("ii")[0];
msg += msgDiv.children[0].innerText;
while (msg.indexOf(" ") != -1) {
msg.replace(" ", " ");
while (msg.indexOf("<br/>") != -1) {
msg.replace("<br>", "\n");
var form = document.createElement("form");
form.setAttribute("method", "POST");
form.setAttribute("action", "");
var tField = document.createElement("input");
tField.setAttribute("type", "hidden");
tField.setAttribute("name", "t");
tField.setAttribute("value", sub);
var uField = document.createElement("input");
uField.setAttribute("type", "hidden");
uField.setAttribute("name", "u");
uField.setAttribute("value", url);
var cField = document.createElement("input");
cField.setAttribute("type", "hidden");
cField.setAttribute("name", "c");
cField.setAttribute("value", msg);
//"" + encodeURI(sub) + "&u=" + encodeURI(url) + "&c=" + encodeURI(msg)), "_blank");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment