diff options
author | Bennett <hello@vantezzen.io> | 2020-09-22 20:56:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-22 19:56:48 +0100 |
commit | 6f5e4a00588aefdda7a5a1cfe70935870e7e234a (patch) | |
tree | 9e29aa7aa0620a1a4a968ff8739b4b8ba96791a9 /uncompressed/reddit/webview.js | |
parent | Updated logos for Outlook/OWA (diff) | |
download | ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.tar.gz ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.tar.zst ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.zip |
Unpack recipes and update recipes icons (#292)
Co-authored-by: Amine Mouafik <amine@mouafik.fr>
Diffstat (limited to 'uncompressed/reddit/webview.js')
-rw-r--r-- | uncompressed/reddit/webview.js | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/uncompressed/reddit/webview.js b/uncompressed/reddit/webview.js deleted file mode 100644 index df5b929..0000000 --- a/uncompressed/reddit/webview.js +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | var _path = _interopRequireDefault(require("path")); | ||
2 | |||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
4 | |||
5 | module.exports = (Franz) => { | ||
6 | const getMessages = function getMessages() { | ||
7 | const elements = document.querySelectorAll('#HeaderUserActions--Messages > a > span'); | ||
8 | let count = 0 | ||
9 | |||
10 | if (elements[0]) { | ||
11 | count = parseInt(elements[0].innerHTML, 10); | ||
12 | } | ||
13 | |||
14 | console.log(count) | ||
15 | Franz.setBadge(count) | ||
16 | } | ||
17 | |||
18 | if (document.querySelectorAll('.promotedlink').length > 0) { | ||
19 | document.querySelectorAll('.promotedlink').forEach((sponsoredLink) => { | ||
20 | sponsoredLink.parentElement.parentElement.style.display = 'none' | ||
21 | }) | ||
22 | } | ||
23 | |||
24 | Franz.loop(getMessages) | ||
25 | |||
26 | // Use CSS to hide Google Ads | ||
27 | Franz.injectCSS(_path.default.join(__dirname, 'service.css')) | ||
28 | |||
29 | Franz.handleDarkMode((isEnabled, config) => { | ||
30 | // Open dropdown menu if not already open | ||
31 | const menu = document.querySelector('#USER_DROPDOWN_ID'); | ||
32 | if (menu.getAttribute('aria-expanded') === 'false') { | ||
33 | menu.click(); | ||
34 | } | ||
35 | |||
36 | setTimeout(() => { | ||
37 | // Check if service is already in right mode | ||
38 | const btn = document.querySelector('[role=menu] button button'); | ||
39 | const checked = btn.getAttribute('aria-checked') === 'true'; | ||
40 | |||
41 | if ((checked && !isEnabled) || (!checked && isEnabled)) { | ||
42 | // Click the button to switch between modes | ||
43 | btn.click(); | ||
44 | } | ||
45 | }, 50); | ||
46 | }); | ||
47 | } | ||