D
David Winter
Hello guys,
can someone help a humble user with modifying a bookmarklet?
Jesse Ruderman has this bookmarklet at
https://www.squarefree.com/bookmarklets/pagelinks.html#hrefs_as_link_text:
javascript:
(function()
{var i,c,x,h; for(i=0;x=document.links;++i)
{ h=x.href; x.title+=" " + x.innerHTML;
while(c=x.firstChild)x.removeChild(c);
x.appendChild(document.createTextNode(h));
} })()
It replaces all links on a page with their full URLs:
"Click here." becomes "Click http://www.foo.com."
Very useful when you copy a web page to a non-hypertext-aware target
format such as plain text.
Now how do I modify this so it *adds* the URL in brackets right after
the link instead of *replacing* it?
("Click here (http://www.foo.com).")
I thought that removing the "x.removeChild(c);" should do it, but that
only makes the browser crash.
I could not code my way out of a paper bag, so I'd appreciate some
help here.
Thank you.
can someone help a humble user with modifying a bookmarklet?
Jesse Ruderman has this bookmarklet at
https://www.squarefree.com/bookmarklets/pagelinks.html#hrefs_as_link_text:
javascript:
(function()
{var i,c,x,h; for(i=0;x=document.links;++i)
{ h=x.href; x.title+=" " + x.innerHTML;
while(c=x.firstChild)x.removeChild(c);
x.appendChild(document.createTextNode(h));
} })()
It replaces all links on a page with their full URLs:
"Click here." becomes "Click http://www.foo.com."
Very useful when you copy a web page to a non-hypertext-aware target
format such as plain text.
Now how do I modify this so it *adds* the URL in brackets right after
the link instead of *replacing* it?
("Click here (http://www.foo.com).")
I thought that removing the "x.removeChild(c);" should do it, but that
only makes the browser crash.
I could not code my way out of a paper bag, so I'd appreciate some
help here.
Thank you.