Your generous donation allows me to continue developing and updating my code!
jQuery Long Url uses the longurlplease.com short URL lengthening API to expand short URLs from at least 80 services, including bit.ly, is.gd, tinyurl.com and more!
And not only has jQuery Long Url been written to take advantage of the longurlplease.com API "batch" ability, where up to ten URLs can be lengthened per request, but it can optionally use any lengthening service, supporting any URL-per-request "batch" limitations, which minimizes the number of external requests made for faster performance.
Link info
These links' title should be lengthened, just hover over them (green border):
http://bit.ly/Uu2VH http://url.ie/4qns http://kl.am/NUl http://bacn.me/olo http://lost.in/rE http://kl.am/6wjT http://su.pr/A5aJ2t http://j.mp/56unIk http://tinyurl.com/ye5sqjy http://tinyurl.com/d2b3do http://bit.ly/JQcVw http://bit.ly/ERIjj http://url.ie/1ql1 http://url.ie/1ql2 http://lost.in/rE http://twurl.cc/14oo http://is.gd/14q66 http://tinyurl.com/d2b3do http://redir.ec/oL22 http://bit.ly/3zakxp http://bit.ly/405U87 http://bit.ly/ltzbx http://reallytinyurl.com/1600 http://twurl.cc/14oo http://kl.am/NUl http://is.gd/14q66 http://twurl.cc/14oo http://redir.ec/oL22 http://kl.am/6wjT http://bit.ly/3zakxp http://bacn.me/olo http://url.ie/1ql1 http://url.ie/1ql2 http://lost.in/rE http://twurl.cc/14oo http://url.ie/1ql2 http://reallytinyurl.com/1600
These aren't short urls (red border):
http://benalman.com/ http://google.com http://lmgtfy.com http://jquery.com/ http://cowboyscripts.org http://paulirish.com http://www.ajpiano.com http://www.longurlplease.com/ http://jqueryui.com/
These are relative, and should be skipped (grey border):
The code
$(function(){ // Select some A elements. $('#test a') // Set a default title attribute for these links. .attr( 'data-title', 'Not processed!' ) // By default, $('a').longUrl(); will updated the href and title attributes // for each selected A element, as long as its href was a short URL that // could be lengthened. In this example, we get a little more custom, in // order to show how flexible the plugin can be... .longUrl({ // Set the data-title HTML5 attribute as well as a class for each element // or group of elements that share the same href. callback: function( href, long_url ) { if ( long_url ) { this.attr({ 'data-title': 'Lengthened: ' + long_url }).addClass( 'expanded' ); } else { this.attr({ 'data-title': 'Not lengthened: ' + href }).addClass( 'not-expanded' ); } }, // When all fetching and processing is done, set the '#info' text to // something interesting. complete: function( result ) { var num_elements = this.length, num_unique = 0, num_lengthened = 0, num_not_lengthened = 0, text; $.each( result, function( href, long_url ){ num_unique++; long_url ? num_lengthened++ : num_not_lengthened++; }); text = 'Of ' + num_elements + ' elements, there were ' + num_unique + ' unique absolute links, ' + num_lengthened + ' of which could be lengthened, and ' + num_not_lengthened + ' of which could not.'; $('#info').text( text ); } }) // Show the title attribute on hover. .live( 'mouseover', function(e){ var title = $(this).attr( 'data-title' ); $('#info').text( title ); }); });