From 7fe2a15787de34da2950ed3629e560ab0d5a9e64 Mon Sep 17 00:00:00 2001 From: Sagir Mo <78988840+Sagir-mo@users.noreply.github.com> Date: Sun, 21 Feb 2021 05:22:56 -0500 Subject: Add recipe for Canvas (#437) Add recipe for Canvas --- recipes/canvas/README.md | 8 + recipes/canvas/icon.png | Bin 0 -> 212046 bytes recipes/canvas/icon.svg | 3981 +++++++++++++++++++++++++++++++++++++++++++ recipes/canvas/index.js | 1 + recipes/canvas/package.json | 18 + recipes/canvas/webview.js | 17 + 6 files changed, 4025 insertions(+) create mode 100644 recipes/canvas/README.md create mode 100644 recipes/canvas/icon.png create mode 100644 recipes/canvas/icon.svg create mode 100644 recipes/canvas/index.js create mode 100644 recipes/canvas/package.json create mode 100644 recipes/canvas/webview.js diff --git a/recipes/canvas/README.md b/recipes/canvas/README.md new file mode 100644 index 0000000..3273a6b --- /dev/null +++ b/recipes/canvas/README.md @@ -0,0 +1,8 @@ +# Canvas for Ferdi +This is the official Ferdi recipe for Canvas + +# Release notes +1.0.0 First version + +### How to create your own Ferdi recipes: +* [Read the documentation](https://github.com/getferdi/recipes/blob/master/docs/integration.md) diff --git a/recipes/canvas/icon.png b/recipes/canvas/icon.png new file mode 100644 index 0000000..ae72606 Binary files /dev/null and b/recipes/canvas/icon.png differ diff --git a/recipes/canvas/icon.svg b/recipes/canvas/icon.svg new file mode 100644 index 0000000..ed024f3 --- /dev/null +++ b/recipes/canvas/icon.svg @@ -0,0 +1,3981 @@ + + + + diff --git a/recipes/canvas/index.js b/recipes/canvas/index.js new file mode 100644 index 0000000..415aeea --- /dev/null +++ b/recipes/canvas/index.js @@ -0,0 +1 @@ +module.exports = Ferdi => Ferdi; \ No newline at end of file diff --git a/recipes/canvas/package.json b/recipes/canvas/package.json new file mode 100644 index 0000000..223a8df --- /dev/null +++ b/recipes/canvas/package.json @@ -0,0 +1,18 @@ +{ + "id": "canvas", + "name": "Canvas", + "version": "1.0.0", + "description": "Canvas", + "main": "index.js", + "author": "Sagir Mohammed ", + "license": "MIT", + "config": { + "serviceURL": "https://{teamId}.instructure.com/", + "hasTeamId": true, + "urlInputSuffix": true, + "hasNotificationSound": false, + "hasIndirectMessages": false, + "hasCustomUrl": false, + "message": "Your canvas TeamID is your school's initials eg MIT, FIU, UCF etc." + } +} diff --git a/recipes/canvas/webview.js b/recipes/canvas/webview.js new file mode 100644 index 0000000..59d37e3 --- /dev/null +++ b/recipes/canvas/webview.js @@ -0,0 +1,17 @@ +"use strict"; + +module.exports = Ferdi => { + const getMessages = () => { + var direct = 0; + + const MessageElement = document.querySelector('[id=global_nav_conversations_link]'); + if (MessageElement) { + direct += MessageElement.innerHTML; + } + + Ferdi.setBadge(direct); + }; + + Ferdi.loop(getMessages); + +}; \ No newline at end of file -- cgit v1.2.3-54-g00ecf