aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/google-calendar/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/google-calendar/webview.js')
-rw-r--r--recipes/google-calendar/webview.js31
1 files changed, 29 insertions, 2 deletions
diff --git a/recipes/google-calendar/webview.js b/recipes/google-calendar/webview.js
index 3921dea..804527d 100644
--- a/recipes/google-calendar/webview.js
+++ b/recipes/google-calendar/webview.js
@@ -13,6 +13,33 @@ module.exports = Ferdium => {
13 location.href = 13 location.href =
14 'https://accounts.google.com/AccountChooser?continue=https://calendar.google.com/u/0/'; 14 'https://accounts.google.com/AccountChooser?continue=https://calendar.google.com/u/0/';
15 } 15 }
16 Ferdium.injectCSS(_path.default.join(__dirname, 'calendar.css')); 16
17 Ferdium.injectJSUnsafe(_path.default.join(__dirname, 'webview-unsafe.js')); 17 Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
18 Ferdium.injectCSS(
19 'https://cdn.statically.io/gh/ferdium/ferdium-recipes/main/recipes/google-calendar/calendar.css',
20 );
21 Ferdium.injectJSUnsafe(
22 'https://cdn.statically.io/gh/ferdium/ferdium-recipes/main/recipes/google-calendar/webview-unsave.js',
23 );
24
25 Ferdium.handleDarkMode(isEnabled => {
26 const cssId = 'cssDarkModeWorkaround';
27
28 if (isEnabled) {
29 // Workaround for loading darkmode.css
30 if (!document.querySelector(`#${cssId}`)) {
31 const head = document.querySelectorAll('head')[0];
32 const link = document.createElement('link');
33 link.id = cssId;
34 link.rel = 'stylesheet';
35 link.type = 'text/css';
36 link.href =
37 'https://cdn.statically.io/gh/ferdium/ferdium-recipes/main/recipes/google-calendar/darkmode.css';
38 link.media = 'all';
39 head.append(link);
40 }
41 } else {
42 document.querySelector(`#${cssId}`)?.remove();
43 }
44 });
18}; 45};