Url Unwrap

By diego.devita Last update Nov 1, 2009 — Installed 27 times. Daily Installs: 4, 0, 5, 3, 2, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 2, 0
Script Summary:
simply replaces the url of any links on any page so that you're no more forced to pass thorugh an intermediate page.

This script has no discussions.

start the discussion

This script has no reviews.

description

it looks for a specific pattern: when the intended url is passed to another page as an argument, the script replaces the original url with the real destination.

the argument may be u or url

for example:

these links:
a href=".../p.cgi?a=1&b=2&url=http://www.siteb.com/page.html"
a href=".../p.cgi?a=1&b=2&u=http://www.siteb.com/page.html"
a href=".../p.cgi?a=1&b=2&url=/page.html"

become these ones:
a href="http://www.siteb.com/page.html"
a href="http://www.siteb.com/page.html"
a href=".../page.html"

todo

optimize the approach...maybe don't use the regex replace, but loop through matches.
make the function modular and make it easier to mantain.

changelog

0.2b
main function called directly, not as an onLoad handler
the pattern is more complex, added another argument name