Skip to content
Snippets Groups Projects
Commit eea5e739 authored by juanf's avatar juanf
Browse files

Image loading bugfix for Safari.

SVN: 32385
parent 9f11d7c2
No related branches found
No related tags found
No related merge requests found
...@@ -179,61 +179,60 @@ var Util = new function() { ...@@ -179,61 +179,60 @@ var Util = new function() {
this.showImage = function(imageURL) { this.showImage = function(imageURL) {
var $image = $("<img>", {"src" : imageURL}); var $image = $("<img>", {"src" : imageURL});
$image.load(function() {
var containerWidth = $(window).width()*0.85; var containerWidth = $(window).width()*0.85;
var containerHeight = $(window).height()*0.85; var containerHeight = $(window).height()*0.85;
var imageWidth = $image[0].width;
var imageHeight = $image[0].height;
if(containerWidth < imageWidth) {
var newImageWidth = containerWidth;
var newImageHeight = imageHeight * newImageWidth / imageWidth;
imageWidth = newImageWidth; var imageWidth = $image[0].width;
imageHeight = newImageHeight; var imageHeight = $image[0].height;
}
if(containerHeight < imageHeight) {
var newImageHeight = containerHeight;
var newImageWidth = imageWidth * newImageHeight / imageHeight;
imageWidth = newImageWidth; if(containerWidth < imageWidth) {
imageHeight = newImageHeight; var newImageWidth = containerWidth;
} var newImageHeight = imageHeight * newImageWidth / imageWidth;
$image.attr("width", imageWidth); imageWidth = newImageWidth;
$image.attr("height", imageHeight); imageHeight = newImageHeight;
}
var $imageWrapper = $("<div>", {"style" : "margin:10px"}); if(containerHeight < imageHeight) {
$imageWrapper.append($image); var newImageHeight = containerHeight;
var newImageWidth = imageWidth * newImageHeight / imageHeight;
var imageHTML = $imageWrapper[0].outerHTML;
var isiPad = navigator.userAgent.match(/iPad/i) != null; imageWidth = newImageWidth;
if(!isiPad) { imageHeight = newImageHeight;
imageHTML = "<div style='text-align:right;'><a class='btn btn-default'><span class='glyphicon glyphicon-remove'></span></a></div>" + imageHTML; }
}
$image.attr("width", imageWidth);
this.blockUINoMessage(); $image.attr("height", imageHeight);
var localReference = this;
jNotifyImage(
imageHTML, var $imageWrapper = $("<div>", {"style" : "margin:10px"});
{ $imageWrapper.append($image);
autoHide : isiPad,
clickOverlay : false, var imageHTML = $imageWrapper[0].outerHTML;
MinWidth : 250, var isiPad = navigator.userAgent.match(/iPad/i) != null;
TimeShown : 2000, if(!isiPad) {
ShowTimeEffect : 200, imageHTML = "<div style='text-align:right;'><a class='btn btn-default'><span class='glyphicon glyphicon-remove'></span></a></div>" + imageHTML;
HideTimeEffect : 200, }
LongTrip :20,
HorizontalPosition : 'center', Util.blockUINoMessage();
VerticalPosition : 'center', jNotifyImage(imageHTML,
ShowOverlay : false, {
ColorOverlay : '#000', autoHide : isiPad,
OpacityOverlay : 0.3, clickOverlay : false,
onClosed : function(){ localReference.unblockUI(); }, MinWidth : 250,
onCompleted : function(){ } TimeShown : 2000,
ShowTimeEffect : 200,
HideTimeEffect : 200,
LongTrip :20,
HorizontalPosition : 'center',
VerticalPosition : 'center',
ShowOverlay : false,
ColorOverlay : '#000',
OpacityOverlay : 0.3,
onClosed : function(){ Util.unblockUI(); },
onCompleted : function(){ }
});
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment