From 6f5e4a00588aefdda7a5a1cfe70935870e7e234a Mon Sep 17 00:00:00 2001 From: Bennett Date: Tue, 22 Sep 2020 20:56:48 +0200 Subject: Unpack recipes and update recipes icons (#292) Co-authored-by: Amine Mouafik --- uncompressed/rocketchat/webview.js | 51 -------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 uncompressed/rocketchat/webview.js (limited to 'uncompressed/rocketchat/webview.js') diff --git a/uncompressed/rocketchat/webview.js b/uncompressed/rocketchat/webview.js deleted file mode 100644 index 5ccd0d2..0000000 --- a/uncompressed/rocketchat/webview.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; - -const { - ipcRenderer -} = require('electron'); - -const getTeamIcon = function getTeamIcon() { - console.log('getTeamIcon'); - const manifestElement = document.querySelector('link[rel="manifest"]'); - - if (manifestElement == null) { - return; - } - - const manifestUrl = manifestElement.getAttribute('href'); - console.log(manifestUrl); - - if (manifestUrl == null) { - return; - } - - const xmlhttp = new XMLHttpRequest(); - - xmlhttp.onreadystatechange = function () { - if (this.readyState != 4 || this.status != 200) { - return; - } - - const response = JSON.parse(this.responseText); - - if (response.icons.length >= 1) { - ipcRenderer.sendToHost('avatar', `${window.location.protocol}//${window.location.host}${response.icons[0].src}`); - } - }; - - xmlhttp.open('GET', manifestUrl, true); - xmlhttp.send(); -}; - -module.exports = Franz => { - const getMessages = function getMessages() { - const directMessages = Math.round(document.querySelectorAll('.unread.unread-mention, .badge--unread').length / 2); - const indirectMessages = Math.round(document.querySelectorAll('.unread:not(.unread-mention), .sidebar-item--unread').length / 2); - Franz.setBadge(directMessages, indirectMessages); - }; - - Franz.loop(getMessages); - setTimeout(() => { - getTeamIcon(); - }, 4000); -}; \ No newline at end of file -- cgit v1.2.3-70-g09d2