From cdf643c2a6f951aad8f36778b2d24dc3e7ff19b0 Mon Sep 17 00:00:00 2001 From: Ben Ubois Date: Fri, 20 Sep 2019 17:21:01 -0700 Subject: [PATCH] Make iFrames responsive. --- Mac/MainWindow/Detail/styleSheet.css | 14 ++++ .../Article Rendering/ArticleRenderer.swift | 72 +++++++------------ iOS/Resources/styleSheet.css | 14 ++++ 3 files changed, 53 insertions(+), 47 deletions(-) diff --git a/Mac/MainWindow/Detail/styleSheet.css b/Mac/MainWindow/Detail/styleSheet.css index 97ab0e019..107a7cb7e 100644 --- a/Mac/MainWindow/Detail/styleSheet.css +++ b/Mac/MainWindow/Detail/styleSheet.css @@ -133,6 +133,20 @@ figcaption { line-height: 1.3em; } +.iframeWrap { + position: relative; + display: block; + padding-top: 56.25%; +} + +.iframeWrap iframe { + position: absolute; + top: 0; + left: 0; + height: 100% !important; + width: 100% !important; +} + /*Block ads and junk*/ iframe[src*="feedads"], diff --git a/Shared/Article Rendering/ArticleRenderer.swift b/Shared/Article Rendering/ArticleRenderer.swift index 2fac026d9..b849ba206 100644 --- a/Shared/Article Rendering/ArticleRenderer.swift +++ b/Shared/Article Rendering/ArticleRenderer.swift @@ -312,8 +312,6 @@ private extension ArticleRenderer { return dateFormatter.string(from: date) } - #if os(macOS) - func renderHTML(withBody body: String) -> String { var s = "\n\n" @@ -326,18 +324,32 @@ private extension ArticleRenderer { s += """ - - """ - - s += "\n\n\n\n" - s += body - s += "\n\n" - - return s - - } - - #endif - } // MARK: - Article extension diff --git a/iOS/Resources/styleSheet.css b/iOS/Resources/styleSheet.css index f46b94deb..90c9b7647 100644 --- a/iOS/Resources/styleSheet.css +++ b/iOS/Resources/styleSheet.css @@ -136,6 +136,20 @@ figcaption { line-height: 1.3em; } +.iframeWrap { + position: relative; + display: block; + padding-top: 56.25%; +} + +.iframeWrap iframe { + position: absolute; + top: 0; + left: 0; + height: 100% !important; + width: 100% !important; +} + /*Block ads and junk*/ iframe[src*="feedads"],