Parent Directory | Revision Log
XPATH extractor bookmarklet
1 | document.onclick = function (e) { |
2 | if (!e) { |
3 | e=window.event; |
4 | } |
5 | if (e) { |
6 | e = e.target ? e.target : e.srcElement; |
7 | } |
8 | var oStr; |
9 | for(oStr=''; e && e.nodeName != '#document'; e=e.parentNode) { |
10 | if (e.nodeName!='#text') { |
11 | var oCount = 0; |
12 | for (oCount=0,oOb=e; oOb; oOb=oOb.previousSibling) { |
13 | if (oOb.nodeName == e.nodeName) { |
14 | oCount++; |
15 | } |
16 | } |
17 | oStr = e.nodeName + ( (oCount-1) ? ('('+oCount+')') : '') + ( oStr ? ('/'+oStr) : '' ); |
18 | } |
19 | } |
20 | // location.href='http://www.someDomainOfYours.com/yourPage.php?url='+escape(location.href)+'&dompath='+oStr; |
21 | alert(escape(location.href)+'&dompath='+oStr); |
22 | return false; // don't follow stuff we click onto |
23 | } |
ViewVC Help | |
Powered by ViewVC 1.1.26 |