I'm using "Linkify" to add links to static text... This is what I'm using:
https://github.com/maranomynet/linkify/blob/master/1.0/jquery.linkify-1.0.js
I would like to add a <wbr>
(word break) after 15 characters, and a …
after 30 or so... (if the link is <30 chars, don't add the …)
So, the link would be something like: https://github.com/mara<wbr></wbr>nomynet/linkify…
I suppose I have to work with the var "$2" in that jquery.linkify-1.0.js, but I'm a little confused on how to do it...
Any clue?
Thanks!
I don't pretend to be a JavaScript/jQuery master, but here's what I came up with that appears to work. If someone has a better method of performing some of the functions, I'm all ears -- I'm more of a C# guy, so Javascript/jQuery is a weak link I'm trying to improve on.
Step 1: Put this piece of code somewhere that the linkify plugin can read it (I put it in the linkify file).
Step 2: Alter the linkify function. Replace this:
With this:
I've tested a few variations of code blocks and they all appear to work, so let me know if you run into an example that doesn't work.