问题跟踪附件图片显示不拉伸
This commit is contained in:
parent
33fc193e65
commit
538ba33174
|
@ -1,23 +1,49 @@
|
|||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded',function(){
|
||||
var img = document.getElementsByName('issue_attachment_picture');
|
||||
function getImgNaturalStyle(img,callback) {
|
||||
var nWidth, nHeight
|
||||
if (typeof img.naturalWidth == "undefined"|| img.naturalWidth == 0) { // 现代浏览器
|
||||
|
||||
|
||||
function getImgNaturalStyle(img, callback) {
|
||||
var nWidth, nHeight;
|
||||
if (typeof img.naturalWidth == "undefined"|| img.naturalWidth == 0) {
|
||||
var image = new Image();
|
||||
image.src = img.src;
|
||||
nWidth = image.width;
|
||||
nHeight = image.height;
|
||||
} else {
|
||||
nWidth = img.naturalWidth;
|
||||
nHeight = img.naturalHeight;
|
||||
if (image.complete) {
|
||||
callback(image);
|
||||
} else {
|
||||
image.onload = function () {
|
||||
callback(image);
|
||||
image.onload = null;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
return [nWidth, nHeight]
|
||||
else
|
||||
{
|
||||
if (img.complete) {
|
||||
nWidth = img.naturalWidth;
|
||||
nHeight = img.naturalHeight;
|
||||
} else {
|
||||
img.onload = function () {
|
||||
nWidth = img.naturalWidth;
|
||||
nHeight = img.naturalHeight;
|
||||
image.onload = null;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
return [nWidth, nHeight];
|
||||
}
|
||||
|
||||
|
||||
function UpdateImageInformation(image) {
|
||||
return [image.width,image.height];
|
||||
}
|
||||
|
||||
|
||||
for(i=0;i<img.length;i++)
|
||||
{
|
||||
imgNatural = getImgNaturalStyle(img[i]);
|
||||
imgNatural = getImgNaturalStyle(img[i],UpdateImageInformation);
|
||||
var width = imgNatural[0];
|
||||
var height = imgNatural[1];
|
||||
if (width<100)
|
||||
|
@ -29,7 +55,10 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<div class="attachments" style="font-weight:normal;">
|
||||
<% is_float ||= false %>
|
||||
<% for attachment in attachments %>
|
||||
|
|
Loading…
Reference in New Issue