From a4c576ef3360fd56a16572373f5c5b5ea04c014f Mon Sep 17 00:00:00 2001 From: jacr13 Date: Wed, 17 Nov 2021 13:22:08 +0100 Subject: [PATCH] fix styling for images tab (without view images option) --- app/filter.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/filter.py b/app/filter.py index 8fcec26..133ce7f 100644 --- a/app/filter.py +++ b/app/filter.py @@ -288,6 +288,26 @@ class Filter: except AttributeError: pass + # Fix body max with on images tab + style = soup.find('style') + div = soup.find('div', attrs={'class': "n692Zd"}) + if style and div and not self.mobile: + css = style.string + css_html_tag = ('html{' + 'font-family: Roboto, Helvetica Neue, Arial, sans-serif;' + 'font-size: 14px;' + 'line-height: 20px;' + 'text-size-adjust: 100%;' + 'color: #3c4043;' + 'word-wrap: break-word;' + 'background-color: #fff;' + '}') + css = f"{css_html_tag}{css}" + css = re.sub('body{(.*?)}', + 'body{padding:0 8px;margin: 0 auto;max-width: 736px;}', + css) + style.string = css + def update_link(self, link: Tag) -> None: """Update internal link paths with encrypted path, otherwise remove unnecessary redirects and/or marketing params from the url