Created
March 3, 2014 23:08
-
-
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.
This file contains 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
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", "https://wave.google.com/wave/wavethis"); | |
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); | |
form.appendChild(tField); | |
form.appendChild(uField); | |
form.appendChild(cField); | |
form.submit(); | |
})(); | |
// window.open(("https://wave.google.com/wave/wavethis?t=" + 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