From 452014019fd18caed84ada26305e81aed2480415 Mon Sep 17 00:00:00 2001 From: fourtf Date: Wed, 30 May 2018 17:30:31 +0200 Subject: [PATCH] fixed infinite retry messages --- browser_ext/background.js | 3 --- browser_ext/inject.js | 19 ++++++++++++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/browser_ext/background.js b/browser_ext/background.js index 068866de2..a87ca4859 100644 --- a/browser_ext/background.js +++ b/browser_ext/background.js @@ -8,9 +8,6 @@ const ignoredPages = { "directory": true, }; -let popup = chrome.extension.getViews({type: "popup"})[0]; -popup.window.getElementById("status").innerHTML = "NaM"; - /// return channel name if it should contain a chat function matchChannelName(url) { if (!url) diff --git a/browser_ext/inject.js b/browser_ext/inject.js index 29d132817..7d36ae7a4 100644 --- a/browser_ext/inject.js +++ b/browser_ext/inject.js @@ -73,12 +73,21 @@ } // nav bar - if (rightCollapseButton && !installedObjects.topNav) { - let x = findRightCollapse(); + if (!installedObjects.topNav) { + if (rightCollapseButton) { + let x = findNavBar(); - installedObjects.topNav = true; - } else { - retry = true; + x.addEventListener("mouseup", () => { + if (!isCollapsed) { + let collapse = findRightCollapse(); + collapse.click(); + } + }); + + installedObjects.topNav = true; + } else { + retry = true; + } } // retry if needed