summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorccd0 <admin@containerchan.org>2013-11-16 10:30:04 -0800
committerccd0 <admin@containerchan.org>2013-11-16 10:30:04 -0800
commit1690392132719d6c898363af6541ec8dc6332172 (patch)
tree071bde2a5e2a5b8662afa20f83f178e144a66ec0
parent7de58faa21d7071f91e3eea47452d150d7a7bfc6 (diff)
fix expanded video size issue in Opera
-rw-r--r--expandvideo.js32
1 files changed, 18 insertions, 14 deletions
diff --git a/expandvideo.js b/expandvideo.js
index 4e94a007..88689396 100644
--- a/expandvideo.js
+++ b/expandvideo.js
@@ -14,6 +14,8 @@ function setupVideo(thumb, url) {
if (video.pause) video.pause();
videoContainer.style.display = "none";
thumb.style.display = "inline";
+ video.style.maxWidth = "inherit";
+ video.style.maxHeight = "inherit";
}
}
@@ -21,7 +23,9 @@ function setupVideo(thumb, url) {
if (hovering) {
hovering = false;
if (video.pause) video.pause();
- video.style.display = "none";
+ videoContainer.style.display = "none";
+ video.style.maxWidth = "inherit";
+ video.style.maxHeight = "inherit";
}
}
@@ -42,6 +46,7 @@ function setupVideo(thumb, url) {
videoContainer = document.createElement("div");
videoContainer.style.paddingLeft = "15px";
+ videoContainer.style.display = "none";
videoContainer.appendChild(videoHide);
videoContainer.appendChild(video);
thumb.parentNode.insertBefore(videoContainer, thumb.nextSibling);
@@ -65,13 +70,6 @@ function setupVideo(thumb, url) {
}
}
- function scrollToVideo() {
- var bottom = video.getBoundingClientRect().bottom;
- if (bottom > window.innerHeight) {
- window.scrollBy(0, bottom - window.innerHeight);
- }
- }
-
thumb.addEventListener("click", function(e) {
if (setting("videoexpand") && !e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
getVideo();
@@ -79,10 +77,7 @@ function setupVideo(thumb, url) {
hovering = false;
video.style.position = "static";
- video.style.maxWidth = "100%";
- video.style.maxHeight = window.innerHeight + "px";
- video.style.pointerEvents = "auto";
-
+ video.style.pointerEvents = "inherit";
video.style.display = "inline";
videoHide.style.display = "inline";
videoContainer.style.display = "block";
@@ -92,15 +87,24 @@ function setupVideo(thumb, url) {
video.muted = setting("videomuted");
video.controls = true;
if (video.readyState == 0) {
- video.addEventListener("loadedmetadata", scrollToVideo, false);
+ video.addEventListener("loadedmetadata", expand2, false);
} else {
- scrollToVideo();
+ setTimeout(expand2, 0);
}
video.play();
e.preventDefault();
}
}, false);
+ function expand2() {
+ video.style.maxWidth = "100%";
+ video.style.maxHeight = window.innerHeight + "px";
+ var bottom = video.getBoundingClientRect().bottom;
+ if (bottom > window.innerHeight) {
+ window.scrollBy(0, bottom - window.innerHeight);
+ }
+ }
+
thumb.addEventListener("mouseover", function(e) {
if (setting("videohover")) {
getVideo();