public
Last active

jQuery Pluginization (see comment for slide order)

  • Download Gist
jquery-pluginization.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12
function longUrl( elem ) {
var href = elem.attr( 'href' ),
api = 'http://www.longurlplease.com/api/v1.1?callback=?';
// Fetch JSON data.
jQuery.getJSON( api, { q: href }, function(data){
if ( data[ href ] ) {
// Update the element's title attribute.
elem.attr( 'title', data[ href ] );
}
});
};

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.