From 5f95bf3e3cc5d93aba52d5efcc474fcfdc0c9ea6 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 6 Apr 2014 19:17:58 -0700 Subject: [PATCH] using el.videoHeight here does help The whole thing appears to be a hack, though; we should really be using the image dimensions from the file info. --- builds/4chan-X.user.js | 8 ++++++-- builds/crx/script.js | 8 ++++++-- src/Images/ImageExpand.coffee | 2 +- src/Images/ImageHover.coffee | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 8c59bf3e0..21042d562 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -7719,7 +7719,9 @@ $.after(position, el); } return $.asap((function() { - return isVideo || el.naturalHeight; + if (isVideo) { + return el.videoHeight || el.naturalHeight; + } }), function() { return ImageExpand.completeExpand(post); }); @@ -7967,7 +7969,9 @@ latestEvent: e, endEvents: 'mouseout click', asapTest: function() { - return isVideo || el.naturalHeight; + if (isVideo) { + return el.videoHeight || el.naturalHeight; + } }, noRemove: true, cb: function() { diff --git a/builds/crx/script.js b/builds/crx/script.js index 2886e3b33..a8a3aa1ca 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -7738,7 +7738,9 @@ $.after(position, el); } return $.asap((function() { - return isVideo || el.naturalHeight; + if (isVideo) { + return el.videoHeight || el.naturalHeight; + } }), function() { return ImageExpand.completeExpand(post); }); @@ -7975,7 +7977,9 @@ latestEvent: e, endEvents: 'mouseout click', asapTest: function() { - return isVideo || el.naturalHeight; + if (isVideo) { + return el.videoHeight || el.naturalHeight; + } }, noRemove: true, cb: function() { diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index 027477a4f..6d8c97fd3 100755 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -117,7 +117,7 @@ ImageExpand = el.src = src or post.file.URL position = if isVideo and Conf['Show Controls'] then thumb.parentNode else thumb $.after position, el unless el is position.nextSibling - $.asap (-> isVideo or el.naturalHeight), -> + $.asap (-> if isVideo then el.videoHeight or el.naturalHeight), -> ImageExpand.completeExpand post completeExpand: (post) -> diff --git a/src/Images/ImageHover.coffee b/src/Images/ImageHover.coffee index 9a3fe73ed..488f06795 100755 --- a/src/Images/ImageHover.coffee +++ b/src/Images/ImageHover.coffee @@ -37,7 +37,7 @@ ImageHover = el: el latestEvent: e endEvents: 'mouseout click' - asapTest: -> (isVideo or el.naturalHeight) + asapTest: -> (if isVideo then el.videoHeight or el.naturalHeight) noRemove: true cb: -> if isVideo