From e6578598fa4646ccff97fa294b21d393baef4d52 Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Wed, 18 Mar 2020 20:33:42 +0800 Subject: [PATCH] Make telegram not flash in dark mode. --- core/browser.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/browser.py b/core/browser.py index 7635c6b..d6810dc 100644 --- a/core/browser.py +++ b/core/browser.py @@ -459,11 +459,14 @@ class BrowserBuffer(Buffer): self.request_url = url.toString() # Emacs-china forum thread don't need draw background that avoid flash. - if self.dark_mode_is_enable() and self.current_url.startswith("https://emacs-china.org/t/") and self.request_url.startswith("https://emacs-china.org/t/"): - current_urls = self.current_url.rsplit("/", 1) - request_urls = self.request_url.rsplit("/", 1) + if self.dark_mode_is_enable(): + if self.current_url.startswith("https://emacs-china.org/t/") and self.request_url.startswith("https://emacs-china.org/t/"): + current_urls = self.current_url.rsplit("/", 1) + request_urls = self.request_url.rsplit("/", 1) - self.no_need_draw_background = current_urls[0] == request_urls[0] or self.request_url == current_urls[0] + self.no_need_draw_background = current_urls[0] == request_urls[0] or self.request_url == current_urls[0] + elif self.current_url.startswith("https://web.telegram.org") and self.request_url.startswith("https://web.telegram.org"): + self.no_need_draw_background = True def dark_mode_is_enable(self): module_name = self.module_path.split(".")[1]