aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/rocketchat/webview.js
diff options
context:
space:
mode:
authorLibravatar MCMXC <16797721+mcmxcdev@users.noreply.github.com>2023-07-26 06:29:03 -0600
committerLibravatar GitHub <noreply@github.com>2023-07-26 17:59:03 +0530
commit9b8f01716774a960073e944823ab727cc867a8f6 (patch)
tree732b83770baa78f5cf12776aaa33ce65bebfa418 /recipes/rocketchat/webview.js
parentAdd Excalidraw recipe (#393) (diff)
downloadferdium-recipes-9b8f01716774a960073e944823ab727cc867a8f6.tar.gz
ferdium-recipes-9b8f01716774a960073e944823ab727cc867a8f6.tar.zst
ferdium-recipes-9b8f01716774a960073e944823ab727cc867a8f6.zip
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 <vraravam@users.noreply.github.com>
Diffstat (limited to 'recipes/rocketchat/webview.js')
-rw-r--r--recipes/rocketchat/webview.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/recipes/rocketchat/webview.js b/recipes/rocketchat/webview.js
index 85b0c32..74556de 100644
--- a/recipes/rocketchat/webview.js
+++ b/recipes/rocketchat/webview.js
@@ -1,3 +1,8 @@
1function _interopRequireDefault(obj) {
2 return obj && obj.__esModule ? obj : { default: obj };
3}
4
5const _path = _interopRequireDefault(require('path'));
1 6
2module.exports = Ferdium => { 7module.exports = Ferdium => {
3 const getMessages = () => { 8 const getMessages = () => {
@@ -18,30 +23,34 @@ module.exports = Ferdium => {
18 23
19 Ferdium.loop(getMessages); 24 Ferdium.loop(getMessages);
20 25
26 Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
27
21 const getTeamIcon = function getTeamIcon() { 28 const getTeamIcon = function getTeamIcon() {
22 const manifestElement = document.querySelector('link[rel="manifest"]'); 29 const manifestElement = document.querySelector('link[rel="manifest"]');
23 30
24 if (manifestElement == null) { 31 if (manifestElement === null) {
25 return; 32 return;
26 } 33 }
27 34
28 const manifestUrl = manifestElement.getAttribute('href'); 35 const manifestUrl = manifestElement.getAttribute('href');
29 36
30 if (manifestUrl == null) { 37 if (manifestUrl === null) {
31 return; 38 return;
32 } 39 }
33 40
34 const xmlhttp = new XMLHttpRequest(); 41 const xmlhttp = new XMLHttpRequest();
35 42
36 xmlhttp.addEventListener('readystatechange', function () { 43 xmlhttp.addEventListener('readystatechange', function () {
37 if (this.readyState != 4 || this.status != 200) { 44 if (this.readyState !== 4 || this.status !== 200) {
38 return; 45 return;
39 } 46 }
40 47
41 const response = JSON.parse(this.responseText); 48 const response = JSON.parse(this.responseText);
42 49
43 if (response.icons.length > 0) { 50 if (response.icons.length > 0) {
44 Ferdium.setAvatarImage(`${window.location.protocol}//${window.location.host}${response.icons[0].src}`); 51 Ferdium.setAvatarImage(
52 `${window.location.protocol}//${window.location.host}${response.icons[0].src}`,
53 );
45 } 54 }
46 }); 55 });
47 56