Skip to content

Instantly share code, notes, and snippets.

@makepanic
Created January 9, 2013 16:11
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 makepanic/4494373 to your computer and use it in GitHub Desktop.
Save makepanic/4494373 to your computer and use it in GitHub Desktop.
nycsubway.org Historical_Maps inline images
$('#mw-content-text a').each(function(index, value){
var href = value.href,
gif = 'gif',
jpg = 'jpg',
base = 'http://images.nycsubway.org/',
isImage = false;
if(href.indexOf(gif, href.length - gif.length) !== -1 ||
href.indexOf(jpg, href.length - jpg.length) !== -1){
isImage = true;
}
if(isImage){
var s = '?/img/',
iurl = base + href.substring(href.indexOf(s) + s.length);
$(value).html('<img style="max-width:90%" src="'+iurl+'" alt="'+iurl+'" />');
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment