Text to Link

By Kim A. Brandt Last update Feb 11, 2009 — Installed 9,042 times. Daily Installs: 21, 14, 9, 18, 13, 22, 16, 7, 12, 10, 17, 22, 22, 14, 16, 11, 13, 12, 17, 15, 8, 10, 19, 9, 10, 17, 16, 10, 10, 23, 18

Archived Comments (locked)

Subscribe to Archived Comments 40 posts, 11 voices

Jesse Andrews Admin

The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)

 
Kim A. Brandt Script's Author

Do you want to open links in a new tab? Shouldn't that be the job of your browser?

 
NotStyle User

can be posible "link in new tab" function?

 
Test123 User

No, I mean something other ^^ , but it's not neccessary
forget my idea ;-)

 
Kim A. Brandt Script's Author

I guess you are talking about greasemonkey and `Adding items to the menubar'[1].
I do not specifically write scripts for greasemonkey but you're welcome to make
the necessary changes and upload a new script.

You would have to fiddle around with the regular expressions that I used in the
script. When making a callback from a menuitem you could change some boolean
value to signalize a change in the settings.

[1] Adding items to the menubar - http://diveintogreasemonkey.org/advanced/gm_reg...

 
Test123 User

hiho, nice script ;-)

 
Kim A. Brandt Script's Author

What we could do is transform a XML into XHTML by using XSLT. I will look into it.
For now I fixed the script so no exception is thrown when encountering unsupported documents.

 
Argrithmag N... User

I installed this, however when i navigated to an xml file, not of the text links in the xml file were displayed as links. Any suggestions?

 
Kim A. Brandt Script's Author

That's cool.

An explanation for that could be the script makes changes to the HTML-source directly instead of using DOM (objects). It's faster but there're more things to take care of.

Cheers

 
bobielawlintine Scriptwright

Well with the updated script I no longer experience the problem. Thanks.

 
Kim A. Brandt Script's Author

Hmm... it's working for me. Are you sure it's this script and not something else? If you can/like try to run this script alone and turn of the others. Maybe changing the order of executing scripts might help!?

Is that the only site or does that happen all the time?

I guess I would need the HTML-source from that site since it could be that you are served with a slightly different HTML-code then me. You can send it to `kimabrandt at gmx dot de'.

I'm sorry I can't be of a better help at the moment.

Cheers

 
bobielawlintine Scriptwright

With the script enabled:

http://i14.tinypic.com/71xvfhy.png

and script disabled:

http://i7.tinypic.com/6jmxwys.png

 
Kim A. Brandt Script's Author

Do you have a link and/or screenshot?

 
bobielawlintine Scriptwright

It seems that when I have this script enabled, Google Images will not show.

 
Kim A. Brandt Script's Author

matrixik I added a variable `AUTO_STOP' which when set to `false' will ask to continue the script (no change). You have to set it to `true' by yourself if you don't want the question to pop up.

To do this:
1) right-click on the Greasemonkey icon in the status-bar
2) click on the `Manage User Scripts' menu-item
3) select `Text to Link' from the list-box
4) click on the `Edit' button
4a) evtl. choose the editor to use
5) search for `const AUTO_STOP' in the script
6) change `const AUTO_STOP = false;' to say `const AUTO_STOP = true;'

 
matrixik Scriptwright

Can You add option to auto stop change text to link if your script work too long? I don't want to see that message every time.

 
'ReX' Scriptwright

Kim A. Brandt thanks for the fix!

 
Kim A. Brandt Script's Author

I added the symbols `?' and `#' to the `removeUnwanted' function and switched arround the fixing/removing symbols and the checking with `unwantedRegExp'. I also added a `?' to the `unwantedRegExp' so that there is taken care of an only-scheme without trailing `:'.

Keep them coming..

 
bobielawlintine Scriptwright

I found something: if the numbers are following by a question mark like:

2.0.0.9?

Then it will be linkified.

 
Kim A. Brandt Script's Author

Bruno 'ReX' Barbieri, I agree that a IPv4 address *alone* is too common to be linkyfied, so I added it to the `unwantedRegExp'. If you/someone want it to be included the `unwantedRegExp' variable is the place to look.

Thanks

 
'ReX' Scriptwright

If you have version numbers for software, it recognise it as a link (IP):

Example:
* AnyDVD HD v6.1.9.5 [beta]
* CloneDVD v2.9.1.2
* CloneDVDmobile v1.1.5.4
* CloneCD v5.3.1.0
* Virtual CloneDrive v5.2.0.2
* Game Jackal Pro / Enterprise v2.9.18.600

 
Kim A. Brandt Script's Author

That message should show up after 2 and then after every 5 seconds to allow to stop executing the script. When I was testing the script I met sites (especially large *.txt) which would run for about 10-30 seconds. This is the best I could come up with. If there are other ways to do the same please let me know.

You can also change the maximum-time (run-time after which to ask the question, search for `var maxTime = 2.0'), multiplikator (increase the run-time, search for `const MULTI = 2.5') and the run-time-boundary (run-time after which the max-time will not be increased further, search for `if (maxTime < 5.0)').

 
bobielawlintine Scriptwright

I installed the latest update and I got this message when viewing the page for a userstyle:

http://i2.tinypic.com/6u8n890.png

Whats the message for?

 
bobielawlintine Scriptwright

Thanks again; its works great.

 
Kim A. Brandt Script's Author

bobielawlintine, that's because: see comment-20307.

But because it's interesting lets try the `linkify' approach..

I added some regular expression-stuff and now it can do what you asked for. There are some issues with the likify-way of doing things. We have to tell the script when we would like to transform an non-url. I choosed the cases when the host is an ip or the host has a valid top-level domain. The script may also become a little slower than before.

Another downside of the linkify-approach is that we now have to find all the `false positives' ;)

Cheers

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel