Last active
November 23, 2016 16:04
-
-
Save rmeekers/4345fa5260a80ddbc5c877b7394bc50f to your computer and use it in GitHub Desktop.
Bookmarklet to send Gmail email to Omnifocus. Email subject will become the action title. A link to the email will be added to the action notes. If you've selected some text, it will be added to the notes as well.
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 enc = encodeURIComponent, | |
w = window, | |
frames = w.frames, | |
d = document, | |
ms = w.getSelection ? w.getSelection() : (d.getSelection) ? d.getSelection() : (d.selection ? d.selection.createRange().text : 0), | |
mu = w.location.href, | |
mt = d.title, | |
subjSpans = d.getElementsByClassName('hP'), | |
i, url; | |
if (subjSpans) { | |
mt = subjSpans[0].innerText | |
} else { | |
mt = d.title.substring(d.title.indexOf('-') + 1, d.title.lastIndexOf('-')).replace(/^ +/, '').replace(/ +$/, '') | |
}; | |
an = mu + '\n\n' + ms; | |
url = 'omnifocus:///add?note=' + enc(an) + '&name=' + enc(mt); | |
w.location.href = url | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment