Skip to content

Commit

Permalink
None-Firefox fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
herronjo committed Nov 14, 2024
1 parent a486eb4 commit ba3c65c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
17 changes: 12 additions & 5 deletions components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,28 @@ class HeaderComponent extends HTMLElement {
const searchbox = this.shadow.querySelector("#searchbox");
const menuprofile = this.shadow.querySelector("#menuprofile");

document.addEventListener("click", function (event) {
this.shadow.addEventListener("click", function (event) {
/* header pfp dropdown */
if (!event.originalTarget) return;
if (!(event.originalTarget instanceof Node)) return;
if (!event.target) return;
if (
hiddenHeader.classList.contains("hidden") &&
mypfp.contains(event.originalTarget)
mypfp.contains(event.target)
) {
mypfp.classList.add("active");
hiddenHeader.classList.remove("hidden");
} else {
mypfp.classList.remove("active");
hiddenHeader.classList.add("hidden");
}
if (!mypfp.contains(event.originalTarget)) {
if (!mypfp.contains(event.target)) {
mypfp.classList.remove("active");
hiddenHeader.classList.add("hidden");
}
});

document.addEventListener("click", function (event) {
if (!event.target) return;
if (!(event.target instanceof HeaderComponent)) {
mypfp.classList.remove("active");
hiddenHeader.classList.add("hidden");
}
Expand Down
2 changes: 1 addition & 1 deletion tv/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h1>STiBaRC TV</h1>
<div id="chatbox">
<h2>Chat</h2>
<div id="chatmessages" class="flexcontainer"></div>
<i id="typing" class="hidden width100"></i>
<i id="typing sysnotif" class="hidden width100"></i>
<div id="chatinput">
<input id="chatmsg" type="text" placeholder="Message" autocomplete="off">
<button id="sendmsg" class="flexcontainer button primary" title="Send Message">Send</button>
Expand Down
4 changes: 4 additions & 0 deletions tv/tv.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
margin-bottom: 0;
}

.sysnotif {
color: #7F7F7F;
}

@media only screen and (max-width: 750px) {
#responsivegrid {
grid-template-columns: 1fr;
Expand Down
6 changes: 4 additions & 2 deletions tv/tv.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ window.addEventListener("load", function() {
$("#viewers").textContent = data.viewers;
});

let lastUserToSend = "";

socket.on("chatmemberschange", function(data) {
lastUserToSend = "";
const evt = document.createElement("i");
evt.classList.add("width100");
evt.classList.add("width100", "sysnotif");
evt.setAttribute("title", new Date().toLocaleString());
if (data.event === "join") {
evt.textContent = `${data.username} joined the chat.`;
Expand All @@ -44,7 +47,6 @@ window.addEventListener("load", function() {
$("#chatmessages").scrollTop = $("#chatmessages").scrollHeight;
});

let lastUserToSend = "";
socket.on("chatmessage", function(data) {
const msg = new ChatMessageComponent(data.user, data.message, lastUserToSend !== data.user.username);
msg.classList.add("width100");
Expand Down

0 comments on commit ba3c65c

Please sign in to comment.