Skip to content

Instantly share code, notes, and snippets.

@folke
Created December 9, 2011 21:29
Show Gist options
  • Save folke/1453374 to your computer and use it in GitHub Desktop.
Save folke/1453374 to your computer and use it in GitHub Desktop.
Gmail to OmniFocus
javascript:(function(){
if(top.document == document) {
var msg = document.getElementById("canvas_frame");
if(msg){
subjectEl = msg.contentDocument.getElementsByClassName("hP");
subject = subjectEl[0].innerText;
bodyEl = msg.contentDocument.getElementsByClassName("adP");
body = bodyEl[0].innerText;
contactEl = msg.contentDocument.getElementsByClassName("gD");
contact = {
name: contactEl[0].innerText,
email: contactEl[0].getAttribute('email')
};
var note = "Subject: " + subject + "\n";
note += "From: " + contact.name + "<" + contact.email + ">\n";
note += "Link: " + window.location.href + "\n\n";
note += body;
window.location='omnifocus:///add?note='+encodeURIComponent(note)+'&name='+encodeURIComponent(subject);
};
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment