- remove addEventListener in ./main.js (the one to test notifications)
    - Started log in
    - Added function on "login" button for open login div
    - In login div, send request when we press button
This commit is contained in:
edbernar
2024-08-07 19:14:32 +02:00
parent 12fd4bb814
commit bfb31a1ae6
10 changed files with 229 additions and 44 deletions

View File

@ -6,35 +6,15 @@
/* By: edbernar <edbernar@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/30 13:50:35 by edbernar #+# #+# */
/* Updated: 2024/08/06 15:43:35 by edbernar ### ########.fr */
/* Updated: 2024/08/07 17:52:24 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
import { liveChat } from "./liveChat/main.js";
import { createNotification } from "./notification/main.js";
import { liveChat } from "./liveChat/main.js";
import { login } from "./login/main.js";
document.addEventListener('DOMContentLoaded', () => {
liveChat();
login();
});
function createRamdomString()
{
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
let result = "";
let length = Math.floor(Math.random() * 120);
for (let i = 0; i < length; i++)
result += charset.charAt(Math.floor(Math.random() * charset.length));
return (result);
}
document.addEventListener("keydown", (e) => {
if (e.key === "+")
createNotification.new("Server", createRamdomString(), createNotification.defaultIcon.info, () => {
console.log("Action button");
}, "Send");
if (e.key === "-")
createNotification.new("Server", createRamdomString());
});