diff --git a/recipes/google-calendar/package.json b/recipes/google-calendar/package.json index 79e94fe36..a7dc23a0a 100644 --- a/recipes/google-calendar/package.json +++ b/recipes/google-calendar/package.json @@ -1,7 +1,7 @@ { "id": "google-calendar", "name": "Google Calendar", - "version": "2.4.0", + "version": "2.4.1", "license": "MIT", "aliases": [ "google-calendar", diff --git a/recipes/google-calendar/webview.js b/recipes/google-calendar/webview.js index 3921dea98..7a8ae59e3 100644 --- a/recipes/google-calendar/webview.js +++ b/recipes/google-calendar/webview.js @@ -7,12 +7,31 @@ const _path = _interopRequireDefault(require('path')); module.exports = Ferdium => { // if the user is on googlecalendar landing page, go to the login page. if ( - location.hostname === 'workspace.google.com' && + location.hostname == 'workspace.google.com' && location.href.includes('products/calendar/') ) { location.href = 'https://accounts.google.com/AccountChooser?continue=https://calendar.google.com/u/0/'; } - Ferdium.injectCSS(_path.default.join(__dirname, 'calendar.css')); - Ferdium.injectJSUnsafe(_path.default.join(__dirname, 'webview-unsafe.js')); + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); + Ferdium.injectCSS( + 'https://cdn.statically.io/gh/ferdium/ferdium-recipes/main/recipes/google-calendar/calendar.css', + ); + Ferdium.injectJSUnsafe( + 'https://cdn.statically.io/gh/ferdium/ferdium-recipes/main/recipes/google-calendar/webview-unsave.js', + ); + + // Workaround for loading darkmode.css + const cssId = 'cssDarkModeWorkaround'; + if (!document.querySelector(cssId)) { + const head = document.querySelectorAll('head')[0]; + const link = document.createElement('link'); + link.id = cssId; + link.rel = 'stylesheet'; + link.type = 'text/css'; + link.href = + 'https://cdn.statically.io/gh/ferdium/ferdium-recipes/main/recipes/google-calendar/darkmode.css'; + link.media = 'all'; + head.append(link); + } };