1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-25 07:50:23 +01:00

Handle videowidth and height the same as image height and width

This commit is contained in:
undido 2014-09-25 16:28:08 -03:00
parent e20d79270f
commit 8e8ec225bd

View File

@ -52,8 +52,11 @@ widStyle = "max-width:" + maxWidth + "px;";
heiStyle = ((maxHeight < imageHeight) ? "height:"+maxHeight+"px;":"");
$imgH = $("<img/>", {"src":$(this).parent().attr("href"), "style":stylez + ((imageWidth > maxWidth) ? widStyle:"")+heiStyle, "id":"hover-image"});
} else {
videoWidth = parseInt($(this).parent().parent().find(".unimportant").text().split(",")[1].split("x")[0]);
videoHeight = parseInt($(this).parent().parent().find(".unimportant").text().split(",")[1].split("x")[1]);
fileInfo = $(this).parent().parent().children(".fileinfo").children(".unimportant").text();
isSpoiler = (fileInfo.indexOf("Spoiler") > -1) ? true:false;
imageD = ((isSpoiler) ? fileInfo.split(",")[2]:fileInfo.split(",")[1]);
videoWidth = parseInt(imageD.split("x")[0]);
videoHeight = parseInt(imageD.split("x")[1]);
widStyle = "width:" + ((maxWidth > videoWidth) ? videoWidth:maxWidth) + "px;" + "height:" + ((maxHeight < videoHeight) ? "100%": videoHeight+"px;");
$imgH = $("<iframe/>", {"src":$(this).parent().attr("href"), "style":stylez + widStyle, "id":"hover-image"});