From 9af7422d5270447dcf81b5216c97582ad6ebcf18 Mon Sep 17 00:00:00 2001 From: Jonathan Winter <14960780+jhwinter@users.noreply.github.com> Date: Thu, 28 Oct 2021 13:09:02 -0400 Subject: Fix for Instagram Dark Mode (#358) Co-authored-by: mhatvan --- recipes/instagram/package.json | 2 +- recipes/instagram/webview.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'recipes') diff --git a/recipes/instagram/package.json b/recipes/instagram/package.json index f804a11..a321b47 100644 --- a/recipes/instagram/package.json +++ b/recipes/instagram/package.json @@ -1,7 +1,7 @@ { "id": "instagram", "name": "Instagram", - "version": "2.2.2", + "version": "2.2.3", "license": "MIT", "config": { "serviceURL": "https://instagram.com/direct/inbox", diff --git a/recipes/instagram/webview.js b/recipes/instagram/webview.js index 797f544..1fb253d 100644 --- a/recipes/instagram/webview.js +++ b/recipes/instagram/webview.js @@ -12,5 +12,19 @@ module.exports = Ferdi => { Ferdi.loop(getMessages); + // https://github.com/getferdi/recipes/blob/9d715597a600710c20f75412d3dcd8cdb7b3c39e/docs/frontend_api.md#usage-4 + // Helper that activates DarkReader and injects your darkmode.css at the same time + Ferdi.handleDarkMode((isEnabled, helpers) => { + if (isEnabled) { + helpers.enableDarkMode(); + if (!helpers.isDarkModeStyleInjected()) { + helpers.injectDarkModeStyle(); + } + } else { + helpers.disableDarkMode(); + helpers.removeDarkModeStyle(); + } + }); + Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); }; -- cgit v1.2.3-54-g00ecf