http://www.foo.is
http://www.foo.is/ asdf
http://www.foo.is:8080. asd
+http://www.foo.is:8080. asd (http://www.foo.is/#foo)...
http://www.foo.is:8080/path/?foo=1#arg #asdasdf
http://www.foo.is/#foo ?asddf
should I visit http://www.foo.is/? Sure
@@ -157,6 +160,9 @@http://www.foo.is
+blah http://www.foo.is @username blah
+blah <http://www.foo.is/> blah #hashtag blah
+blah (http://www.foo.is/) (#hashtag) blah
@username
blah @username blah
(@username)
diff --git a/1.0/jquery.linkify-1.0.js b/1.0/jquery.linkify-1.0.js index e451f4e..916fc41 100644 --- a/1.0/jquery.linkify-1.0.js +++ b/1.0/jquery.linkify-1.0.js @@ -55,6 +55,13 @@ var noProtocolUrl = /(^|["'(]|<|\s)(www\..+?\..+?)(([:?]|\.+)?(\s|$)|>|[)"',])/g, httpOrMailtoUrl = /(^|["'(]|<|\s)(((https?|ftp):\/\/|mailto:).+?)(([:?]|\.+)?(\s|$)|>|[)"',])/g, + linkifier = function ( html ) { + return html + .replace( noProtocolUrl, '$1$2$3' ) // NOTE: we escape `"http` as `"<``>` to make sure `httpOrMailtoUrl` below doesn't find it as a false-positive + .replace( httpOrMailtoUrl, '$1$2$5' ) + .replace( /"<``>/g, '"http' ); // reinsert `"http` + }, + linkify = $.fn.linkify = function ( cfg ) { cfg = cfg || {}; @@ -63,17 +70,30 @@ cfg = { use:cfg }; } var use = cfg.use, - plugins = linkify.plugins||{}; + allPlugins = linkify.plugins || {}, + plugins = [linkifier], + tmpCont; if ( use ) { use = $.isArray( use ) ? use : $.trim(use).split( / *, */ ); - var pluginShortlist = {}; - for ( var i=0, l=use.length, name; i