public
Last active — forked from folke/gist:1453374

Gmail to OmniFocus

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
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);
};
};
})();

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.