Created
February 20, 2012 15:32
-
-
Save cwaring/1869681 to your computer and use it in GitHub Desktop.
Gmail > Omnifocus bookmarklet
This file contains hidden or 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(){ | |
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