Created
April 19, 2011 07:05
-
-
Save luikore/926945 to your computer and use it in GitHub Desktop.
This bookmarklet makes all hoptoad trace openable by textmate. Change prj and gem for different projects.
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: | |
prj='/Users/z/prj_name'; | |
gem='/Users/z/.rvm/gems/ree-1.8.7-2011.03'; | |
ps=document.getElementById('backtrace').getElementsByTagName('p'); | |
for(i=0;i<ps.length;i++){ | |
h=ps[i].innerHTML; | |
if(h.match(/^\s*<a[^>]+>/)){ | |
h=h.replace(/^\s*<a[^>]+>/, '').replace(/<\/a>$/, ''); | |
prefix=prj; | |
}else if(h.match(/\[GEM_ROOT\]/)){ | |
h=h.replace(/\[GEM_ROOT\]/, ''); | |
prefix=gem; | |
}else{ | |
prefix='' | |
}; | |
m=h.match(/^(On line #(\d+) of )?([^ ]+\.(e?rb|haml|builder|slim))(:(\d+))?/); | |
if(m){ | |
ps[i].innerHTML=h.sub(m[3],'<a onclick="" href="txmt://open?url=file://'+prefix+m[3]+'&line='+(m[6]||m[2])+'">'+m[3]+'</a>') | |
} | |
}; | |
void(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment