-
-
Save Coldblackice/3c5d16cd9492eab0c1d28d7c53a18adb to your computer and use it in GitHub Desktop.
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(){ | |
//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