Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
javascript:(function(){
//inspired by http://userscripts.org/scripts/show/8924
var s = document.createElement('script');
s.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js');
if(typeof jQuery=='undefined') document.getElementsByTagName('head')[0].appendChild(s);
(function() {
if(typeof jQuery=='undefined') setTimeout(arguments.callee, 100)
else{
jQuery("*").one("click",function(event){
//http://snippets.dzone.com/posts/show/4349
jQuery(this)[0].scrollIntoView();
for(var path = '', elt = jQuery(this)[0]; elt && elt.nodeType==1; elt=elt.parentNode){
var idx = jQuery(elt.parentNode).children(elt.tagName).index(elt)+1;
idx>1 ? (idx='['+idx+']') : (idx='');
path='/'+elt.tagName.toLowerCase()+idx+path;
}
window.location.hash = "#xpath:"+path
event.preventDefault()
event.stopPropagation()
jQuery("*").unbind("click",arguments.callee);
})
}
})();
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.