Skip to content

Commit

Permalink
Minor fixes to utility bar
Browse files Browse the repository at this point in the history
  • Loading branch information
amanharwara committed Jul 19, 2021
1 parent 2deebf6 commit 956d060
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
10 changes: 8 additions & 2 deletions src/util/webview/utilityBar/disableUtilityBar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
const disableUtilityBar = () => {
document.querySelector("footer").previousElementSibling.style.height = "0px";
document.querySelector(".utility-bar").remove();
if (
document.querySelector("footer") &&
document.querySelector("footer").previousElementSibling
)
document.querySelector("footer").previousElementSibling.style.height =
"0px";
if (document.querySelector(".utility-bar"))
document.querySelector(".utility-bar").remove();
};

module.exports = disableUtilityBar;
2 changes: 1 addition & 1 deletion src/util/webview/utilityBar/elementSelectors.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const elementSelectors = {
emojiPanel: "_1C2Q3",
replyPanel: "_3_5OP",
chatPanel: "._1gL0z",
chatPanel: "._33LGR",
};

module.exports = elementSelectors;
20 changes: 13 additions & 7 deletions src/util/webview/utilityBar/enableUtilityBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,22 @@ const enableUtilityBar = () => {
utilityBar.appendChild(formattingContainer);
utilityBar.appendChild(quickReplyContainer);

document.querySelector("footer").previousElementSibling.style.height = "47px";
document.querySelector("footer").dataset.theme = document.body.dataset.theme;
document.querySelector("footer").appendChild(utilityBar);
if (document.querySelector("footer")) {
document.querySelector("footer").previousElementSibling.style.height =
"47px";
document.querySelector("footer").dataset.theme =
document.body.dataset.theme;
document.querySelector("footer").appendChild(utilityBar);
}

let chatPanel = document.querySelector(elementSelectors.chatPanel);
chatPanel.scroll(0, chatPanel.scrollHeight);
if (chatPanel) chatPanel.scroll(0, chatPanel.scrollHeight);

document
.querySelector(".utility-bar")
.addEventListener("click", clickHandler);
if (document.querySelector(".utility-bar")) {
document
.querySelector(".utility-bar")
.addEventListener("click", clickHandler);
}

console.log("Utility Bar Enabled");
};
Expand Down

0 comments on commit 956d060

Please sign in to comment.