# HG changeset patch # User hertzhaft # Date 1299963486 -3600 # Node ID 80cc227c1d504d9d139cd64f0a7c87839252dd93 # Parent 44ee29f20791e13bf4d933a50c313eac461ea5da keep title and alt attributes from HTML for scaler img diff -r 44ee29f20791 -r 80cc227c1d50 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 44ee29f20791 -r 80cc227c1d50 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 = $('');