i've got the following code in my jquery plugin, tweet, which pulls in
twitter updates unobtrusively. admittedly, it's a little cumbersome,
but it does the job. now that it works, i'd like to streamline it,
making it more jquery friendly.

String.prototype.linkify = function() {
  return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?
\/.=]+/, function(m) {
  return m.link(m);
  });
};
String.prototype.linkuser = function() {
  return this.replace(/[EMAIL PROTECTED]/, function(u) {
    var username = u.replace("@","")
    return u.link("http://twitter.com/"+username);
  });
};
String.prototype.linktag = function() {
  return this.replace(/[#]+[A-Za-z0-9-_]+/, function(t) {
    var tag = t.replace("#","%23")
    return t.link("http://summize.com/search?q="+tag);
  });
};

you can see the full plugin at: http://tweet.seaofclouds.com/ and if
you like, contribute at: http://github.com/seaofclouds/tweet/

Reply via email to