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-classroom/LICENSE | 21 +++++ recipes/google-classroom/darkmode.css | 154 ++++++++++++++++++++++++++++++++++ recipes/google-classroom/icon.svg | 1 + recipes/google-classroom/index.js | 1 + recipes/google-classroom/package.json | 10 +++ recipes/google-classroom/webview.js | 34 ++++++++ 6 files changed, 221 insertions(+) create mode 100644 recipes/google-classroom/LICENSE create mode 100644 recipes/google-classroom/darkmode.css create mode 100644 recipes/google-classroom/icon.svg create mode 100644 recipes/google-classroom/index.js create mode 100644 recipes/google-classroom/package.json create mode 100644 recipes/google-classroom/webview.js (limited to 'recipes/google-classroom') diff --git a/recipes/google-classroom/LICENSE b/recipes/google-classroom/LICENSE new file mode 100644 index 0000000..516df99 --- /dev/null +++ b/recipes/google-classroom/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Tania R. Zúñiga + +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-classroom/darkmode.css b/recipes/google-classroom/darkmode.css new file mode 100644 index 0000000..0e47715 --- /dev/null +++ b/recipes/google-classroom/darkmode.css @@ -0,0 +1,154 @@ +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:.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-classroom/icon.svg b/recipes/google-classroom/icon.svg new file mode 100644 index 0000000..3a48ab5 --- /dev/null +++ b/recipes/google-classroom/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/recipes/google-classroom/index.js b/recipes/google-classroom/index.js new file mode 100644 index 0000000..dd41f72 --- /dev/null +++ b/recipes/google-classroom/index.js @@ -0,0 +1 @@ +module.exports = Ferdium => Ferdium; diff --git a/recipes/google-classroom/package.json b/recipes/google-classroom/package.json new file mode 100644 index 0000000..3fcb079 --- /dev/null +++ b/recipes/google-classroom/package.json @@ -0,0 +1,10 @@ +{ + "id": "google-classroom", + "name": "Google Classroom", + "version": "1.3.0", + "license": "MIT", + "repository": "https://github.com/TanZng/ferdi-googleclassroom", + "config": { + "serviceURL": "https://classroom.google.com/u/0/" + } +} diff --git a/recipes/google-classroom/webview.js b/recipes/google-classroom/webview.js new file mode 100644 index 0000000..47bfe80 --- /dev/null +++ b/recipes/google-classroom/webview.js @@ -0,0 +1,34 @@ +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +const _path = _interopRequireDefault(require('path')); + +module.exports = Ferdium => { + // if the user is on googleclassroom landing page, go to the login page. + if ( + location.hostname === 'edu.google.com' && + location.href.includes('workspace-for-education/classroom/') + ) { + location.href = + 'https://accounts.google.com/AccountChooser?continue=https://classroom.google.com/u/0/'; + } + + const getMessages = () => { + let homework = 0; + const upcomingAssignment = document.querySelectorAll( + '.hrUpcomingAssignmentGroup', + ); + if (upcomingAssignment.length > 0) { + let i; + for (i = 0; i < upcomingAssignment.length; i += 1) { + homework += upcomingAssignment[i].childElementCount; + } + } + Ferdium.setBadge(homework); + }; + + Ferdium.loop(getMessages); + + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +}; -- cgit v1.2.3-70-g09d2