# HG changeset patch # User hertzhaft # Date 1299963486 -3600 # Node ID ca2c022a9baaab843dfef84568161869d1bb8e42 # Parent a135f590275dfa5c6b5d88b7c7e63485a5fc0d55 keep title and alt attributes from HTML for scaler img diff -r a135f590275d -r ca2c022a9baa client/digitallibrary/jquery/jquery-test-embedded.html --- a/client/digitallibrary/jquery/jquery-test-embedded.html Sat Mar 12 21:22:15 2011 +0100 +++ b/client/digitallibrary/jquery/jquery-test-embedded.html Sat Mar 12 21:58:06 2011 +0100 @@ -85,7 +85,7 @@
- + testalt
diff -r a135f590275d -r ca2c022a9baa client/digitallibrary/jquery/jquery.digilib.js --- a/client/digitallibrary/jquery/jquery.digilib.js Sat Mar 12 21:22:15 2011 +0100 +++ b/client/digitallibrary/jquery/jquery.digilib.js Sat Mar 12 21:58:06 2011 +0100 @@ -980,14 +980,17 @@ scalerUrl = getScalerUrl(data); $img = $elem.find('img'); if ($img.length > 0) { - //oldUrl = $img.attr('src'); - //if (oldUrl === scalerUrl) { - // console.debug("img detach:", $img); - // $img.detach(); - //} else { - // $img = $(''); - // keep title, alt etc. attributes (src gets changed anyway) - $img.detach(); + var oldUrl = $img.attr('src'); + // keep img attributes from html + var title = $img.attr('title'); + var alt = $img.attr('alt'); + if (oldUrl === scalerUrl) { + console.debug("img detach:", $img); + $img.detach(); + } else { + $img = $(''); + $img.attr("title", title); + $img.attr("alt", alt); } } else { $img = $('');