Change the inline image code so that elements is all links (elements[i].href) then use a case statement to do the right thing per type.
// Display Image Links Inline
var elements = document.querySelectorAll('a[href$=".png"], a[href$=".jpg"], a[href$=".gif"]'),
l = elements.length, i, current;
for(i=0; i<l; i++) {
current = elements[i];
var href = current.getAttribute('href');
current.innerHTML = '<img width="100" src="' + href + '" >';
}
Change the inline image code so that elements is all links (elements[i].href) then use a case statement to do the right thing per type.