From 78030506662100236a2c1fa3f5022f7ae099fc76 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Wed, 2 Dec 2020 19:19:37 -0500 Subject: [PATCH] don't interfere with media controls (fixes philomena-dev/philomena#77) --- assets/js/image_expansion.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/assets/js/image_expansion.js b/assets/js/image_expansion.js index b0e4b318..abf7c595 100644 --- a/assets/js/image_expansion.js +++ b/assets/js/image_expansion.js @@ -160,13 +160,19 @@ function bindImageForClick(target) { function bindImageTarget() { const target = document.getElementById('image_target'); - if (target) { - pickAndResize(target); - bindImageForClick(target); - window.addEventListener('resize', () => { - pickAndResize(target); - }); + if (!target) return; + + pickAndResize(target); + + if (target.dataset.mimeType === 'video/webm') { + // Don't interfere with media controls on video + return; } + + bindImageForClick(target); + window.addEventListener('resize', () => { + pickAndResize(target); + }); } export { bindImageTarget };