diff options
author | 2020-06-22 10:40:27 +0200 | |
---|---|---|
committer | 2020-06-22 10:40:27 +0200 | |
commit | 57fffb6572dd4fa8257357b42448cd2bbeb8d586 (patch) | |
tree | 73f8c766150bc4a37382cb10929fb2e4758bbfc7 /uncompressed/rocketchat/webview.js | |
parent | Repackaged #206 (diff) | |
download | ferdium-recipes-57fffb6572dd4fa8257357b42448cd2bbeb8d586.tar.gz ferdium-recipes-57fffb6572dd4fa8257357b42448cd2bbeb8d586.tar.zst ferdium-recipes-57fffb6572dd4fa8257357b42448cd2bbeb8d586.zip |
Update repository
Diffstat (limited to 'uncompressed/rocketchat/webview.js')
-rw-r--r-- | uncompressed/rocketchat/webview.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/uncompressed/rocketchat/webview.js b/uncompressed/rocketchat/webview.js index 1e26ac9..5ccd0d2 100644 --- a/uncompressed/rocketchat/webview.js +++ b/uncompressed/rocketchat/webview.js | |||
@@ -1,10 +1,11 @@ | |||
1 | 'use strict'; | 1 | "use strict"; |
2 | 2 | ||
3 | const { ipcRenderer } = require('electron'); | 3 | const { |
4 | ipcRenderer | ||
5 | } = require('electron'); | ||
4 | 6 | ||
5 | const getTeamIcon = function getTeamIcon() { | 7 | const getTeamIcon = function getTeamIcon() { |
6 | console.log('getTeamIcon'); | 8 | console.log('getTeamIcon'); |
7 | |||
8 | const manifestElement = document.querySelector('link[rel="manifest"]'); | 9 | const manifestElement = document.querySelector('link[rel="manifest"]'); |
9 | 10 | ||
10 | if (manifestElement == null) { | 11 | if (manifestElement == null) { |
@@ -12,12 +13,14 @@ const getTeamIcon = function getTeamIcon() { | |||
12 | } | 13 | } |
13 | 14 | ||
14 | const manifestUrl = manifestElement.getAttribute('href'); | 15 | const manifestUrl = manifestElement.getAttribute('href'); |
16 | console.log(manifestUrl); | ||
15 | 17 | ||
16 | if (manifestUrl == null) { | 18 | if (manifestUrl == null) { |
17 | return; | 19 | return; |
18 | } | 20 | } |
19 | 21 | ||
20 | const xmlhttp = new XMLHttpRequest(); | 22 | const xmlhttp = new XMLHttpRequest(); |
23 | |||
21 | xmlhttp.onreadystatechange = function () { | 24 | xmlhttp.onreadystatechange = function () { |
22 | if (this.readyState != 4 || this.status != 200) { | 25 | if (this.readyState != 4 || this.status != 200) { |
23 | return; | 26 | return; |
@@ -26,9 +29,10 @@ const getTeamIcon = function getTeamIcon() { | |||
26 | const response = JSON.parse(this.responseText); | 29 | const response = JSON.parse(this.responseText); |
27 | 30 | ||
28 | if (response.icons.length >= 1) { | 31 | if (response.icons.length >= 1) { |
29 | ipcRenderer.sendToHost('avatar', `${window.location.protocol}//${window.location.host}/${response.icons[0].src}`); | 32 | ipcRenderer.sendToHost('avatar', `${window.location.protocol}//${window.location.host}${response.icons[0].src}`); |
30 | } | 33 | } |
31 | }; | 34 | }; |
35 | |||
32 | xmlhttp.open('GET', manifestUrl, true); | 36 | xmlhttp.open('GET', manifestUrl, true); |
33 | xmlhttp.send(); | 37 | xmlhttp.send(); |
34 | }; | 38 | }; |
@@ -41,9 +45,7 @@ module.exports = Franz => { | |||
41 | }; | 45 | }; |
42 | 46 | ||
43 | Franz.loop(getMessages); | 47 | Franz.loop(getMessages); |
44 | |||
45 | setTimeout(() => { | 48 | setTimeout(() => { |
46 | getTeamIcon(); | 49 | getTeamIcon(); |
47 | }, 4000); | 50 | }, 4000); |
48 | }; | 51 | }; \ No newline at end of file |
49 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJvY2tldGNoYXQvd2Vidmlldy5qcyJdLCJuYW1lcyI6WyJpcGNSZW5kZXJlciIsInJlcXVpcmUiLCJnZXRUZWFtSWNvbiIsImNvbnNvbGUiLCJsb2ciLCJtYW5pZmVzdEVsZW1lbnQiLCJkb2N1bWVudCIsInF1ZXJ5U2VsZWN0b3IiLCJtYW5pZmVzdFVybCIsImdldEF0dHJpYnV0ZSIsInhtbGh0dHAiLCJYTUxIdHRwUmVxdWVzdCIsI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