Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Sun Jun 15, 2008 6:47 pm   

Clickable Hyper Links - Supports Many Formats Of Link Writing!
 
Ok, this is a major upgrade to the previous click able links that is posted here by someone else.

I've added support for the following styles of writing a link (so that its easier to make them clickable when someone types a link into chat):
http://www.whatever.com
www.whatever.com
whatever.com
whoever@whatever.com

I've also included all current tlds for the whatever.com format, so whatever.us, whatever.ru, whatever.cs etc etc etc should all work.

There is an alias to add new tlds, and it supports multiple at once.
EXAMPLE:
addtld .us
addtld .uk .ca .am

Code:
#CLASS {Hyper Links}
#ALIAS addtld {
  #CLASS {Hyper Links}
  #var tmptld {%-1}
  #var tmptld %subchar( @tmptld, " ", "|")
  #WHILE (@tmptld != "") {
    #ADDITEM tlds %item( @tmptld, 1)
    #DELNITEM tmptld 1
    }
  #CLASS 0
  }
#VAR tlds {.com|.net|.org|.us|.uk|.arpa|.root|.aero|.asia|.biz|.cap|.coop|.edu|.gov|.info|.int|.jobs|.mil|.mobi|.museum|.name|.pro|.tel|.travel|.ac|.ad|.ae|.af|.ag|.ai|.al|.am|.an|.aq|.ar|.as|.at|.au|.aw|.ax|.az|.ba|.bb|.bd|.bf|.bh|.bi|.bg|.bj|.bm|.bn|.bo|.br|.bs|.bt|.bv|.bw|.by|.bz|.ca|.cc|.cd|.cf|.cg|.ch|.ci|.ck|.cl|.cm|.cn|.co|.cr|.cu|.cv|.cx|.cy|.cz|.de|.dj|.dk|.dm|.do|.dz|.ec|.ee|.eg|.er|.es|.et|.eu|.fi|.fj|.fk|.fm|.fo|.fr|.ga|.gb|.gd|.ge|.gf|.gg|.gh|.gi|.gl|.gm|.gn|.gp|.gq|.gr|.gs|.gt|.gu|.gw|.gy|.hk|.hm|.hn|.hr|.ht|.hu|.id|.ie|.il|.im|.in|.io|.iq|.ir|.is|.it|.je|.jm|.jo|.jp|.ke|.kg|.kh|.ki|.km|.kn|.kp|.kr|.kw|.ky|.kz|.la|.lb|.lc|.li|.lk|.lr|.ls|.lt|.lu|.lv|.ly|.ma|.mc|.md|.me|.mg|.mh|.mk|.ml|.mm|.mn|.mo|.mp|.mq|.mr|.ms|.mt|.mu|.mv|.mw|.mx|.my|.mz|.na|.nc|.ne|.nf|.ng|.ni|.nl|.no|.np|.nr|.nu|.nz|.om|.pa|.pe|.pf|.pg|.ph|.pk|.pl|.pm|.pn|.pr|.ps|.pt|.pw|.py|.qa|.re|.ro|.rs|.ru|.rw|.sa|.sb|.sc|.sd|.se|.sg|.sh|.si|.sj|.sk|.sl|.sm|.sn|.so|.sr|.st|.su|.sv|.sy|.sz|.tc|.td|.tf|.tg|.th|.tj|.tk|.tl|.tm|.tn|.to|.tp|.tr|.tt|.tv|.tw|.tz|.ua|.ug|.uy|.uz|.va|.vc|.ve|.vg|.vi|.vn|.vu|.wf|.ws|.ye|.yt|.yu|.za|.zm|.zw|.xn--zckzah|.xn--0zwm56d|.xn--11b5bs3a9aj6g|.xn--80akhbyknj4f|.xn--9t4b11yi5a|.xn--deba0ad|.xn--g6w251d|.xn--hgbk6aj7f53bba|.xn--hlcj6aya9esc7a|.xn--jxalpdlp|.xn--kgbechtv}
#VAR tmptld {}
#TRIGGER {(%q)({https://|http://|ftp://|telnet://|www.|ftp.}%x)(%q)} {#SUBSTITUTE {~<A '%quote(%2)'>%1%2%3~</A>}}
#TRIGGER {(%q)(%x)~@(%x)(%q)} {#SUBSTITUTE {~<A 'mailto: %quote(%2)~@%quote(%3)'>%1%2~@%3%4~</A>}}
#TRIGGER {(%q)(%x{@tlds})(%q)} {#SUBSTITUTE {~<A '%quote(%2)'>%1%2%3~</A>}}
#CLASS 0
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Sun Jun 15, 2008 6:55 pm   
 
awesome script, I used to have such a trigger with simply #tr {http://(*)} {#mxp <a "http://%1>%1</a>}, this changes it!

where did you get the tlds list?

also, Website at http://www.firstage.net/
sends me to http://www.firstage.net&&http//www.firstage.net
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Sun Jun 15, 2008 8:21 pm   
 
I got the tld list off of wikipedia, took me about 15 minutes to put them all in. Its a HUGE list. I just did a google search for top level domain and it came up ;)

As for it being awesome, thank you. I've suggested that Zugg re-write his regex version that is included with CMUD 2.26+ to include these updates, as his just supports what one of my 3 does (the http://|ftp:// stuff) And adding the tld capabilities will be nice ;)
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Jun 15, 2008 8:50 pm   
 
I always wonder, whenever I hear about them, what exactly the point of TLDs is, you know. I've always thought it'd be much easier just to go to "http://google" or "http://images.google" for example. It'd remove the (very common) problem where a company registers, say, .com but forgets to register.co.uk, and someone steals it (link is NSFW). It'd also mean you don't have to remember which one a site chose, which can often be difficult. The only argument I've heard is that it allows more websites to be registered, which is frankly retarded - most websites register under as many TLDs as they can, and those that don't end up being confused anyway. It's not as if there's a shortage of strings, even ones that make sense in english. Pff.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net