mirror of
https://github.com/abrendan/MicDropMessages.git
synced 2025-12-14 17:34:05 +01:00
Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10da1b3392 | ||
|
|
bd651effdc | ||
|
|
fa1c78031c | ||
|
|
7f8151dfeb | ||
|
|
7ce73ce036 | ||
|
|
1970e36448 | ||
|
|
5bee7db3d1 | ||
|
|
db7b495194 | ||
|
|
0d26f56c4b | ||
|
|
b28d9a16db | ||
|
|
91e2fa270a | ||
|
|
201546a7f3 | ||
|
|
1733bb9a00 | ||
|
|
5ad7ad2ce6 | ||
|
|
226f1250da | ||
|
|
8f6697b00b | ||
|
|
831834728d | ||
|
|
7bd7e14910 | ||
|
|
da41439428 | ||
|
|
3ff4eedf62 | ||
|
|
d4112b4a19 | ||
|
|
b23c6692ab | ||
|
|
b1bccfb358 | ||
|
|
a80e0b0abc | ||
|
|
83a6d186ea | ||
|
|
30f3ea974d | ||
|
|
3737ce838a | ||
|
|
c8e10cb345 |
12
README.md
12
README.md
@@ -1,5 +1,13 @@
|
||||
# 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!
|
||||
|
||||

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

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

|
||||
|
||||
@@ -1,28 +1,30 @@
|
||||
<!DOCTYPE HTML>
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title> MicDropMessages </title>
|
||||
<meta name = "charset" charset = "utf-8">
|
||||
<meta name = "viewport" content = "width=device-width">
|
||||
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'>
|
||||
<link rel = "stylesheet" type = "text/css" href = "style.css">
|
||||
<link rel="icon" href="https://i.ibb.co/jvVTdPM/nobackground-withoutname2.png">
|
||||
<script src = "script.js"></script>
|
||||
<script src= "socket.io/socket.io.js"></script>
|
||||
</head>
|
||||
<body onload = "onload()">
|
||||
<div id = "Main">
|
||||
<audio id = "Ding" src = "Ding.mp3"> </audio>
|
||||
<h1 id = "Title"> MicDropMessages V1.1 </h1>
|
||||
<h1 id = "Title"> MicDropMessages V2 </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>
|
||||
<div id = "AccessPort">
|
||||
<label id = "NameLabel"> Username </label>
|
||||
<input id = "NameInput" type = "text">
|
||||
<input id = "NameInput" class="input" type = "text">
|
||||
<br><br>
|
||||
<label id = "IDLabel"> Chatroom </label>
|
||||
<input id = "IDInput" value = "Room1" type = "text">
|
||||
<input id = "ConnectButton" class = "Button" type = "submit" value = "Connect" onclick = "Connect()">
|
||||
<input id = "IDInput" class="input" value = "Room1" type = "text">
|
||||
<input id = "ConnectButton" class="button2" type = "submit" value = "Connect" onclick = "Connect()">
|
||||
</div>
|
||||
<h2 id = "RoomID"> Chatroom : None </h2>
|
||||
<div id = "Chat">
|
||||
<div id = "Chat" >
|
||||
<p id = "Message0" class = "Message"> - </p>
|
||||
<p id = "Message1" class = "Message"> - </p>
|
||||
<p id = "Message2" class = "Message"> - </p>
|
||||
@@ -34,12 +36,23 @@
|
||||
<p id = "Message8" class = "Message"> - </p>
|
||||
<p id = "Message9" class = "Message"> - </p>
|
||||
<label id = "MessageLabel"> Message </label>
|
||||
<input id = "ComposedMessage" type = "text">
|
||||
<input id = "SendMessage" onclick="Send()" value = "Send your message" class = "Button" type = "submit">
|
||||
<input id = "ComposedMessage" class="input" type = "text">
|
||||
<input id = "SendMessage" onclick="Send()" value = "Send your message" class="button2" type = "submit">
|
||||
<input id="LeaveRoomButton" class="button2" type="submit" value="Leave Room" onclick="LeaveRoom()">
|
||||
</div>
|
||||
<div class = "other">
|
||||
<button id="darkModeToggle" onclick="toggleDarkMode()" class="button">Toggle Dark Mode</button>
|
||||
<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>
|
||||
<br><br>
|
||||
<div id="LinkButtons">
|
||||
<button id="GitHubButton" onclick=" window.open('https://github.com/abrendan/MicDropMessages','_blank')" class="button">GitHub Page for MicDropMessages</button>
|
||||
<button id="WebsiteButton" onclick=" window.open('http://www.abrendan.dev','_blank')" class="button">abrendan.dev</button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="version-number">V2.1.0</p>
|
||||
</div>
|
||||
<div id="errorPopup" class="error-popup">
|
||||
<p id="errorText">Please enter a username and a chatroom.</p>
|
||||
<button id="errorButton" class="button2" onclick="closeErrorPopup()">Continue</button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
html/pictures/jezael-melgoza-2FiXtdnVhjQ-unsplash.jpg
Normal file
BIN
html/pictures/jezael-melgoza-2FiXtdnVhjQ-unsplash.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 540 KiB |
BIN
html/pictures/micdropmessages_logo-circle.png
Normal file
BIN
html/pictures/micdropmessages_logo-circle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 448 KiB |
56
html/privacy.html
Normal file
56
html/privacy.html
Normal file
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
var socket;
|
||||
var usernameInput
|
||||
var usernameInput;
|
||||
var chatIDInput;
|
||||
var messageInput;
|
||||
var chatRoom;
|
||||
@@ -15,8 +15,17 @@ function onload(){
|
||||
chatRoom = document.getElementById("RoomID");
|
||||
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){
|
||||
chatRoom.innerHTML = "Current Chatroom : " + room;
|
||||
// Show the chat div when successfully joined a room.
|
||||
document.getElementById("Chat").style.display = "block";
|
||||
})
|
||||
|
||||
socket.on("recieve", function(message){
|
||||
@@ -30,15 +39,54 @@ function onload(){
|
||||
messages.shift();
|
||||
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).style.color = "#000000";
|
||||
document.getElementById("Message"+i).style.color = getComputedStyle(document.body).color;
|
||||
}
|
||||
})
|
||||
|
||||
// Ensure that the error popup is not displayed when the page is loaded
|
||||
document.getElementById('errorPopup').style.display = 'none';
|
||||
}
|
||||
|
||||
function Connect(){
|
||||
socket.emit("join", chatIDInput.value, usernameInput.value);
|
||||
var username = usernameInput.value.trim();
|
||||
var room = chatIDInput.value.trim();
|
||||
if(username && room){
|
||||
socket.emit("join", room, username);
|
||||
chatRoom.innerHTML = "Chatroom : " + room;
|
||||
document.getElementById("Chat").style.display = "none";
|
||||
document.getElementById('AccessPort').style.display = 'none';
|
||||
} else {
|
||||
showErrorPopup("Please enter a username and a chatroom.");
|
||||
}
|
||||
}
|
||||
|
||||
function showErrorPopup(message) {
|
||||
document.getElementById('errorText').textContent = message;
|
||||
document.getElementById('errorPopup').style.display = 'flex';
|
||||
}
|
||||
|
||||
function closeErrorPopup() {
|
||||
document.getElementById('errorPopup').style.display = 'none';
|
||||
}
|
||||
|
||||
function LeaveRoom(){
|
||||
// Show access port to join another chat room.
|
||||
document.getElementById('AccessPort').style.display = 'block';
|
||||
|
||||
// Hide the chat div as the user is leaving the room.
|
||||
document.getElementById('Chat').style.display = 'none';
|
||||
|
||||
// Reset chatRoom text to indicate no room connection.
|
||||
chatRoom.innerHTML = "Chatroom : None";
|
||||
|
||||
// If the user is in a room, emit a leave event.
|
||||
if (rooms[socket.id]) {
|
||||
socket.emit('leave', rooms[socket.id], usernames[socket.id]);
|
||||
rooms[socket.id] = null;
|
||||
usernames[socket.id] = null;
|
||||
}
|
||||
}
|
||||
|
||||
function Send(){
|
||||
@@ -53,3 +101,17 @@ function Send(){
|
||||
function delayReset(){
|
||||
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');
|
||||
}
|
||||
});
|
||||
229
html/style.css
229
html/style.css
@@ -1,52 +1,243 @@
|
||||
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://micdropmessages.app/pictures/jezael-melgoza-2FiXtdnVhjQ-unsplash.jpg'); /* Path to your example image */
|
||||
background-size: cover; /* Cover the entire viewport */
|
||||
background-repeat: no-repeat; /* Do not repeat the image */
|
||||
background-attachment: fixed; /* The background image does not scroll */
|
||||
color: #000000;
|
||||
font-family: 'Segoe UI';
|
||||
font-family: 'Roboto';
|
||||
display: flex; /* Use flexbox to center content */
|
||||
justify-content: center; /* Center horizontally */
|
||||
align-items: center; /* Center vertically */
|
||||
}
|
||||
|
||||
label{
|
||||
width: 5%;
|
||||
display: inline-block;
|
||||
text-align: right;
|
||||
min-width: 70px; /* Ensure label has enough width */
|
||||
display: block; /* Make labels stack above inputs and buttons */
|
||||
margin-bottom: 0.5em; /* Provide some space between label and input/button */
|
||||
text-align: left; /* Align text to the left */
|
||||
}
|
||||
|
||||
input{
|
||||
background: #000000;
|
||||
color: #db65fb;
|
||||
background-color: rgba(255, 255, 255, 0.15);
|
||||
color: #000000;
|
||||
font-size: 120%;
|
||||
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{
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.other {
|
||||
width: 100%; /* Set width */
|
||||
text-align: center; /* Center inline and inline-block elements within */
|
||||
}
|
||||
#Logo{
|
||||
height: 80px;
|
||||
}
|
||||
#Chat{
|
||||
display: none;
|
||||
}
|
||||
#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 */
|
||||
-webkit-backdrop-filter: blur(5px);
|
||||
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 */
|
||||
position: relative; /* To position the version number correctly */
|
||||
}
|
||||
#Title{
|
||||
font-size: 300%;
|
||||
}
|
||||
#LinkButtons{
|
||||
display: inline-block;
|
||||
}
|
||||
#ConnectButton {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 20px;
|
||||
padding: 20px 40px; /* Increase the padding to make the button bigger */
|
||||
font-size: 20px; /* Increase the font-size for better readability on small screens */
|
||||
}
|
||||
#errorButton {
|
||||
padding: 16px 31px;
|
||||
border-radius: 10px;
|
||||
transition: background-color 0.3s ease;
|
||||
text-decoration: none;
|
||||
width: auto;
|
||||
margin: 0.5em 0;
|
||||
background-color: rgba(255, 255, 255, 0.2); /* Slightly white transparent background */
|
||||
transition: background-color 0.3s ease; /* Transition for button hover effects */
|
||||
border: 0px solid #000000;
|
||||
cursor: pointer;
|
||||
color: #000000;
|
||||
font-size: 17px;
|
||||
text-shadow: 0px 1px 0px #000000;
|
||||
display: block;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
.sitebutton {
|
||||
#errorButton:hover {
|
||||
background-color: #000000;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#errorButton:active {
|
||||
position: relative;
|
||||
top: 1px;
|
||||
}
|
||||
#errorText {
|
||||
margin-left: 20px;
|
||||
}
|
||||
.error-popup {
|
||||
display: none;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
background-color: rgba(0,0,0,0.4);
|
||||
backdrop-filter: blur(20px); /* Provide a translucent frosted-glass effect */
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
z-index: 2;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.error-popup-content {
|
||||
background-color: #fefefe;
|
||||
margin: auto;
|
||||
padding: 20px;
|
||||
border: 1px solid #888;
|
||||
width: 80%;
|
||||
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
|
||||
border-radius: 5px;
|
||||
text-align: center; /* Center the content inside the error popup */
|
||||
}
|
||||
.button {
|
||||
background-color:transparent;
|
||||
border-radius:28px;
|
||||
border:1px solid #db65fb;
|
||||
border:0px solid #000000;
|
||||
display:inline-block;
|
||||
cursor:pointer;
|
||||
color:#000000;
|
||||
font-family:Arial;
|
||||
font-size:17px;
|
||||
padding:16px 31px;
|
||||
text-decoration:none;
|
||||
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 {
|
||||
background-color:transparent;
|
||||
.button:hover {
|
||||
background-color:#000000;
|
||||
color:#ffffff;
|
||||
}
|
||||
.sitebutton:active {
|
||||
.button:active {
|
||||
position:relative;
|
||||
top:1px;
|
||||
}
|
||||
/* Add this to your CSS to support dark mode */
|
||||
body.dark-mode {
|
||||
color: #ffffff; /* Light text color for contrast */
|
||||
|
||||
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: rgba(0, 0, 0, 0.5); /* Slightly transparent dark background */
|
||||
}
|
||||
body.dark-mode .version-number {
|
||||
color: #ffffff; /* Dark button background color */
|
||||
}
|
||||
body.dark-mode #errorButton {
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
body.dark-mode #errorButton:hover {
|
||||
background-color: #000000;
|
||||
color: #ffffff;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
|
||||
.version-number {
|
||||
position: absolute;
|
||||
bottom: 1px;
|
||||
right: 10px;
|
||||
font-size: 0.75em;
|
||||
color: #000000; /* Assuming light text for visibility against a potentially dark background */
|
||||
}
|
||||
|
||||
@media (max-width: 800px) {
|
||||
label {
|
||||
width: auto; /* Full width on narrow screens */
|
||||
}
|
||||
#Main {
|
||||
width: 100%; /* Full width on narrow screens */
|
||||
}
|
||||
}
|
||||
@media (max-width: 650px) {
|
||||
#Title {
|
||||
font-size: 150%;
|
||||
}
|
||||
#ConnectButton {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
padding: 20px 40px; /* Increase the padding to make the button bigger */
|
||||
font-size: 20px; /* Increase the font-size for better readability on small screens */
|
||||
}
|
||||
#WebsiteButton {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
#LinkButtons {
|
||||
text-align: center;
|
||||
}
|
||||
#SendMessage {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 20px;
|
||||
margin-top: 10px;
|
||||
padding: 20px 40px; /* Increase the padding to make the button bigger */
|
||||
font-size: 20px; /* Increase the font-size for better readability on small screens */
|
||||
}
|
||||
#LeaveRoomButton {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 20px;
|
||||
margin-top: 10px;
|
||||
padding: 20px 40px; /* Increase the padding to make the button bigger */
|
||||
font-size: 20px; /* Increase the font-size for better readability on small screens */
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user