Post Reply 
convert links
Aug. 01, 2007, 03:49 AM
Post: #31
RE: convert links
The latest version of the clickable text url script doesn't make most text urls (such as the ones on http://www.4chan.org and urls that are in a code box which are in a post on a forum) clickable.
Add Thank You Quote this message in a reply
Aug. 01, 2007, 12:13 PM
Post: #32
RE: convert links
ah yes, i see it on http://www.4chan.org/ as well...

my GreenBrowser has a "linkify" plugin that converts it for me, the code for the plugin is:
Code:
<script language="Javascript">

// e-mail and frame-support and counter by mdlist

function no_error() {
return true;
}
onerror=no_error;

o = 0;

try{
   B=window.document.body;
   B.normalize();
   F(B);
}
catch(asdf){
}
if(frames.length>0){
for(i=0;i<frames.length;i++){
   try{
     B=window.frames[i].document.body;
     B.normalize();
     F(B);
   }
   catch(asdf){
   }
}
}

F(B);

function F(n){
var u,M,R,c,x;
if(n.nodeType==3){
  u=n.data.search(/((https?)|(ftp))\:\/\/[^\s]*[^.,">\s\)\]]/);
  if(u>=0){
    M=n.splitText(u);
    R=M.splitText(RegExp.lastMatch.length);
    getA();
    A.href=M.data;
    A.appendChild(M);
    n.parentNode.insertBefore(A,n.nextSibling);
  }
}
if(n.nodeType==3){
  u=n.data.search(/www[^\s]*[^.,">\s\)\]]/);
  if(u>=0){
    M=n.splitText(u);
    R=M.splitText(RegExp.lastMatch.length);
    getA();
    A.href="http://" + M.data;
    A.appendChild(M);
    n.parentNode.insertBefore(A,n.nextSibling);
  }
}
if(n.nodeType==3){
  u=n.data.search(/([a-zA-Z0-9._-][email protected][a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
  if(u>=0){
    M=n.splitText(u);
    R=M.splitText(RegExp.lastMatch.length);
    getA();
    A.href="mailto:" + M.data;
    A.appendChild(M);
    n.parentNode.insertBefore(A,n.nextSibling);
  }
}
else if(n.tagName!="STYLE"&&n.tagName!="SCRIPT"&&n.tagName!="A")
for(c=0;x=n.childNodes[c];++c)
F(x);
}

function getA(){
try{
   A=document.createElement("A");
}
catch(asdf){
}
if(frames.length>0){
for(i=0;i<frames.length;i++){
   try{
     A=window.frames[i].document.createElement("A");
   }
   catch(asdf){
   A="";
   }
}
}
o++;
top.status=o+" links linkified";
setTimeout("top.status=''",6000);
return A;
}

</script>

does that help any?
Add Thank You Quote this message in a reply
Aug. 01, 2007, 03:59 PM
Post: #33
RE: convert links
I can't tell because I don't know how to use that javascript code in Proxomitron.
Add Thank You Quote this message in a reply
Aug. 02, 2007, 02:56 AM
Post: #34
RE: convert links
Can someone please update the script to include the expressions that are in the code for the linkify plugin that was posted?
Add Thank You Quote this message in a reply
Aug. 02, 2007, 10:37 AM
Post: #35
RE: convert links
seems the above code is actually best implemented as a browser plugin as opposed to a Proxo insert...

and i'm afraid we can't use a simple Proxo HTML "search-and-replace" without, it seems to me, extensive "tag checks" (or "not-checks", as the case may be)...


i'm afraid the links you cite are simply not what the original notion was out to catch... (i was initially out to target "chat forum conversations" where posters post "links" but said links were not "clickable" 'cause the poster thought they were being 'cute' or something by what seems to be a common chat/board unwritten rule, ie, post a link but replace the two t's in http with something else to quote-unquote 'fool' the chat/board software...)


what browser are you using?
perhaps we can find you a plug-in for your browser that does what the linkify plugin does for mine...
Add Thank You Quote this message in a reply
Aug. 02, 2007, 03:55 PM
Post: #36
RE: convert links
The browser I use is Safari v3 (Windows Version).
Add Thank You Quote this message in a reply
Aug. 03, 2007, 10:13 PM
Post: #37
RE: convert links
So, I'm guessing that its not possible then?
Add Thank You Quote this message in a reply
Aug. 03, 2007, 11:47 PM
Post: #38
RE: convert links
still looking, actually (not very familiar with Safari, so this is sort of my trial-run with it)...

i should know more yet this evening or tomorrow morning by the latest...
Add Thank You Quote this message in a reply
Aug. 04, 2007, 12:13 AM
Post: #39
RE: convert links
The most complete one of these that I know about is Scojo's Convert-Text-URLs-to-Links.zip at http://tech.groups.yahoo.com/group/prox-...rs/_Other/
I haven't used it with N4.5.

How about something like:
Code:
[Patterns]
Name = "Create links from text (test Aug,03,2007)  ProxN4.5 only!"
Active = TRUE
URL = "$TYPE(htm)"
Limit = 256
Match = "<script*>$SET(nscript=1)(^)"
        "|</script>$SET(nscript=)(^)"
        "|<style$SET(nstyle=1)(^)"
        "|</style>$SET(nstyle=)(^)"
        "|<$SET(ncode=1)(^)"
        "|>$SET(ncode=)(^)"
        "|< a\s*>$SET(nlink=1)(^)"
        "|</a>$SET(nlink=)(^)"
        "|(http(s|)://)\1(^$TST(ncode=1))(^$TST(nlink=1))(^$TST(nscript=1))(^$TST(nstyle=1))([^< ]+)\2"
Replace = "<a href="\1\2">\1\2</a>"

Later
Add Thank You Quote this message in a reply
Aug. 04, 2007, 12:32 AM
Post: #40
RE: convert links
It works (except for the fact that it includes parenthesis' and periods if the original text url had them when converting it).
Add Thank You Quote this message in a reply
Aug. 04, 2007, 01:49 AM
Post: #41
RE: convert links
you mean parentheses or periods before or aft the actual link?
do you have an example site?

looks like the above is the best we might be able to do (many thanks, JJoe [and cscojo, of course])...

i'm definitely not coming up with any Safari-dependent plugin...
Add Thank You Quote this message in a reply
Aug. 04, 2007, 02:33 AM
Post: #42
RE: convert links
After the actual link. Here's a page containing an example: http://cgi.4chan.org/t/res/183887.html.
Add Thank You Quote this message in a reply
Aug. 04, 2007, 03:44 AM
Post: #43
RE: convert links
This should fix it:

Code:
[Patterns]
Name = "Create links from text (test Aug,03,2007)  ProxN4.5 only!"
Active = TRUE
URL = "$TYPE(htm)"
Limit = 256
Match = "<script*>$SET(nscript=1)(^)"
        "|</script>$SET(nscript=)(^)"
        "|<style$SET(nstyle=1)(^)"
        "|</style>$SET(nstyle=)(^)"
        "|<$SET(ncode=1)(^)"
        "|>$SET(ncode=)(^)"
        "|< a\s*>$SET(nlink=1)(^)"
        "|</a>$SET(nlink=)(^)"
        "|(http(s|)://)\1(^$TST(ncode=1))(^$TST(nlink=1))(^$TST(nscript=1))(^$TST(nstyle=1))([^)< ]+)\2"
Replace = "<a href="\1\2">\1\2</a>"

Note: I just added the closing parenthesis in [^< ]+.
Visit this user's website
Add Thank You Quote this message in a reply
Aug. 04, 2007, 03:50 AM
Post: #44
RE: convert links
The change you made fixed it.
Add Thank You Quote this message in a reply
Aug. 04, 2007, 05:42 AM
Post: #45
RE: convert links
Zero3K Wrote:(except for the fact that it includes parenthesis' and periods if the original text url had them when converting it).
Both can be part of a URL.
I don't think perfection is possible.

How about:
Code:
[Patterns]
Name = "Create links from text (test Aug,04,2007)  ProxN4.5 only!"
Active = TRUE
URL = "$TYPE(htm)"
Limit = 256
Match = "<script*>$SET(nscript=1)(^)"
        "|</script>$SET(nscript=)(^)"
        "|<style$SET(nstyle=1)(^)"
        "|</style>$SET(nstyle=)(^)"
        "|<$SET(ncode=1)(^)"
        "|>$SET(ncode=)(^)"
        "|< a\s*>$SET(nlink=1)(^)"
        "|</a>$SET(nlink=)(^)"
        "|(http(s|)://)\1(^$TST(ncode=1))(^$TST(nlink=1))(^$TST(nscript=1))(^$TST(nstyle=1))([^< ]++)\2([.,'")]+(\s|<))\3"
Replace = "<a href="\1\2">\1\2</a>\3"
The characters, .,'") , that people may add to the end of the actual address won't be used in the link.
This means that some of the links may be missing necessary characters.

The expression (^) never matches. Those lines that end with (^) set variables that will be used as flags. If any flag is equal to 1, the conversion should not be made. Conversions should not be made in scripts, css, tags, or links. (^$TST(ncode=1)) could be read as 'If ncode is not 1, then continue'.
Add Thank You Quote this message in a reply
Post Reply 


Forum Jump: