aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/steamchat/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/steamchat/webview.js')
-rw-r--r--recipes/steamchat/webview.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/recipes/steamchat/webview.js b/recipes/steamchat/webview.js
index 4e8519b..9cb6d64 100644
--- a/recipes/steamchat/webview.js
+++ b/recipes/steamchat/webview.js
@@ -33,17 +33,19 @@ module.exports = (Ferdium, settings) => {
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 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
34 document.addEventListener('click', event => { 34 document.addEventListener('click', event => {
35 const link = event.target.closest('a[href^="http"]'); 35 const link = event.target.closest('a[href^="http"]');
36 const button = event.target.closest('button[title^="http"]');
36 37
37 if (link && link.getAttribute('target') === '_top') { 38 if (link || button) {
38 event.preventDefault(); 39 const url = link ? link.getAttribute('href') : button.getAttribute('title');
39 event.stopPropagation();
40 const url = link.getAttribute('href');
41 40
42 if (settings.trapLinkClicks === true) { 41 event.preventDefault();
43 window.location.href = url; 42 event.stopPropagation();
44 } else { 43
45 Ferdium.openNewWindow(url); 44 if (settings.trapLinkClicks === true) {
46 } 45 window.location.href = url;
46 } else {
47 Ferdium.openNewWindow(url);
48 }
47 } 49 }
48 }, true); 50 }, true);
49}; 51};