Open links without http:// or www. with double-click

By Yama on Jul 20, 2013

This script just makes sure the cursor changes to a pointer on links without http:// or www., so you can open links with a double-click like full links.
You can add more domains to the if.

    ;--------------------------------------------------- - -  -    -
    ;| Weblinks © 11.08.2011
    ;--------------------------------------------------- - -  -    -
    ;| Version: 0.4
    ;| mIRC: v7.32
    ;| Script-Plan: Yama
    ;| Script-Mod: Yama
    ;--------------------------------------------------- - -  -    -
    ;| Beschreibung: Links ohne http:// und www. davor, kann man
    ;| mit einem Doppelklick öffnen.
    ;--------------------------------------------------- - -  -    -

    on ^*:hotlink:*.*:#,?: {
      if ( .com isin $1 || .de isin $1 || .to isin $1 || .info isin $1 || .biz isin $1 || .org isin $1 || .net isin $1 || .us isin $1 || .in isin $1 && https:// !isin $1 ) {
        /return
      }
      /halt
    }

    on *:hotlink:*:*: {
      /run http://www. $+ $remove($1,www.,http://)
    }

Comments

Sign in to comment.
Xcution   -  Aug 04, 2013

A little more further in what you can do with this and using regex to filter links.

;Hooks right, selected, and double click events in channels for nicks, links and channels ;)
on *:HOTLINK:*:*: {
  var %n $hotlink(match) ,%e $hotlink(event) 
  if (%n ison #) { 
    if (%e == rclick) { xdid -u nicklist 3 | xdid -c nicklist 3 $xfind(%n) | nicklist.popup } 
    elseif (%e == sclick) { xdid -u nicklist 3 | xdid -c nicklist 3 $xfind(%n) } 
    elseif (%e == dclick) { query %n } 
  } 
  elseif (%e == dclick) {
    if ($regex(%n,/(^|\s|>)((https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim)) { URL  $regml(2) }
    elseif ($regex(%n,/(^|\s|>)(www\.[\S]+(\b|$))/gim)) { URL $+(http://,$regml(2)) }
    elseif ($regex(%n,/(\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)/gim)) { url mailto: $+ $regml(1) }
    elseif ($regex(%n,/(%#\w+)/g)) { JOIN $regml(1) }
} }
Yama  -  Aug 06, 2013

Nice, but I only wanted hotlink for links without http:// or www.
Nicks and channels are working fine.

Savage_CL  -  Aug 09, 2013

@Xcution nice, but try to add to hers/his instead of posting your own.

@Yama When you have long lists of matches like that, regex is a blessing. Something simple like:

if ($regex($1-,/\b(.+?\.(?:com|net|org|de|to|info|biz).+?)\b/SUi))

This will match any string with .com, .net, .org, etc and place that string in $regml(1), everything in either direction until it hits whitespace (space, end of line, etc).

I would also suggest not adding the "www." to the beginning, as my website doesn't even allow for it, and some others don't too. I've only ever come across one, though, that needed it.

Yama  -  Aug 17, 2013

Thank you, will update later :D

sagargulati  -  Sep 01, 2013

@Yama : https:// you forgot that :)

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.