[jQuery] replace string.prototype functions with jquery

2008-07-08 Thread seaofclouds

i made a very simple jquery plugin that displays your twitter status.
http://tweet.seaofclouds.com/ naturally, there is much work to be done
in the way of optimizing this plugin. first off, i have a few search
and replace functions, which i would like to replace with the jquery
equivilent.

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);
  });
};

any tips? tweet is on github if you'd like to contribute or keep up to
date. you can view the full source of the plugin at:
http://github.com/seaofclouds/tweet/tree/master%2Fjavascripts%2Fjquery.tweet.js?raw=true


[jQuery] Re: search and replace, updating string.prototype with jquery equivalent

2008-07-08 Thread seaofclouds

huh, it looks like i did post this question. no answers yet. anyone?

On Jul 7, 12:22 pm, seaofclouds <[EMAIL PROTECTED]> wrote:
> 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/


[jQuery] search and replace, updating string.prototype with jquery equivalent

2008-07-07 Thread seaofclouds

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/