From e1c8479515d3c85f7bfb835fcf04c9084fd5be66 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Tue, 7 Jul 2020 11:47:52 -0500 Subject: [PATCH] Prevent Twitter embeds from cutting off. Issue #2166 --- Shared/Article Rendering/main.js | 2 ++ iOS/Resources/styleSheet.css | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Shared/Article Rendering/main.js b/Shared/Article Rendering/main.js index a3476f422..23e9b90dd 100644 --- a/Shared/Article Rendering/main.js +++ b/Shared/Article Rendering/main.js @@ -1,6 +1,8 @@ // Here we are making iframes responsive. Particularly useful for inline Youtube videos. function wrapFrames() { document.querySelectorAll("iframe").forEach(element => { + if (element.height > 0 || parseInt(element.style.height) > 0) + return; var wrapper = document.createElement("div"); wrapper.classList.add("iframeWrap"); element.parentNode.insertBefore(wrapper, element); diff --git a/iOS/Resources/styleSheet.css b/iOS/Resources/styleSheet.css index 5f403c4de..f49743c11 100644 --- a/iOS/Resources/styleSheet.css +++ b/iOS/Resources/styleSheet.css @@ -192,12 +192,17 @@ code, pre { padding: 0; } -img, figure, iframe, div { +img, figure, div { max-width: 100%; height: auto !important; margin: 0 auto; } +iframe { + max-width: 100%; + margin: 0 auto; +} + figure { margin-bottom: 1em; margin-top: 1em;