From 8e8ec225bd217087f3b9905fd8dd2f994235f7ef Mon Sep 17 00:00:00 2001 From: undido Date: Thu, 25 Sep 2014 16:28:08 -0300 Subject: [PATCH] Handle videowidth and height the same as image height and width --- js/image-hover.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/image-hover.js b/js/image-hover.js index 77bc3490..a8b23dc6 100644 --- a/js/image-hover.js +++ b/js/image-hover.js @@ -52,8 +52,11 @@ widStyle = "max-width:" + maxWidth + "px;"; heiStyle = ((maxHeight < imageHeight) ? "height:"+maxHeight+"px;":""); $imgH = $("", {"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 = $("