Jump to content

Url Underliner


tidy trax

Recommended Posts

;This snippet will underline urls in incoming or outgoing messages.
;
;To turn the underliner on, type /urlunderline on, to turn it off, type /urlunderline off.
;You can also turn it on or off via the menubar popup.
;The underliner is on by default.
;
;Email: [email protected]
;Irc: irc.undernet.org
;Channels: #mirc, #mirc.net
;Credits: qwerty (qwerty-) for the idea.

alias urlunderline { $iif($1 == on,.en,.dis) $+ able #url }

#url on
on *:input:*:{
 if (!$istok(/ $readini($mircini,text,commandchar),$left($1,1),32)) && (!$ctrlenter) {
   var %input = $1-
   .echo -q $regsub(%input,/((?:ftp:\/\/|https?:\/\/|www2?\.)[^<>\.\s]+(?:\.[^<>\.\s]+)+(?:\/[^<>\.\s]+)*)/g,\1,%input)
   .echo -q $regsub(%input,/(irc:\/\/[^<>\.\s]+(?:\.[^/<>\.\s]+)+(?:\/[^/<>\.\s]*)?\/?(?![^\s\x2c\.]))/g,\1,%input)
   .echo -q $regsub(%input,/(aim:goim\?screenname=[^\s&]+(?:&message=[^\s&=]+)?)/g,\1,%input)
   say %input
   halt
 }
}
on ^*:text:*:*:{
 var %text = $1-
 .echo -q $regsub(%text,/((?:ftp:\/\/|https?:\/\/|www2?\.)[^<>\.\s]+(?:\.[^<>\.\s]+)+(?:\/[^<>\.\s]+)*)/g,\1,%text)
 .echo -q $regsub(%text,/(irc:\/\/[^<>\.\s]+(?:\.[^/<>\.\s]+)+(?:\/[^/<>\.\s]*)?\/?(?![^\s\x2c\.]))/g,\1,%text)
 .echo -q $regsub(%text,/(aim:goim\?screenname=[^\s&]+(?:&message=[^\s&=]+)?)/g,\1,%text)
 echo -tlf $iif($chan,$chan,$iif($query($nick),$nick,$target)) $+(,$cnick($nick).color,<,$iif($gettok($readini($mircini,options,n2),30,44),$left($nick($chan,$nick).pnick,1)),$nick,>) %text
 haltdef
}
on $^*:hotlink:/aim:goim\?screenname=[^\s&]+(?:&message=[^\s&=]+)?|irc:\/\/[^<>\.\s]+(?:\.[^/<>\.\s]+)+(?:\/[^/<>\.\s]*)?\/?(?![^\s\x2c\.])/:*:{ return }
on *:hotlink:*:*:{
 if ($regex(aim,$1,/(aim:goim\?screenname=[^\s&]+(?:&message=[^\s&=]+)?)/)) { run $regml(aim,1) }
 elseif ($regex(irc,$1,/(irc:\/\/[^<>\.\s]+(?:\.[^/<>\.\s]+)+(?:\/[^/<>\.\s]*)?\/?(?![^\s\x2c\.]))/)) { run $regml(irc,1) }
}
#url end

menu menubar {
 $iif($group(#url).status == on,$style(1)) Url underlining: urlunderline $iif($group(#url).status == on,off,on)
}

 

It supports www, http, ftp, irc and aim urls, if anyone wants any more adding, tell me the syntax of the url.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...