diff options
author | 2021-10-31 20:35:03 +0100 | |
---|---|---|
committer | 2021-10-31 20:35:03 +0100 | |
commit | 2a1ae2f1f9e4a0a64ae0f8fd361b66cb2ced3b16 (patch) | |
tree | 9d6eb0e066103fed5f35464da8423a5f58eb32d8 /recipes | |
parent | chore: upgrade 'nodejs' to '16.13.0' (diff) | |
parent | Use more explicit variable names (diff) | |
download | ferdium-recipes-2a1ae2f1f9e4a0a64ae0f8fd361b66cb2ced3b16.tar.gz ferdium-recipes-2a1ae2f1f9e4a0a64ae0f8fd361b66cb2ced3b16.tar.zst ferdium-recipes-2a1ae2f1f9e4a0a64ae0f8fd361b66cb2ced3b16.zip |
feature: Add Moodle recipe
Diffstat (limited to 'recipes')
-rw-r--r-- | recipes/moodle/README.md | 4 | ||||
-rw-r--r-- | recipes/moodle/icon.svg | 15 | ||||
-rw-r--r-- | recipes/moodle/index.js | 1 | ||||
-rw-r--r-- | recipes/moodle/package.json | 9 | ||||
-rw-r--r-- | recipes/moodle/service.css | 0 | ||||
-rw-r--r-- | recipes/moodle/webview.js | 18 |
6 files changed, 47 insertions, 0 deletions
diff --git a/recipes/moodle/README.md b/recipes/moodle/README.md new file mode 100644 index 0000000..1c85a88 --- /dev/null +++ b/recipes/moodle/README.md | |||
@@ -0,0 +1,4 @@ | |||
1 | # Moodle for Ferdi | ||
2 | This is a Ferdi recipe for Moodle | ||
3 | |||
4 | This recipe is designed to work with the default moodle Theme. If your Moodle uses a different theme, this recipe might not be able to show an unread messages count as the CSS selectors differ. | ||
diff --git a/recipes/moodle/icon.svg b/recipes/moodle/icon.svg new file mode 100644 index 0000000..4213641 --- /dev/null +++ b/recipes/moodle/icon.svg | |||
@@ -0,0 +1,15 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
2 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | ||
3 | <svg width="100%" height="100%" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"> | ||
4 | <g> | ||
5 | <g transform="matrix(2.82601,0,0,2.82601,27,-29.6905)"> | ||
6 | <path d="M288.89,309.11L288.89,201C288.89,178.4 279.557,167.1 260.89,167.1C242.223,167.1 232.89,178.4 232.89,201L232.89,309.11L177.89,309.11L177.89,201C177.89,178.4 168.717,167.1 150.37,167.1C131.703,167.1 122.37,178.4 122.37,201L122.37,309.11L67.37,309.11L67.37,194.65C67.37,171.07 75.557,153.223 91.93,141.11C106.337,130.297 125.823,124.89 150.39,124.89C175.29,124.89 193.623,131.277 205.39,144.05C215.543,131.277 234.047,124.89 260.9,124.89C285.473,124.89 304.957,130.297 319.35,141.11C335.73,153.217 343.92,171.063 343.92,194.65L343.92,309.11L288.89,309.11Z" style="fill:rgb(244,128,32);fill-rule:nonzero;"/> | ||
7 | </g> | ||
8 | <g transform="matrix(2.82601,0,0,2.82601,27,-29.6905)"> | ||
9 | <path d="M173.86,116.85L228.94,76.75L228.24,74.31C135,83.92 80.42,96.44 0,144.13L0.73,146.51L21.73,145.84C36.9,146.36 52.58,147.1 67.73,147.16C66.73,171.25 68.56,179.81 68.56,179.81C120.48,197.39 169.78,181.34 195.7,135.91C188.797,129.137 181.504,122.773 173.86,116.85Z" style="fill:rgb(88,88,88);fill-rule:nonzero;"/> | ||
10 | </g> | ||
11 | <g transform="matrix(2.82601,0,0,2.82601,27,-29.6905)"> | ||
12 | <path d="M113.78,110C113.48,108.92 111.55,108.52 109.5,109.1C108.192,109.355 107.051,110.151 106.36,111.29C87.83,116.29 57.2,125.01 35.63,132.29L34.3,132.74C17.62,138.35 9.57,141.23 9.08,145.29C6.79,163.73 8.21,187.47 8.22,187.77L8.41,194.17C-1.33,221.73 8.47,243.77 16.79,263.94C16.85,239.02 17.86,218.72 10.79,192.94C10.59,189.12 9.3,162.58 11.4,145.6C11.74,142.85 23.05,139.04 35.03,135.01L36.36,134.57C58.36,127.15 89.93,118.18 108.26,113.28C109.032,113.328 109.807,113.244 110.55,113.03C112.64,112.43 114.08,111.09 113.78,110Z" style="fill:rgb(88,88,88);fill-rule:nonzero;"/> | ||
13 | </g> | ||
14 | </g> | ||
15 | </svg> | ||
diff --git a/recipes/moodle/index.js b/recipes/moodle/index.js new file mode 100644 index 0000000..0a5cedb --- /dev/null +++ b/recipes/moodle/index.js | |||
@@ -0,0 +1 @@ | |||
module.exports = Ferdi => class moodle extends Ferdi {}; | |||
diff --git a/recipes/moodle/package.json b/recipes/moodle/package.json new file mode 100644 index 0000000..b421623 --- /dev/null +++ b/recipes/moodle/package.json | |||
@@ -0,0 +1,9 @@ | |||
1 | { | ||
2 | "id": "moodle", | ||
3 | "name": "Moodle", | ||
4 | "version": "1.0.0", | ||
5 | "license": "MIT", | ||
6 | "config": { | ||
7 | "hasCustomUrl": true | ||
8 | } | ||
9 | } | ||
diff --git a/recipes/moodle/service.css b/recipes/moodle/service.css new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/recipes/moodle/service.css | |||
diff --git a/recipes/moodle/webview.js b/recipes/moodle/webview.js new file mode 100644 index 0000000..932d1ec --- /dev/null +++ b/recipes/moodle/webview.js | |||
@@ -0,0 +1,18 @@ | |||
1 | var _path = _interopRequireDefault(require('path')); | ||
2 | |||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
4 | |||
5 | module.exports = Ferdi => { | ||
6 | const getMessages = () => { | ||
7 | const directCountSelector = [...document.querySelectorAll('[data-region="count-container"]')]; | ||
8 | const totalMessageCount = directCountSelector.reduce( | ||
9 | ((count, item) => count + Number(item.textContent)), | ||
10 | 0 | ||
11 | ); | ||
12 | |||
13 | Ferdi.setBadge(totalMessageCount, 0); | ||
14 | }; | ||
15 | Ferdi.loop(getMessages); | ||
16 | |||
17 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
18 | }; | ||