Notification
- New apparence but not finish Livechat - Fixed being able to execute code if it is in the pseudo with <script>
This commit is contained in:
@ -3,10 +3,10 @@
|
|||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* showPrivateChat.js :+: :+: :+: */
|
/* showPrivateChat.js :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: edbernar <edbernar@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/08/04 19:17:54 by edbernar #+# #+# */
|
/* Created: 2024/08/04 19:17:54 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/08/04 23:00:10 by edbernar ### ########.fr */
|
/* Updated: 2024/08/05 16:51:04 by edbernar ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -120,7 +120,8 @@ async function displayInputBar(divMessageListChatHome, user)
|
|||||||
inputMessage.focus();
|
inputMessage.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendMessage(user) {
|
function sendMessage(user)
|
||||||
|
{
|
||||||
const inputMessage = document.getElementById("inputMessage");
|
const inputMessage = document.getElementById("inputMessage");
|
||||||
let message;
|
let message;
|
||||||
|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* showUserList.js :+: :+: :+: */
|
/* showUserList.js :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: edbernar <edbernar@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/08/04 19:21:10 by edbernar #+# #+# */
|
/* Created: 2024/08/04 19:21:10 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/08/04 22:54:30 by edbernar ### ########.fr */
|
/* Updated: 2024/08/05 14:28:31 by edbernar ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -28,14 +28,17 @@ async function showListUser() {
|
|||||||
if (JSON.stringify(userList) !== "{}")
|
if (JSON.stringify(userList) !== "{}")
|
||||||
{
|
{
|
||||||
userList.forEach(element => {
|
userList.forEach(element => {
|
||||||
divMessageListChatHome.innerHTML += `
|
let user = document.createElement("div");
|
||||||
<div class="user">
|
user.classList.add("user");
|
||||||
|
user.innerHTML = `
|
||||||
<div class="status ${element.status}">
|
<div class="status ${element.status}">
|
||||||
<img src="${element.pfp}">
|
<img>
|
||||||
</div>
|
</div>
|
||||||
<h3>${element.name}</h3>
|
<h3></h3>
|
||||||
</div>
|
`
|
||||||
`;
|
user.querySelector("img").src = element.pfp;
|
||||||
|
user.querySelector("h3").innerText = element.name;
|
||||||
|
divMessageListChatHome.appendChild(user);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
divMessageListChatHome.innerHTML += "<p style='text-align: center; margin-top: 20px;'>New conversation +</p>";
|
divMessageListChatHome.innerHTML += "<p style='text-align: center; margin-top: 20px;'>New conversation +</p>";
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* main.js :+: :+: :+: */
|
/* main.js :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: edbernar <edbernar@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/07/30 13:50:35 by edbernar #+# #+# */
|
/* Created: 2024/07/30 13:50:35 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/08/04 23:47:45 by edbernar ### ########.fr */
|
/* Updated: 2024/08/05 18:10:32 by edbernar ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -20,10 +20,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
|
|
||||||
|
|
||||||
document.addEventListener("keydown", (e) => {
|
document.addEventListener("keydown", (e) => {
|
||||||
if (e.key === "/")
|
if (e.key === "+")
|
||||||
createNotification.info("Hello");
|
createNotification.new("Server", "Server dsalj dhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkver dsalj dhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkver dsalj dhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkver dsalj dhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkver dsalj dhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkver dsalj dhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dasjdl jsahkjd ashkjd shakjdh sakjhd askjhd aksjhd kjsahd jsk is slow");
|
||||||
if (e.key === "*")
|
|
||||||
createNotification.success("Hello");
|
|
||||||
if (e.key === "-")
|
|
||||||
createNotification.error("Hello");
|
|
||||||
});
|
});
|
BIN
site/interface/site/notification/ico/error.png
Normal file
BIN
site/interface/site/notification/ico/error.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
site/interface/site/notification/ico/info.png
Normal file
BIN
site/interface/site/notification/ico/info.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
site/interface/site/notification/ico/success.png
Normal file
BIN
site/interface/site/notification/ico/success.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
site/interface/site/notification/ico/warning.png
Normal file
BIN
site/interface/site/notification/ico/warning.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
@ -3,16 +3,17 @@
|
|||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* main.js :+: :+: :+: */
|
/* main.js :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: edbernar <edbernar@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/08/04 23:32:52 by edbernar #+# #+# */
|
/* Created: 2024/08/04 23:32:52 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/08/05 00:24:52 by edbernar ### ########.fr */
|
/* Updated: 2024/08/05 18:29:04 by edbernar ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Todo (Eddy) :
|
Todo (Eddy) :
|
||||||
- Image but not necessary
|
- Image but not necessary
|
||||||
|
- icon
|
||||||
- Title
|
- Title
|
||||||
- Message
|
- Message
|
||||||
- Action button
|
- Action button
|
||||||
@ -21,55 +22,80 @@
|
|||||||
- pause when hover
|
- pause when hover
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function newNotification(type, timer)
|
function createHeader(title)
|
||||||
|
{
|
||||||
|
const divHeader = document.createElement("div");
|
||||||
|
const icon = document.createElement("img");
|
||||||
|
const h1Title = document.createElement("h1");
|
||||||
|
const cross = document.createElement("p");
|
||||||
|
|
||||||
|
divHeader.classList.add("header");
|
||||||
|
icon.style.width = "20px";
|
||||||
|
icon.style.height = "20px";
|
||||||
|
icon.style.position = 'absolute';
|
||||||
|
icon.style.left = '10px';
|
||||||
|
icon.style.top = '15px';
|
||||||
|
h1Title.innerHTML = title;
|
||||||
|
h1Title.style.textAlign = "center";
|
||||||
|
h1Title.style.width = "100%";
|
||||||
|
h1Title.style.marginTop = "5px";
|
||||||
|
cross.innerHTML = "X";
|
||||||
|
cross.style.position = 'absolute';
|
||||||
|
cross.style.right = '10px';
|
||||||
|
cross.style.top = '20px';
|
||||||
|
cross.style.cursor = 'pointer';
|
||||||
|
cross.style.margin = '0';
|
||||||
|
divHeader.appendChild(icon);
|
||||||
|
divHeader.appendChild(h1Title);
|
||||||
|
divHeader.appendChild(cross);
|
||||||
|
return (divHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createContent(message)
|
||||||
|
{
|
||||||
|
const divContent = document.createElement("div");
|
||||||
|
const pMessage = document.createElement("p");
|
||||||
|
const limit = 100;
|
||||||
|
|
||||||
|
divContent.classList.add("content");
|
||||||
|
pMessage.style.textAlign = "center";
|
||||||
|
if (message.length > limit)
|
||||||
|
message = message.substring(0, limit) + "...";
|
||||||
|
pMessage.innerHTML = message;
|
||||||
|
divContent.appendChild(pMessage);
|
||||||
|
return (divContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
function newNotification(title, message, img, action, timer)
|
||||||
{
|
{
|
||||||
const divNotification = document.getElementById("divNotification");
|
const divNotification = document.getElementById("divNotification");
|
||||||
const newNotification = document.createElement("div");
|
const newNotification = document.createElement("div");
|
||||||
|
const header = createHeader(title);
|
||||||
|
const content = createContent(message, img);
|
||||||
|
|
||||||
newNotification.classList.add("notification");
|
newNotification.classList.add("notification");
|
||||||
|
|
||||||
newNotification.innerHTML = "This is a " + type + " notification";
|
|
||||||
newNotification.style.width = "100%";
|
newNotification.style.width = "100%";
|
||||||
|
newNotification.appendChild(header);
|
||||||
divNotification.appendChild(newNotification);
|
divNotification.appendChild(newNotification);
|
||||||
setInterval(() => {
|
newNotification.appendChild(content);
|
||||||
newNotification.style.opacity = 1;
|
|
||||||
}, 100);
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
divNotification.removeChild(newNotification);
|
divNotification.removeChild(newNotification);
|
||||||
}, 99);
|
}, 199);
|
||||||
newNotification.style.animation = "slideOut 0.11s";
|
newNotification.style.animation = "slideOut 0.21s";
|
||||||
}, timer);
|
}, timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
class notification
|
class notification
|
||||||
{
|
{
|
||||||
timer = 2000;
|
timer = 5000;
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
info(message, action=null)
|
new(title, message, img=null, action=null)
|
||||||
{
|
{
|
||||||
console.log("New info notification: " + message);
|
console.log("New notification: " + message);
|
||||||
newNotification("info", this.timer);
|
newNotification(title, message, img, action, this.timer);
|
||||||
}
|
|
||||||
|
|
||||||
success(message, action=null)
|
|
||||||
{
|
|
||||||
console.log("New success notification: " + message);
|
|
||||||
newNotification("success", this.timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
warning(message, action=null)
|
|
||||||
{
|
|
||||||
console.log("New warning notification: " + message);
|
|
||||||
newNotification("warning", this.timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
error(message, action=null)
|
|
||||||
{
|
|
||||||
console.log("New error notification: " + message);
|
|
||||||
newNotification("error", this.timer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* notification.css :+: :+: :+: */
|
/* notification.css :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: edbernar <edbernar@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/08/04 23:44:17 by edbernar #+# #+# */
|
/* Created: 2024/08/04 23:44:17 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/08/05 00:15:17 by edbernar ### ########.fr */
|
/* Updated: 2024/08/05 18:17:02 by edbernar ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -36,10 +36,9 @@
|
|||||||
#divNotification {
|
#divNotification {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
top: 10px;
|
font-family: 'Poppins';
|
||||||
right: 0;
|
top: 0px;
|
||||||
width: 300px;
|
right: 10px;
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
@ -48,10 +47,41 @@
|
|||||||
#divNotification .notification {
|
#divNotification .notification {
|
||||||
background-color: #222222;
|
background-color: #222222;
|
||||||
color: white;
|
color: white;
|
||||||
padding: 10px;
|
margin-top: 10px;
|
||||||
margin: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
height: 100px;
|
|
||||||
min-height: 100px;
|
min-height: 100px;
|
||||||
|
min-width: 150px;
|
||||||
|
max-width: 400px;
|
||||||
animation: slideIn 0.1s;
|
animation: slideIn 0.1s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#divNotification .header {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
#divNotification .header h1 {
|
||||||
|
font-size: 1.2em;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#divNotification .header img {
|
||||||
|
background-color: #222222;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
margin-right: 6px;
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#divNotification .content {
|
||||||
|
margin: 0;
|
||||||
|
width: 95%;
|
||||||
|
padding: 2.5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#divNotification .content img {
|
||||||
|
object-fit: cover; object-position: 100% 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#divNotification .content p {
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
BIN
websocket-server/Class/__pycache__/User.cpython-310.pyc
Normal file
BIN
websocket-server/Class/__pycache__/User.cpython-310.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
websocket-server/typeRequets/__pycache__/login.cpython-310.pyc
Normal file
BIN
websocket-server/typeRequets/__pycache__/login.cpython-310.pyc
Normal file
Binary file not shown.
Binary file not shown.
@ -3,10 +3,10 @@
|
|||||||
# ::: :::::::: #
|
# ::: :::::::: #
|
||||||
# getPrivateListUser.py :+: :+: :+: #
|
# getPrivateListUser.py :+: :+: :+: #
|
||||||
# +:+ +:+ +:+ #
|
# +:+ +:+ +:+ #
|
||||||
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
# By: edbernar <edbernar@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2024/08/03 15:10:23 by edbernar #+# #+# #
|
# Created: 2024/08/03 15:10:23 by edbernar #+# #+# #
|
||||||
# Updated: 2024/08/04 14:00:44 by edbernar ### ########.fr #
|
# Updated: 2024/08/05 16:36:53 by edbernar ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ data = [
|
|||||||
"status": "offline",
|
"status": "offline",
|
||||||
"pfp": "https://pbs.twimg.com/media/EscE6ckU0AA-Uhe.png",
|
"pfp": "https://pbs.twimg.com/media/EscE6ckU0AA-Uhe.png",
|
||||||
"id": 654123
|
"id": 654123
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
async def getPrivateListUser(userClass, content=None):
|
async def getPrivateListUser(userClass, content=None):
|
||||||
|
Reference in New Issue
Block a user