tot - Check-in [39]
Not logged in
[Browse]  [Home]  [Login]  [Reports]  [Search]  [Timeline
  [Patchset
Check-in Number: 39
Date: 2008-Feb-05 20:15:55 (local)
2008-Feb-05 19:15:55 (UTC)
User:rse
Branch:
Comment: second attempt in making the matching more precise
Tickets:
Inspections:
Files:
jquery/jquery.extlink.html      21 -> 39
jquery/jquery.extlink.js      38 -> 39
Modified: jquery/jquery.extlink.html
===================================================================
--- jquery/jquery.extlink.html	2008-02-04 20:36:26 UTC (rev 38)
+++ jquery/jquery.extlink.html	2008-02-05 19:15:55 UTC (rev 39)
@@ -19,7 +19,10 @@
         <a href="http:bar.html">http:bar.html</a>
         <a href="http://www.example.com/">http://www.example.com</a>
         <a href="foo.html">foo.html</a>
-        <a href="http:bar.html">http:bar.html</a>
-        <a href="http://www.example.com/">http://www.example.com</a>
+        <a href="https:bar.html">https:bar.html</a>
+        <a href="https://www.example.com/">https://www.example.com</a>
+        <a href="ftp://ftp.example.com/">ftp://ftp.example.com</a>
+        <a name="foo">foo</a>
+        <a name="bar">bar</a>
     </body>
 </html>

Modified: jquery/jquery.extlink.js
===================================================================
--- jquery/jquery.extlink.js	2008-02-04 20:36:26 UTC (rev 38)
+++ jquery/jquery.extlink.js	2008-02-05 19:15:55 UTC (rev 39)
@@ -1,6 +1,6 @@
 /*
 **  jquery.extlink.js -- jQuery plugin for external link annotation
-**  Copyright (c) 2007 Ralf S. Engelschall <rse@engelschall.com> 
+**  Copyright (c) 2007-2008 Ralf S. Engelschall <rse@engelschall.com> 
 **  Licensed under GPL <http://www.gnu.org/licenses/gpl.txt>
 **
 **  $LastChangedDate$
@@ -13,12 +13,16 @@
             if (typeof color === "undefined")
                 color = "grey";
             var site = String(document.location)
-                .replace(/^(https?:\/\/[^:\/]+).*$/, "$1");
+                .replace(/^(https?:\/\/[^:\/]+).*$/, "$1")
+                .replace(/^((site)?(file:\/\/.+\/))[^\/]+$/, "$3")
+                .replace(/(\\.)/g, "\\$1");
             $("a", this).filter(function (i) {
+                var href = $(this).attr("href");
+                if (href == null)
+                    return false;
                 return (
-                      $(this).attr("href")
-                    ? ($(this).attr("href").match(RegExp("^("+site+"|(https?:)?/)")) != null)
-                    : false
+                       href.match(RegExp("^("+site+"|(https?:)?/[^/])")) == null
+                    && href.match(RegExp("^(https?|ftp)://.+")) != null
                 );
             }).each(function () {
                 $(this)