diff --git a/Docs/Tweetify.md b/Docs/Tweetify.md index e69de29..1de91d5 100644 --- a/Docs/Tweetify.md +++ b/Docs/Tweetify.md @@ -0,0 +1,13 @@ +Element: Element.Tweetify {#Element} +===================================== + +Tweetify extends Strings and Elements with the tweetify method to take text and format as a tweet. + + +### Syntax: + + var tweeted = myString.tweetify(); + +### Arguments: + +None \ No newline at end of file diff --git a/README.md b/README.md index e69de29..ffabf37 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,21 @@ +Tweetify +========= + +Tweetify extends Strings and Elements with the tweetify method to take text and format as a tweet. + +![Screenshot](http://davidwalsh.name/wp-content/themes/walshbook3/images/twitter.png) + + +How to Use +---------- + +The tweetify method may be used on either String or Element types. + + #JS + //Usage 1: String + var tweetText = tweets[0].tweetify(); + + //Usage 2: Element + $('latestTweet').tweetify(); + +For specific usage and options, please read the documentation or visit [http://davidwalsh.name/tweetify](http://davidwalsh.name/tweetify) \ No newline at end of file diff --git a/Source/Tweetify-yui-compressed.js b/Source/Tweetify-yui-compressed.js index 4297eeb..9bed2d3 100644 --- a/Source/Tweetify-yui-compressed.js +++ b/Source/Tweetify-yui-compressed.js @@ -16,4 +16,4 @@ provides: - String.tweetify ... */ -(function(){var a=function(){return this.replace(/(https?:\/\/\S+)/gi,'$1').replace(/(^|\s)@(\w+)/g,'$1@$2').replace(/(^|\s)#(\w+)/g,'$1#$2');};String.implement({tweetify:a});Element.implement({tweetify:a.bind(this.get("text"))});})(); \ No newline at end of file +(function(){var a=function(){return this.replace(/(https?:\/\/\S+)/gi,'$1').replace(/(^|\s)@(\w+)/g,'$1@$2').replace(/(^|\s)#(\w+)/g,'$1#$2');};String.implement({tweetify:a});Element.implement({tweetify:function(){this.set("text",a.bind(this.get("text")).attempt());}});})(); \ No newline at end of file diff --git a/Source/Tweetify.js b/Source/Tweetify.js index 7c8d73a..cc212c2 100644 --- a/Source/Tweetify.js +++ b/Source/Tweetify.js @@ -24,6 +24,8 @@ provides: tweetify: fn }); Element.implement({ - tweetify: fn.bind(this.get('text')) + tweetify: function() { + this.set('text',fn.bind(this.get('text')).attempt()); + } }); })(); \ No newline at end of file