Skip to content

Instantly share code, notes, and snippets.

View sulrich's full-sized avatar
🙀
furble plotz

steve ulrich sulrich

🙀
furble plotz
View GitHub Profile
@sulrich
sulrich / gist:3744698
Created September 18, 2012 18:03 — forked from al3xandru/gist:1169583
OmniFocus Generalized Bookmarklet
javascript:(function(){
var w=window,d=document,selectedTxt=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0),pageUri=w.location.href,isGMail=w.location.host.match(/mail\.google\.com/),subject=d.title,source;
if(isGMail){
var msgFrm=d.getElementById("canvas_frame"),subjectSpans;
if(msgFrm){
subjectSpans=msgFrm.contentDocument.getElementsByClassName("hP");
if(subjectSpans)subject=subjectSpans[0].innerText;
};
if(!subjectSpans){
subject=d.title.substring(d.title.indexOf("-")+1,d.title.lastIndexOf("-")).replace(/^%20+/,"").replace(/%20+$/,"")