changeset 25:987ff147ea02

Added author-filter code to strip out email addresses from author names.
author Atul Varma <varmaa@toolness.com>
date Mon, 02 Mar 2009 21:14:09 -0800
parents e2f22495cb35
children 0ea70c7a4591
files about-mozilla.js
diffstat 1 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/about-mozilla.js	Mon Mar 02 20:46:19 2009 -0800
+++ b/about-mozilla.js	Mon Mar 02 21:14:09 2009 -0800
@@ -7,8 +7,23 @@
                    '<span class="author"></span></div>');
       $('.title', item).html(this.title);
       $('.title', item).wrap('<a href="' + this.link + '"></a>');
-      if (this.author)
-        $('.author', item).html('by ' + this.author);
+      if (this.author) {
+        var author = this.author;
+        var authorFilters = [
+            // Filter out e.g. "Robert Jones <robert@jones.com>"
+            /(.+)\s+&lt;.+&gt;/,
+            // Filter out e.g. "rob...@jones.com (Robert Jones)"
+            /.+\.\.\.@.+\s+\((.+)\)/
+        ];
+        jQuery.each(
+          authorFilters,
+          function() {
+            var match = author.match(this);
+            if (match)
+              author = match[1];
+          });
+        $('.author', item).html('by ' + author);
+      }
       $(item).attr("published", this.publishedDate);
       content.append(item);
     });