aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/steamchat
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/steamchat')
-rw-r--r--recipes/steamchat/index.js13
-rw-r--r--recipes/steamchat/package.json2
-rw-r--r--recipes/steamchat/webview.js28
3 files changed, 30 insertions, 13 deletions
diff --git a/recipes/steamchat/index.js b/recipes/steamchat/index.js
index 7edfda5..3b3a28a 100644
--- a/recipes/steamchat/index.js
+++ b/recipes/steamchat/index.js
@@ -1,5 +1,8 @@
1module.exports = (Ferdium) => class SteamChat extends Ferdium { 1module.exports = Ferdium =>
2 overrideUserAgent() { 2 class SteamChat extends Ferdium {
3 return window.navigator.userAgent.replace(/(Ferdium|Electron)\/\S+ \([^)]+\)/g, '').trim(); 3 overrideUserAgent() {
4 } 4 return window.navigator.userAgent
5}; 5 .replaceAll(/(Ferdium|Electron)\/\S+ \([^)]+\)/g, '')
6 .trim();
7 }
8 };
diff --git a/recipes/steamchat/package.json b/recipes/steamchat/package.json
index 9123671..2f37026 100644
--- a/recipes/steamchat/package.json
+++ b/recipes/steamchat/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "steamchat", 2 "id": "steamchat",
3 "name": "SteamChat", 3 "name": "SteamChat",
4 "version": "1.4.3", 4 "version": "1.5.0",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://steamcommunity.com/chat", 7 "serviceURL": "https://steamcommunity.com/chat",
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};