From fcea33d61f73798a11b25f2414026df723087bb2 Mon Sep 17 00:00:00 2001 From: Nate Weaver Date: Mon, 30 Dec 2019 18:30:10 -0600 Subject: [PATCH 1/2] Only strip out color, background, and font css properties Prevents icon images from rendering super-huge. --- Shared/Article Rendering/main.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Shared/Article Rendering/main.js b/Shared/Article Rendering/main.js index 4ecf8eb5f..78e01f8f0 100644 --- a/Shared/Article Rendering/main.js +++ b/Shared/Article Rendering/main.js @@ -8,10 +8,18 @@ function wrapFrames() { }); } -// Strip out all styling so that we have better control over layout +// Strip out color and font styling + +function stripStylesFromElement(element, propertiesToStrip) { + for (name of propertiesToStrip) { + element.style.removeProperty(name); + } +} + function stripStyles() { document.getElementsByTagName("body")[0].querySelectorAll("style, link[rel=stylesheet]").forEach(element => element.remove()); - document.getElementsByTagName("body")[0].querySelectorAll("[style]").forEach(element => element.removeAttribute("style")); + // Removing "background" and "font" will also remove properties that would be reflected in them, e.g., "background-color" and "font-family" + document.getElementsByTagName("body")[0].querySelectorAll("[style]").forEach(element => stripStylesFromElement(element, ["color", "background", "font"])); } // Convert all image locations to be absolute From fa6c21f4701f2bbdd1264c13740280ca7cee14ba Mon Sep 17 00:00:00 2001 From: Nate Weaver Date: Mon, 30 Dec 2019 18:30:21 -0600 Subject: [PATCH 2/2] Remove .wp-smiley rule --- iOS/Resources/styleSheet.css | 6 ------ 1 file changed, 6 deletions(-) diff --git a/iOS/Resources/styleSheet.css b/iOS/Resources/styleSheet.css index b90edd69e..b8f43e914 100644 --- a/iOS/Resources/styleSheet.css +++ b/iOS/Resources/styleSheet.css @@ -221,12 +221,6 @@ img[src*="share-buttons"] { display: none !important; } -/* Site specific styles */ -.wp-smiley { - height: 1em; - max-height: 1em; -} - /* Newsfoot specific styles. Structural styles come first, theme styles second */ .newsfoot-footnote-container { position: relative;