diff options
author | 2019-12-20 19:22:21 +0100 | |
---|---|---|
committer | 2019-12-20 19:22:21 +0100 | |
commit | a54d5cfa8564ee77f1a08972edb1f4bdfe4248a4 (patch) | |
tree | fb19d5c6cb80005059b456e4ba7ce4710f388b5f /uncompressed/skype/webview.js | |
parent | #15 Add mastodon recipe (diff) | |
parent | Add Zimbra recipe (diff) | |
download | ferdium-recipes-a54d5cfa8564ee77f1a08972edb1f4bdfe4248a4.tar.gz ferdium-recipes-a54d5cfa8564ee77f1a08972edb1f4bdfe4248a4.tar.zst ferdium-recipes-a54d5cfa8564ee77f1a08972edb1f4bdfe4248a4.zip |
Merge branch 'master' of https://github.com/getferdi/recipes
Diffstat (limited to 'uncompressed/skype/webview.js')
-rw-r--r-- | uncompressed/skype/webview.js | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/uncompressed/skype/webview.js b/uncompressed/skype/webview.js index 798eccb..12ad2a8 100644 --- a/uncompressed/skype/webview.js +++ b/uncompressed/skype/webview.js | |||
@@ -1,6 +1,12 @@ | |||
1 | "use strict"; | 1 | "use strict"; |
2 | 2 | ||
3 | module.exports = Franz => { | 3 | var _electron = require("electron"); |
4 | |||
5 | const { | ||
6 | BrowserWindow | ||
7 | } = _electron.remote; | ||
8 | |||
9 | module.exports = (Franz, settings) => { | ||
4 | const getMessages = function getMessages() { | 10 | const getMessages = function getMessages() { |
5 | let count = 0; | 11 | let count = 0; |
6 | const container = document.querySelector('[role="tablist"] > [title="Chats"] > div'); | 12 | const container = document.querySelector('[role="tablist"] > [title="Chats"] > div'); |
@@ -22,4 +28,31 @@ module.exports = Franz => { | |||
22 | }; | 28 | }; |
23 | 29 | ||
24 | Franz.loop(getMessages); | 30 | Franz.loop(getMessages); |
31 | document.addEventListener('click', event => { | ||
32 | const link = event.target.closest('a[href^="http"]'); | ||
33 | const button = event.target.closest('button[title^="http"]'); | ||
34 | |||
35 | if (link || button) { | ||
36 | const url = link ? link.getAttribute('href') : button.getAttribute('title'); | ||
37 | event.preventDefault(); | ||
38 | event.stopPropagation(); | ||
39 | |||
40 | if (url.includes('views/imgpsh_fullsize_anim')) { | ||
41 | let win = new BrowserWindow({ | ||
42 | width: 800, | ||
43 | height: window.innerHeight, | ||
44 | minWidth: 600, | ||
45 | webPreferences: { | ||
46 | partition: `persist:service-${settings.id}` | ||
47 | } | ||
48 | }); | ||
49 | win.loadURL(url); | ||
50 | win.on('closed', () => { | ||
51 | win = null; | ||
52 | }); | ||
53 | } else { | ||
54 | window.open(url); | ||
55 | } | ||
56 | } | ||
57 | }, true); | ||
25 | }; \ No newline at end of file | 58 | }; \ No newline at end of file |