This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // remove space at the front and the end. | |
| String.prototype.trim = function() { | |
| return this.replace(/^\s+|\s+$/g,""); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String.prototype.parseURL = function() { | |
| return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&~\?\/.=]+/g, function(url) { | |
| return url.link(url); | |
| }); | |
| }; | |
| // src : http://www.simonwhatley.co.uk/parsing-twitter-usernames-hashtags-and-urls-with-javascript |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String.prototype.parseUsername = function() { | |
| return this.replace(/[@]+[A-Za-z0-9-_]+/g, function(u) { | |
| var username = u.replace("@","") | |
| return u.link("http://twitter.com/"+username); | |
| }); | |
| }; | |
| // src : http://www.simonwhatley.co.uk/parsing-twitter-usernames-hashtags-and-urls-with-javascript |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String.prototype.parseHashtag = function() { | |
| return this.replace(/[#]+[A-Za-z0-9-_]+/g, function(t) { | |
| var tag = t.replace("#","%23") | |
| return t.link("http://search.twitter.com/search?q="+tag); | |
| }); | |
| }; | |
| // src : http://www.simonwhatley.co.uk/parsing-twitter-usernames-hashtags-and-urls-with-javascript |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('a[@rel$='external']').click(function(){ | |
| this.target = "_blank"; | |
| }); | |
| /* | |
| Usage: | |
| <a href="http://www.lepinskidesign.com.br/" rel="external">lepinskidesign.com.br</a> | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery.preloadImages = function() | |
| { | |
| for(var i = 0; i ").attr("src", arguments[i]); | |
| } | |
| }; | |
| // Usage | |
| $.preloadImages("image1.gif", "/path/to/image2.png", "some/image3.jpg"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('a[@rel$='external']').click(function(){ | |
| this.target = "_blank"; | |
| }); | |
| /* | |
| Usage: | |
| <a href="http://www.lepinskidesign.com.br/" rel="external">lepinskidesign.com.br</a> | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isDateValid(y,m,d){ | |
| var x=new Date(y,--m,d); | |
| return !isNaN(+x) && x.getFullYear() == y && x.getMonth() == m && x.getDate() == d; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <a href="tel:1-408-555-5555">1-408-555-5555</a> | |
| <a href="sms:1-408-555-1212">New SMS Message</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="papers"></div> | |
| // Source : http://jsfiddle.net/chriscoyier/8jmLY/2/ |