Clickable URL's

Share your scripts and packages with other Mudlet users.
Sojik
Posts: 6
Joined: Thu May 26, 2011 9:31 pm

Re: Clickable URL's

Post by Sojik »

One problem with the email catcher considering it doesn't check for mailto: or prepend it if it isn't there. Working on solution.

Sojik
Posts: 6
Joined: Thu May 26, 2011 9:31 pm

Re: Clickable URL's

Post by Sojik »

I fixed the email links -- they prefix mailto: automatically in the link, now, if it isn't already added since openUrl fails when thrown an email address without it.

I've also adopted what I think is a better regex for URL detection from http://daringfireball.net/2010/07/impro ... ching_urls.

The email detection is still the same one from CMUD and isn't perfect. Email addresses actually allow more characters than this detects but not many people use email addresses like that.

Next I will probably work out a way to shorten the display of really long URLs.
Attachments
clickableURLs.xml
(1.36 KiB) Downloaded 843 times

User avatar
Calixa
Posts: 25
Joined: Sat Nov 20, 2010 5:51 pm
Location: Lusternia

Re: Clickable URL's

Post by Calixa »

Thanks for the update.

User avatar
Proxy
Posts: 27
Joined: Sun May 08, 2016 4:57 pm

Re: Clickable URL's

Post by Proxy »

In the case of this url: http://www.thetimmy.tk/ it always omits the last forward slash. How do I get it to capture the whole link?

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Clickable URL's

Post by SlySven »

Is the URL sending the user to the http://www.thetimmy.tk/ directory or to the http://www.thetimmy.tk/index.html default page?

User avatar
Proxy
Posts: 27
Joined: Sun May 08, 2016 4:57 pm

Re: Clickable URL's

Post by Proxy »

I'm sorry. This link from a game is more appropriate:

http://www.sindome.org/bgbb/development ... cripts-50/

When I click on it, it takes takes me to a 404 error page on the game's website because it matches this:

http://www.sindome.org/bgbb/development ... scripts-50

With a missing forward slash as you can see. I assume something was omitted from the regex for the trigger maybe?

User avatar
Proxy
Posts: 27
Joined: Sun May 08, 2016 4:57 pm

Re: Clickable URL's

Post by Proxy »

Any idea how the regex should be edited to allow match inclusion of the forward slash?

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Clickable URL's

Post by Vadi »

It would take a lot of work to understand that regex and make a change without breaking something else. It's a bit strange that the website requires an ending slash though - try raising it with the webmaster to see if they can adjust their configuration.

User avatar
Proxy
Posts: 27
Joined: Sun May 08, 2016 4:57 pm

Re: Clickable URL's

Post by Proxy »

Hi,

Thanks for the advise. The site sends their links in that format only. I got around it by adding another regex.

(?:https?://|mailto:)\S*[\w/=@#\-\?]

and the original on the second line:

\b(?:(?:(?:https?|ftp|telnet)://[\w\d:#@%/;$()~_?\+\-=&]+|www|ftp)(?:\.[\w\d:#@%/;$()~_?\+\-=&]+)+|[\w\d._%+\-]+@[\w\d.\-]+\.[\w]{2,4})\b

I don't know if this will affect performance.

Post Reply