Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,17 @@ for (i = 0; i < slimDropdownElements.length; i++) {
var buttonsInChat = document.querySelectorAll("#chat-tab:not(.old-ui) #chat-buttons button");
var button = document.getElementById("hover-element-button");
var menu = document.getElementById("hover-menu");
var istouchscreen = (navigator.maxTouchPoints > 0) || "ontouchstart" in document.documentElement;

function showMenu() {
menu.style.display = "flex"; // Show the menu
}

function hideMenu() {
menu.style.display = "none"; // Hide the menu
document.querySelector("#chat-input textarea").focus();
Comment thread
Touch-Night marked this conversation as resolved.
if (!istouchscreen) {
document.querySelector("#chat-input textarea").focus(); // Focus on the chat input
}
}

if (buttonsInChat.length > 0) {
Expand Down Expand Up @@ -235,11 +238,18 @@ function isMouseOverButtonOrMenu() {
}

button.addEventListener("mouseenter", function () {
showMenu();
if (!istouchscreen) {
showMenu();
}
});

button.addEventListener("click", function () {
if (menu.style.display === "flex") {
hideMenu();
}
else {
showMenu();
}
});

// Add event listener for mouseleave on the button
Expand Down