From 9b8f01716774a960073e944823ab727cc867a8f6 Mon Sep 17 00:00:00 2001 From: MCMXC <16797721+mcmxcdev@users.noreply.github.com> Date: Wed, 26 Jul 2023 06:29:03 -0600 Subject: chore: improve lint setup (#397) - update eslint config to closely mirror the ones from ferdium-app - add .eslintignore - opt in to eslint `reportUnusedDisableDirectives` config option - remove `trailingComma: all` from `prettier` config which is default in `prettier` v3 - autofix or disable a lot of lint issues throughout codebase - add `volta` configuration to `package.json` to autoload correct `node` and `pnpm` versions - upgrade all `eslint` and `prettier` related dependencies to latest - update lint:fix npm script - reformat touched files with prettier - bumped up minor version for all recipes that have changes - introduced injection of 'service.css' where it was missing in many recipes --------- Co-authored-by: Vijay A --- recipes/google-calendar/LICENSE | 19 +++ recipes/google-calendar/calendar.css | 41 ++++++ recipes/google-calendar/darkmode.css | 222 ++++++++++++++++++++++++++++++ recipes/google-calendar/icon.svg | 1 + recipes/google-calendar/index.js | 1 + recipes/google-calendar/package.json | 15 ++ recipes/google-calendar/webview-unsafe.js | 46 +++++++ recipes/google-calendar/webview.js | 18 +++ 8 files changed, 363 insertions(+) create mode 100644 recipes/google-calendar/LICENSE create mode 100644 recipes/google-calendar/calendar.css create mode 100644 recipes/google-calendar/darkmode.css create mode 100644 recipes/google-calendar/icon.svg create mode 100644 recipes/google-calendar/index.js create mode 100644 recipes/google-calendar/package.json create mode 100644 recipes/google-calendar/webview-unsafe.js create mode 100644 recipes/google-calendar/webview.js (limited to 'recipes/google-calendar') diff --git a/recipes/google-calendar/LICENSE b/recipes/google-calendar/LICENSE new file mode 100644 index 0000000..4608c00 --- /dev/null +++ b/recipes/google-calendar/LICENSE @@ -0,0 +1,19 @@ +Copyright 2017 Rico Herwig + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/recipes/google-calendar/calendar.css b/recipes/google-calendar/calendar.css new file mode 100644 index 0000000..7cd726b --- /dev/null +++ b/recipes/google-calendar/calendar.css @@ -0,0 +1,41 @@ +#franz-modal { + display: none; + position: fixed; + z-index: 9999; + left: 0; + top: 0; + right: 0; + bottom: 0; + overflow: auto; + background-color: rgba(0, 0, 0, 0.8); +} + +#franz-modal.open { + display: block; +} + +#franz-modal .modal-content { + background-color: #fefefe; + margin: 15% auto; + padding: 20px; + border: 1px solid #888; + width: 30%; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} + +#franz-modal .close { + color: #aaa; + float: right; + margin-top: -10px; + font-size: 20px; + font-weight: bold; +} + +#franz-modal .close:hover, +#franz-modal .close:focus { + color: black; + text-decoration: none; + cursor: pointer; +} diff --git a/recipes/google-calendar/darkmode.css b/recipes/google-calendar/darkmode.css new file mode 100644 index 0000000..aab4f78 --- /dev/null +++ b/recipes/google-calendar/darkmode.css @@ -0,0 +1,222 @@ +/* Copied from: https://github.com/ducfilan/Dark-mode-Franz-Ferdi */ + +html { + -webkit-filter: invert(90%) hue-rotate(180deg) !important; + filter: invert(90%) hue-rotate(180deg) !important; + background: #191919 !important; +} + +.CflnFb { + background-color: #7b96c1 !important; + filter: invert(100%) hue-rotate(180deg) brightness(1.1) saturate(140%) + contrast(105%) !important; + color: #fff !important; +} + +.h5t3Nc .GrK4Mb, +.h5t3Nc .hVDHke, +.h5t3Nc .l7VQxb, +.h5t3Nc .zP0T0b, +.h5t3Nc .qNixLe { + background-color: #c9c9c9; + border-color: #fff; +} + +.lq96Td { + background-color: #003e3a !important; + color: #fff !important; + filter: invert(100%) hue-rotate(180deg) brightness(1.1) saturate(140%) + contrast(105%) !important; +} + +.GooADb { + color: #9dceff !important; + text-shadow: 0 0 #404040 !important; +} + +.bJZIjf.qs41qe { + opacity: 0.3; +} + +#gb a.gb_ja, +#gb a.gb_ja:visited, +#gb a.gb_ja:active, +#gb a.gb_ka, +#gb a.gb_ka:visited { + color: rgba(255, 255, 255, 0.87) !important; + text-decoration: none !important; + background-color: #000 !important; +} + +.M6tHv { + background-color: #444 !important; +} + +.gb_ea.gb_6f { + background-color: #e8e8e8 !important; +} + +.gb_yc svg, +.gb_kc svg { + color: #000 !important; + opacity: 0.54 !important; +} + +.HkPXyb { + background-color: #f9f9f9; +} + +.EfQccc.F262Ye.EiZ8Dd::after { + border-color: #000; +} + +.uHMk6b.fsHoPb { + border: 7px solid #000 !important; +} + +.g3VIld.GFhhge.Up8vH.hFEqNb.J9Nfi.iWO5td { + filter: invert(100%) hue-rotate(180deg) brightness(1.1) saturate(140%) + contrast(105%) !important; + background: #191919 !important; + color: #fff !important; +} + +.g3dbUc .jKgTF, +.QGRmIf, +.lcPUt { + filter: invert(100%) hue-rotate(180deg) brightness(1.1) saturate(140%) + contrast(105%) !important; + font-weight: 700 !important; + mix-blend-mode: darken; +} + +.g3dbUc.UflSff { + filter: invert(100%) hue-rotate(180deg) saturate(140%) contrast(105%) + opacity(40%) !important; + color: #404040 !important; +} + +.NlL62b.EfQccc.elYzab-cXXICe-Hjleke.EiZ8Dd.UflSff.jKgTF { + filter: invert(100%) hue-rotate(180deg) saturate(140%) contrast(50%) + brightness(140%) opacity(90%) !important; +} + +.NlL62b.EfQccc.elYzab-cXXICe-Hjleke.EiZ8Dd.UflSff { + filter: opacity(80%) !important; +} + +.NlL62b.EfQccc.elYzab-cXXICe-Hjleke.EiZ8Dd.jKgTF { + filter: invert(100%) hue-rotate(180deg) brightness(1.1) saturate(140%) + contrast(105%) !important; + font-weight: 700 !important; +} + +.W0m3G { + font-weight: 500 !important; +} + +.g3dbUc { + font-weight: 900 !important; + color: #000 !important; +} + +.g3dbUc.smECzc { + color: #666 !important; +} + +.FAxxKc { + font-weight: 600 !important; + color: #000 !important; +} + +.rq8Mwb { + filter: invert(100%) !important; +} + +.WpDZC, +.zHQkBf { + color: #c1c1c1 !important; +} + +.XHsn7e, +.YqtBEc, +.xuBVOe, +.Mh0NNb, +.ck4bY, +.asor.asor_i0, +.gsoi.gsoi_w, +.gsoi.gsoi_c.asor_v, +.gsoi.gsoi_9.asor_v, +.gsoi.gsoi_7.asor_v, +#vqd3vxfo4jpl, +#pnsketfj08m, +.st-wc, +.NlL62b.EfQccc.elYzab-cXXICe-Hjleke.EiZ8Dd, +.a63c9c.ztKZ3d, +.a63c9c, +.Oxm52e, +.kImhzd, +.hsrazb, +.Tnsqdc, +.kw5sif, +.kXIDId, +.sIyjR, +.ghXZpb, +.whsOnd.zHQkBf { + filter: invert(100%) hue-rotate(180deg) brightness(1.1) saturate(140%) + contrast(105%) !important; +} + +.gb_3, +#rAECCd, +.jPtXgd { + font-weight: 600 !important; +} + +#I0_1513527137275, +.gb_W, +:not([data-date]):before, +img, +svg, +.jPtXgd, +.gb_Wa.gb_Fe, +.fFW7wc-OEVmcd { + filter: invert(100%) hue-rotate(180deg) brightness(1.1) contrast(105%) !important; +} + +.Wbs5sd, +.rF3YF.wmyjXb, +.A6wOnd, +.VgueE, +.Jmftzc.gVNoLb.EiZ8Dd, +.Jmftzc.K9QN7e.EiZ8Dd.UflSff, +.Jmftzc.K9QN7e.EiZ8Dd, +.i5a7ie, +.gb_Eb { + color: #000 !important; +} + +.EfQccc.Hrn1mc.EiZ8Dd::after, +.EfQccc.MmaWIb.KKjvXb.EiZ8Dd::after { + border: 1px solid #000; +} + +.XBkKC.WSvIUd, +.logo-plus-button-lockup-text { + color: #fff; +} + +.IP9Hyd .O0WRkf:first-child, +.gb_je.gb_ee { + color: #fff; +} + +.Jmftzc.gVNoLb.LKeQwe, +.Jmftzc.EiZ8Dd { + color: #000; +} + +.gb_fa.gb_ng, +.gb_Z { + font-weight: bolder !important; +} diff --git a/recipes/google-calendar/icon.svg b/recipes/google-calendar/icon.svg new file mode 100644 index 0000000..c71fa08 --- /dev/null +++ b/recipes/google-calendar/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/recipes/google-calendar/index.js b/recipes/google-calendar/index.js new file mode 100644 index 0000000..dd41f72 --- /dev/null +++ b/recipes/google-calendar/index.js @@ -0,0 +1 @@ +module.exports = Ferdium => Ferdium; diff --git a/recipes/google-calendar/package.json b/recipes/google-calendar/package.json new file mode 100644 index 0000000..79e94fe --- /dev/null +++ b/recipes/google-calendar/package.json @@ -0,0 +1,15 @@ +{ + "id": "google-calendar", + "name": "Google Calendar", + "version": "2.4.0", + "license": "MIT", + "aliases": [ + "google-calendar", + "gCalendar" + ], + "config": { + "serviceURL": "https://calendar.google.com/u/0/", + "hasCustomUrl": true, + "hasNotificationSound": true + } +} diff --git a/recipes/google-calendar/webview-unsafe.js b/recipes/google-calendar/webview-unsafe.js new file mode 100644 index 0000000..0f4833e --- /dev/null +++ b/recipes/google-calendar/webview-unsafe.js @@ -0,0 +1,46 @@ +let modal; +let updates = 0; + +const waitFor = (condition, callback) => { + if (condition()) { + callback(); + } else { + window.setTimeout(waitFor.bind(null, condition, callback), 100); + } +}; + +const showModal = text => { + modal.querySelector('p').textContent = text; + updates += 1; + window.ferdium.setBadge(updates); + modal.classList.add('open'); +}; + +const hideModal = () => { + modal.querySelector('p').textContent = ''; + updates -= 1; + window.ferdium.setBadge(updates); + modal.classList.remove('open'); +}; + +const createModal = () => { + const modalDialog = document.createElement('div'); + modalDialog.setAttribute('id', 'franz-modal'); + modalDialog.textContent = + ''; + modalDialog.querySelector('.close').addEventListener('click', hideModal); + + return modalDialog; +}; + +window.alert = showModal; + +modal = createModal(); +waitFor( + () => document.body, + () => document.body.append(modal), +); +document.addEventListener( + 'keydown', + event => event.key === 'Escape' && hideModal(), +); diff --git a/recipes/google-calendar/webview.js b/recipes/google-calendar/webview.js new file mode 100644 index 0000000..3921dea --- /dev/null +++ b/recipes/google-calendar/webview.js @@ -0,0 +1,18 @@ +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +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.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')); +}; -- cgit v1.2.3-54-g00ecf