Skip to content

Instantly share code, notes, and snippets.

@adrianrodriguez
Created June 17, 2013 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrianrodriguez/5800805 to your computer and use it in GitHub Desktop.
Save adrianrodriguez/5800805 to your computer and use it in GitHub Desktop.
physicians.js
$('li.physician').each(function(){
var web = $(this).children('.physician_web').text();
var shortText = jQuery.trim(web).substring(0, 50)
.trim(this) + "...";
var address = $(this).children('.physician_address').text();
address = address.replace(/\s{2,}/g, ' ');
address = address.replace(/ /g, '+');
$(this).children('.physician_web').attr('href', 'http://' + web);
$(this).children('.physician_address').attr('href', 'http://maps.google.com/maps?q=' + address);
if (web.length > 49) {
$(this).children('.physician_web').text(shortText);
}else if (web.length < 1) {
$(this).children('.physician_web').parent().children().hide();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment