aboutsummaryrefslogtreecommitdiffstats
path: root/recipes
diff options
context:
space:
mode:
authorLibravatar André Oliveira <37463445+SpecialAro@users.noreply.github.com>2022-05-31 16:07:41 +0100
committerLibravatar GitHub <noreply@github.com>2022-05-31 16:07:41 +0100
commit804aafb265e93c50abcb4d2c28e0ddfab16a36bb (patch)
treed11dd6abab6c98b19b617c3c4de1815122fe2888 /recipes
parentChange of Proton Service URL (#36) (diff)
downloadferdium-recipes-804aafb265e93c50abcb4d2c28e0ddfab16a36bb.tar.gz
ferdium-recipes-804aafb265e93c50abcb4d2c28e0ddfab16a36bb.tar.zst
ferdium-recipes-804aafb265e93c50abcb4d2c28e0ddfab16a36bb.zip
Fix open image in app or externally (instead of popup) (#37)
Fix #195 on Ferdium-app which causes a problem when opening images inside the discord (and possibly zoom).
Diffstat (limited to 'recipes')
-rw-r--r--recipes/discord/package.json2
-rw-r--r--recipes/discord/webview.js19
-rw-r--r--recipes/skype/package.json2
-rw-r--r--recipes/skype/webview.js16
-rw-r--r--recipes/steamchat/package.json2
-rw-r--r--recipes/steamchat/webview.js20
-rw-r--r--recipes/zoom/package.json2
-rw-r--r--recipes/zoom/webview.js18
8 files changed, 42 insertions, 39 deletions
diff --git a/recipes/discord/package.json b/recipes/discord/package.json
index e0c35aa..f5549d7 100644
--- a/recipes/discord/package.json
+++ b/recipes/discord/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "discord", 2 "id": "discord",
3 "name": "Discord", 3 "name": "Discord",
4 "version": "1.7.3", 4 "version": "1.7.4",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://discordapp.com/login", 7 "serviceURL": "https://discordapp.com/login",
diff --git a/recipes/discord/webview.js b/recipes/discord/webview.js
index cadafb1..1255675 100644
--- a/recipes/discord/webview.js
+++ b/recipes/discord/webview.js
@@ -5,7 +5,6 @@ function _interopRequireDefault(obj) {
5} 5}
6 6
7module.exports = (Ferdium, settings) => { 7module.exports = (Ferdium, settings) => {
8 console.log('settings', settings);
9 const getMessages = () => { 8 const getMessages = () => {
10 let directCount = 0; 9 let directCount = 0;
11 const directCountPerServer = document.querySelectorAll( 10 const directCountPerServer = document.querySelectorAll(
@@ -34,14 +33,16 @@ module.exports = (Ferdium, settings) => {
34 33
35 if (link || button) { 34 if (link || button) {
36 const url = link ? link.getAttribute('href') : button.getAttribute('title'); 35 const url = link ? link.getAttribute('href') : button.getAttribute('title');
37 36
38 event.preventDefault(); 37 if (!Ferdium.isImage(url)) {
39 event.stopPropagation(); 38 event.preventDefault();
40 39 event.stopPropagation();
41 if (settings.trapLinkClicks === true) { 40
42 window.location.href = url; 41 if (settings.trapLinkClicks === true) {
43 } else { 42 window.location.href = url;
44 Ferdium.openNewWindow(url); 43 } else {
44 Ferdium.openNewWindow(url);
45 }
45 } 46 }
46 } 47 }
47 }, true); 48 }, true);
diff --git a/recipes/skype/package.json b/recipes/skype/package.json
index 0a07ea3..247d9c5 100644
--- a/recipes/skype/package.json
+++ b/recipes/skype/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "skype", 2 "id": "skype",
3 "name": "Skype", 3 "name": "Skype",
4 "version": "3.5.2", 4 "version": "3.5.3",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://web.skype.com/", 7 "serviceURL": "https://web.skype.com/",
diff --git a/recipes/skype/webview.js b/recipes/skype/webview.js
index b317d14..db97d98 100644
--- a/recipes/skype/webview.js
+++ b/recipes/skype/webview.js
@@ -38,15 +38,13 @@ module.exports = (Ferdium, settings) => {
38 if (link || button) { 38 if (link || button) {
39 const url = link ? link.getAttribute('href') : button.getAttribute('title'); 39 const url = link ? link.getAttribute('href') : button.getAttribute('title');
40 40
41 if (url.includes('views/imgpsh_fullsize_anim')) { 41 event.preventDefault();
42 event.preventDefault(); 42 event.stopPropagation();
43 event.stopPropagation(); 43
44 44 if (settings.trapLinkClicks === true) {
45 if (settings.trapLinkClicks === true) { 45 window.location.href = url;
46 window.location.href = url; 46 } else {
47 } else { 47 Ferdium.openNewWindow(url);
48 Ferdium.openNewWindow(url);
49 }
50 } 48 }
51 } 49 }
52 }, true); 50 }, true);
diff --git a/recipes/steamchat/package.json b/recipes/steamchat/package.json
index 9489add..9123671 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.2", 4 "version": "1.4.3",
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 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};
diff --git a/recipes/zoom/package.json b/recipes/zoom/package.json
index eb8f557..5357394 100644
--- a/recipes/zoom/package.json
+++ b/recipes/zoom/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "zoom", 2 "id": "zoom",
3 "name": "Zoom", 3 "name": "Zoom",
4 "version": "1.3.2", 4 "version": "1.3.3",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://zoom.us/join", 7 "serviceURL": "https://zoom.us/join",
diff --git a/recipes/zoom/webview.js b/recipes/zoom/webview.js
index 030c038..1255675 100644
--- a/recipes/zoom/webview.js
+++ b/recipes/zoom/webview.js
@@ -33,14 +33,16 @@ module.exports = (Ferdium, settings) => {
33 33
34 if (link || button) { 34 if (link || button) {
35 const url = link ? link.getAttribute('href') : button.getAttribute('title'); 35 const url = link ? link.getAttribute('href') : button.getAttribute('title');
36 36
37 event.preventDefault(); 37 if (!Ferdium.isImage(url)) {
38 event.stopPropagation(); 38 event.preventDefault();
39 39 event.stopPropagation();
40 if (settings.trapLinkClicks === true) { 40
41 window.location.href = url; 41 if (settings.trapLinkClicks === true) {
42 } else { 42 window.location.href = url;
43 Ferdium.openNewWindow(url); 43 } else {
44 Ferdium.openNewWindow(url);
45 }
44 } 46 }
45 } 47 }
46 }, true); 48 }, true);