aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/steamchat/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/steamchat/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/steamchat/webview.js')
-rw-r--r--recipes/steamchat/webview.js28
1 files changed, 21 insertions, 7 deletions
diff --git a/recipes/steamchat/webview.js b/recipes/steamchat/webview.js
index 9cb6d64..3385423 100644
--- a/recipes/steamchat/webview.js
+++ b/recipes/steamchat/webview.js
@@ -1,3 +1,9 @@
1function _interopRequireDefault(obj) {
2 return obj && obj.__esModule ? obj : { default: obj };
3}
4
5const _path = _interopRequireDefault(require('path'));
6
1module.exports = (Ferdium, settings) => { 7module.exports = (Ferdium, settings) => {
2 const getMessages = () => { 8 const getMessages = () => {
3 // get new msg count 9 // get new msg count
@@ -30,13 +36,19 @@ module.exports = (Ferdium, settings) => {
30 36
31 Ferdium.loop(getMessages); 37 Ferdium.loop(getMessages);
32 38
39 Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
40
33 // TODO: See how this can be moved into the main ferdium app and sent as an ipc message for opening with a new window or same Ferdium recipe's webview based on user's preferences 41 // TODO: See how this can be moved into the main ferdium app and sent as an ipc message for opening with a new window or same Ferdium recipe's webview based on user's preferences
34 document.addEventListener('click', event => { 42 document.addEventListener(
35 const link = event.target.closest('a[href^="http"]'); 43 'click',
36 const button = event.target.closest('button[title^="http"]'); 44 event => {
45 const link = event.target.closest('a[href^="http"]');
46 const button = event.target.closest('button[title^="http"]');
37 47
38 if (link || button) { 48 if (link || button) {
39 const url = link ? link.getAttribute('href') : button.getAttribute('title'); 49 const url = link
50 ? link.getAttribute('href')
51 : button.getAttribute('title');
40 52
41 event.preventDefault(); 53 event.preventDefault();
42 event.stopPropagation(); 54 event.stopPropagation();
@@ -46,6 +58,8 @@ module.exports = (Ferdium, settings) => {
46 } else { 58 } else {
47 Ferdium.openNewWindow(url); 59 Ferdium.openNewWindow(url);
48 } 60 }
49 } 61 }
50 }, true); 62 },
63 true,
64 );
51}; 65};