Skip to content

Instantly share code, notes, and snippets.

@cpjolicoeur
Forked from folke/gist:1453374
Created February 17, 2012 19:50
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpjolicoeur/1855097 to your computer and use it in GitHub Desktop.
Save cpjolicoeur/1855097 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;
omni_win = window.open('omnifocus:///add?note='+encodeURIComponent(note)+'&name='+encodeURIComponent(subject), 'omnifocus_win', 'width=10,height=10');
setTimeout(function() { omni_win.close(); }, 3000);
};
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment