mirror of
https://github.com/abrendan/MicDropMessages.git
synced 2025-12-14 17:34:05 +01:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4112b4a19 | ||
|
|
b23c6692ab | ||
|
|
b1bccfb358 | ||
|
|
a80e0b0abc | ||
|
|
83a6d186ea | ||
|
|
30f3ea974d | ||
|
|
3737ce838a | ||
|
|
c8e10cb345 |
@@ -1,5 +1,7 @@
|
|||||||
# MicDropMessages
|
# MicDropMessages
|
||||||
|
|
||||||
MicDropMessages is a basic chat platform using socket.io and JavaScript.
|
MicDropMessages is a basic chat platform using socket.io and JavaScript. Now with a simple dark mode option!
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||

|
|
||||||
|
|||||||
@@ -11,15 +11,15 @@
|
|||||||
<body onload = "onload()">
|
<body onload = "onload()">
|
||||||
<div id = "Main">
|
<div id = "Main">
|
||||||
<audio id = "Ding" src = "Ding.mp3"> </audio>
|
<audio id = "Ding" src = "Ding.mp3"> </audio>
|
||||||
<h1 id = "Title"> MicDropMessages V1.1 </h1>
|
<h1 id = "Title"> MicDropMessages V1.4 </h1>
|
||||||
<p>Welcome to MicDropMessages! This small webbased application allows you to chat with your friends anonymously! To start, enter your username and enter a chatroom.</p>
|
<p>Welcome to MicDropMessages! This small webbased application allows you to chat with your friends anonymously! To start, enter your username and enter a chatroom.</p>
|
||||||
<div id = "AccessPort">
|
<div id = "AccessPort">
|
||||||
<label id = "NameLabel"> Username </label>
|
<label id = "NameLabel"> Username </label>
|
||||||
<input id = "NameInput" type = "text">
|
<input id = "NameInput" class="input" type = "text">
|
||||||
<br><br>
|
<br><br>
|
||||||
<label id = "IDLabel"> Chatroom </label>
|
<label id = "IDLabel"> Chatroom </label>
|
||||||
<input id = "IDInput" value = "Room1" type = "text">
|
<input id = "IDInput" class="input" value = "Room1" type = "text">
|
||||||
<input id = "ConnectButton" class = "Button" type = "submit" value = "Connect" onclick = "Connect()">
|
<input id = "ConnectButton" class="button2" type = "submit" value = "Connect" onclick = "Connect()">
|
||||||
</div>
|
</div>
|
||||||
<h2 id = "RoomID"> Chatroom : None </h2>
|
<h2 id = "RoomID"> Chatroom : None </h2>
|
||||||
<div id = "Chat">
|
<div id = "Chat">
|
||||||
@@ -34,11 +34,12 @@
|
|||||||
<p id = "Message8" class = "Message"> - </p>
|
<p id = "Message8" class = "Message"> - </p>
|
||||||
<p id = "Message9" class = "Message"> - </p>
|
<p id = "Message9" class = "Message"> - </p>
|
||||||
<label id = "MessageLabel"> Message </label>
|
<label id = "MessageLabel"> Message </label>
|
||||||
<input id = "ComposedMessage" type = "text">
|
<input id = "ComposedMessage" class="input" type = "text">
|
||||||
<input id = "SendMessage" onclick="Send()" value = "Send your message" class = "Button" type = "submit">
|
<input id = "SendMessage" onclick="Send()" value = "Send your message" class="button2" type = "submit">
|
||||||
</div>
|
</div>
|
||||||
<p>Made by abrendan. Visit my website for more of my projects.</p>
|
<p>Made by abrendan. Visit my website for more of my projects.</p>
|
||||||
<a href='https://abrendan.dev/' target="_blank" class="sitebutton">abrendan.dev</a>
|
<button id="darkModeToggle" onclick="toggleDarkMode()" class="button">Toggle Dark Mode</button>
|
||||||
|
<button onclick=" window.open('http://www.abrendan.dev','_blank')" class="button">abrendan.dev</button>
|
||||||
<br><br>
|
<br><br>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
var socket;
|
var socket;
|
||||||
var usernameInput
|
var usernameInput;
|
||||||
var chatIDInput;
|
var chatIDInput;
|
||||||
var messageInput;
|
var messageInput;
|
||||||
var chatRoom;
|
var chatRoom;
|
||||||
@@ -15,6 +15,13 @@ function onload(){
|
|||||||
chatRoom = document.getElementById("RoomID");
|
chatRoom = document.getElementById("RoomID");
|
||||||
dingSound = document.getElementById("Ding");
|
dingSound = document.getElementById("Ding");
|
||||||
|
|
||||||
|
// Event listener to send message when Enter key is pressed
|
||||||
|
messageInput.addEventListener("keyup", function(event) {
|
||||||
|
if (event.key === "Enter") { // Check if Enter was pressed
|
||||||
|
Send(); // Trigger send message
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
socket.on("join", function(room){
|
socket.on("join", function(room){
|
||||||
chatRoom.innerHTML = "Current Chatroom : " + room;
|
chatRoom.innerHTML = "Current Chatroom : " + room;
|
||||||
})
|
})
|
||||||
@@ -30,9 +37,9 @@ function onload(){
|
|||||||
messages.shift();
|
messages.shift();
|
||||||
messages.push(message);
|
messages.push(message);
|
||||||
}
|
}
|
||||||
for (i = 0; i < messages.length; i++){
|
for (var i = 0; i < messages.length; i++){
|
||||||
document.getElementById("Message"+i).innerHTML = messages[i];
|
document.getElementById("Message"+i).innerHTML = messages[i];
|
||||||
document.getElementById("Message"+i).style.color = "#000000";
|
document.getElementById("Message"+i).style.color = getComputedStyle(document.body).color;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -52,4 +59,18 @@ function Send(){
|
|||||||
|
|
||||||
function delayReset(){
|
function delayReset(){
|
||||||
delay = true;
|
delay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleDarkMode() {
|
||||||
|
document.body.classList.toggle('dark-mode');
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('keydown', function(event) {
|
||||||
|
// Check if Alt + Ctrl + R are pressed together
|
||||||
|
if (event.altKey && event.ctrlKey && event.key === 'r') {
|
||||||
|
// Prevent the default action to avoid conflicts
|
||||||
|
event.preventDefault();
|
||||||
|
// Open the desired webpage in a new window/tab
|
||||||
|
window.open('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -1,52 +1,110 @@
|
|||||||
body{
|
body{
|
||||||
background-image: url('https://i.ibb.co/zhPZBTt/luke-chesser-Cx-Bx-J3yp9g-unsplash.jpg'); /* Path to your example image */
|
background-image: url('https://images.unsplash.com/37/IHLjdHdzSvi0rgUMMlSK_TE3_0286.jpg'); /* Path to your example image */
|
||||||
background-size: cover; /* Cover the entire viewport */
|
background-size: cover; /* Cover the entire viewport */
|
||||||
background-repeat: no-repeat; /* Do not repeat the image */
|
background-repeat: no-repeat; /* Do not repeat the image */
|
||||||
background-attachment: fixed; /* The background image does not scroll */
|
background-attachment: fixed; /* The background image does not scroll */
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-family: 'Segoe UI';
|
font-family: 'Segoe UI';
|
||||||
|
display: flex; /* Use flexbox to center content */
|
||||||
|
justify-content: center; /* Center horizontally */
|
||||||
|
align-items: center; /* Center vertically */
|
||||||
}
|
}
|
||||||
|
|
||||||
label{
|
label{
|
||||||
width: 5%;
|
min-width: 70px; /* Ensure label has enough width */
|
||||||
display: inline-block;
|
display: block; /* Make labels stack above inputs and buttons */
|
||||||
text-align: right;
|
margin-bottom: 0.5em; /* Provide some space between label and input/button */
|
||||||
|
text-align: left; /* Align text to the left */
|
||||||
}
|
}
|
||||||
|
|
||||||
input{
|
input{
|
||||||
background: #000000;
|
background-color: rgba(255, 255, 255, 0.15);
|
||||||
color: #db65fb;
|
color: #000000;
|
||||||
font-size: 120%;
|
font-size: 120%;
|
||||||
border: none;
|
border: none;
|
||||||
|
width: 100%; /* Full width input fields */
|
||||||
|
box-sizing: border-box; /* Border box sizing for padding and borders */
|
||||||
|
margin-bottom: 1em; /* Provide space below inputs */
|
||||||
}
|
}
|
||||||
|
|
||||||
.Message{
|
.Message{
|
||||||
color: #000000;
|
color: #000000;
|
||||||
}
|
}
|
||||||
|
#Main{
|
||||||
|
min-height: 94.5vh; /* Stretch to fill the viewport height */
|
||||||
|
width: 50%;
|
||||||
|
padding: 20px; /* Padding added to the main content area */
|
||||||
|
border-radius: 10px;
|
||||||
|
backdrop-filter: blur(5px); /* Provide a translucent frosted-glass effect */
|
||||||
|
background-color: rgba(255, 255, 255, 0.2); /* Slightly white transparent background */
|
||||||
|
display: flex; /* Adding flex properties to layout contents */
|
||||||
|
flex-direction: column; /* Stack children elements vertically */
|
||||||
|
align-items: center; /* Centering child elements horizontally */
|
||||||
|
}
|
||||||
#Title{
|
#Title{
|
||||||
font-size: 300%;
|
font-size: 300%;
|
||||||
}
|
}
|
||||||
|
.button {
|
||||||
.sitebutton {
|
|
||||||
background-color:transparent;
|
background-color:transparent;
|
||||||
border-radius:28px;
|
border-radius:28px;
|
||||||
border:1px solid #db65fb;
|
border:0px solid #000000;
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
color:#000000;
|
color:#000000;
|
||||||
font-family:Arial;
|
|
||||||
font-size:17px;
|
font-size:17px;
|
||||||
padding:16px 31px;
|
padding:16px 31px;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
text-shadow:0px 1px 0px #000000;
|
text-shadow:0px 1px 0px #000000;
|
||||||
|
background-color: rgba(255, 255, 255, 0.2); /* Slightly white transparent background */
|
||||||
|
transition: background-color 0.3s ease; /* Transition for button hover effects */
|
||||||
|
width: auto; /* Width is determined by content within */
|
||||||
|
margin: 0.5em 0; /* Margin around buttons */
|
||||||
}
|
}
|
||||||
.sitebutton:hover {
|
.button:hover {
|
||||||
background-color:transparent;
|
background-color:#000000;
|
||||||
|
color:#ffffff;
|
||||||
}
|
}
|
||||||
.sitebutton:active {
|
.button:active {
|
||||||
position:relative;
|
position:relative;
|
||||||
top:1px;
|
top:1px;
|
||||||
}
|
}
|
||||||
|
/* Add this to your CSS to support dark mode */
|
||||||
|
body.dark-mode {
|
||||||
|
color: #ffffff; /* Light text color for contrast */
|
||||||
|
backdrop-filter: blur(5px); /* Provide a translucent frosted-glass effect */
|
||||||
|
background-color: rgba(0, 0, 0, 1); /* Slightly transparent dark background */
|
||||||
|
}
|
||||||
|
body.dark-mode .button {
|
||||||
|
color: #ffffff; /* Dark button background color */
|
||||||
|
}
|
||||||
|
body.dark-mode .button2 {
|
||||||
|
color: #ffffff; /* Dark button background color */
|
||||||
|
}
|
||||||
|
body.dark-mode .input {
|
||||||
|
color: #ffffff; /* Dark button background color */
|
||||||
|
}
|
||||||
|
.dark-mode #Main {
|
||||||
|
background-color: #333; /* Dark background for main content area */
|
||||||
|
}
|
||||||
|
.input {
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 6px;
|
||||||
|
width: 100%; /* Full width input fields */
|
||||||
|
box-sizing: border-box; /* Border box sizing for padding and borders */
|
||||||
|
}
|
||||||
|
.button2 {
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 6px;
|
||||||
|
transition: background-color 0.3s ease; /* Transition for button hover effects */
|
||||||
|
width: auto; /* Width is determined by content within */
|
||||||
|
margin: 0.5em 0; /* Margin around buttons */
|
||||||
|
}
|
||||||
|
.button2:hover {
|
||||||
|
background-color:#000000;
|
||||||
|
color:#ffffff;
|
||||||
|
}
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
label {
|
||||||
|
width: auto; /* Full width on narrow screens */
|
||||||
|
}
|
||||||
|
#Main {
|
||||||
|
width: 100%; /* Full width on narrow screens */
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user