+ By downloading the numbered blocks below, you can add them up !and make bigger summed blocks More
+ numbered blocks Higher more you add, more points you get, more points, !higher in ranks Throw
+ the blocks on one .other with it number - merge or combine them .into a larger number
+ When you reach the number 4096 - you will win! But if you fill one column ....to the top - you will
+ lose
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DropTheNumbers/html/home.html b/DropTheNumbers/html/home.html
new file mode 100644
index 0000000..5cdd9aa
--- /dev/null
+++ b/DropTheNumbers/html/home.html
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+ Home Page
+
+
+
+
+
+
+
+
G a m i n g - W o r l d
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DropTheNumbers/html/log-in- sign-up.html b/DropTheNumbers/html/log-in- sign-up.html
new file mode 100644
index 0000000..6c9e3ef
--- /dev/null
+++ b/DropTheNumbers/html/log-in- sign-up.html
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+ SignUp and Login
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DropTheNumbers/images/445074585.webp b/DropTheNumbers/images/445074585.webp
new file mode 100644
index 0000000..5072113
Binary files /dev/null and b/DropTheNumbers/images/445074585.webp differ
diff --git a/DropTheNumbers/images/5312.jpg_wh860.jpg b/DropTheNumbers/images/5312.jpg_wh860.jpg
new file mode 100644
index 0000000..21d1ae0
Binary files /dev/null and b/DropTheNumbers/images/5312.jpg_wh860.jpg differ
diff --git a/DropTheNumbers/images/Dudovich_slider_01-500x291.jpg b/DropTheNumbers/images/Dudovich_slider_01-500x291.jpg
new file mode 100644
index 0000000..7ba2ea2
Binary files /dev/null and b/DropTheNumbers/images/Dudovich_slider_01-500x291.jpg differ
diff --git a/DropTheNumbers/images/Gamingrig2-240x180.jpg b/DropTheNumbers/images/Gamingrig2-240x180.jpg
new file mode 100644
index 0000000..76fcae9
Binary files /dev/null and b/DropTheNumbers/images/Gamingrig2-240x180.jpg differ
diff --git a/DropTheNumbers/images/Temple_Run_Brave_logo.png b/DropTheNumbers/images/Temple_Run_Brave_logo.png
new file mode 100644
index 0000000..9d4631c
Binary files /dev/null and b/DropTheNumbers/images/Temple_Run_Brave_logo.png differ
diff --git a/DropTheNumbers/images/c3284706d87258039b5abd5e608e6fbb.jpg b/DropTheNumbers/images/c3284706d87258039b5abd5e608e6fbb.jpg
new file mode 100644
index 0000000..c2a26f7
Binary files /dev/null and b/DropTheNumbers/images/c3284706d87258039b5abd5e608e6fbb.jpg differ
diff --git a/DropTheNumbers/images/candyCrush.jpeg b/DropTheNumbers/images/candyCrush.jpeg
new file mode 100644
index 0000000..d46caaf
Binary files /dev/null and b/DropTheNumbers/images/candyCrush.jpeg differ
diff --git a/DropTheNumbers/images/dropTheNumber.jpeg b/DropTheNumbers/images/dropTheNumber.jpeg
new file mode 100644
index 0000000..4f7e52b
Binary files /dev/null and b/DropTheNumbers/images/dropTheNumber.jpeg differ
diff --git a/DropTheNumbers/images/img (1).jpg b/DropTheNumbers/images/img (1).jpg
new file mode 100644
index 0000000..7b74ae1
Binary files /dev/null and b/DropTheNumbers/images/img (1).jpg differ
diff --git a/DropTheNumbers/images/img (1).png b/DropTheNumbers/images/img (1).png
new file mode 100644
index 0000000..e87f38f
Binary files /dev/null and b/DropTheNumbers/images/img (1).png differ
diff --git a/DropTheNumbers/images/img (2).jpg b/DropTheNumbers/images/img (2).jpg
new file mode 100644
index 0000000..cf86a1b
Binary files /dev/null and b/DropTheNumbers/images/img (2).jpg differ
diff --git a/DropTheNumbers/images/img (2).png b/DropTheNumbers/images/img (2).png
new file mode 100644
index 0000000..4a79dca
Binary files /dev/null and b/DropTheNumbers/images/img (2).png differ
diff --git a/DropTheNumbers/images/img (3).jpg b/DropTheNumbers/images/img (3).jpg
new file mode 100644
index 0000000..4988f4b
Binary files /dev/null and b/DropTheNumbers/images/img (3).jpg differ
diff --git a/DropTheNumbers/images/img (4).jpg b/DropTheNumbers/images/img (4).jpg
new file mode 100644
index 0000000..818a1da
Binary files /dev/null and b/DropTheNumbers/images/img (4).jpg differ
diff --git a/DropTheNumbers/images/log-in-img (1).jpg b/DropTheNumbers/images/log-in-img (1).jpg
new file mode 100644
index 0000000..5306607
Binary files /dev/null and b/DropTheNumbers/images/log-in-img (1).jpg differ
diff --git a/DropTheNumbers/images/log-in-img (2).jpg b/DropTheNumbers/images/log-in-img (2).jpg
new file mode 100644
index 0000000..bd72782
Binary files /dev/null and b/DropTheNumbers/images/log-in-img (2).jpg differ
diff --git a/DropTheNumbers/images/lovepik-night-sky-background-picture-download-image_400062943.jpg b/DropTheNumbers/images/lovepik-night-sky-background-picture-download-image_400062943.jpg
new file mode 100644
index 0000000..d58412a
Binary files /dev/null and b/DropTheNumbers/images/lovepik-night-sky-background-picture-download-image_400062943.jpg differ
diff --git a/DropTheNumbers/images/marioKart.jpeg b/DropTheNumbers/images/marioKart.jpeg
new file mode 100644
index 0000000..c88b213
Binary files /dev/null and b/DropTheNumbers/images/marioKart.jpeg differ
diff --git a/DropTheNumbers/images/other-game (1).jpg b/DropTheNumbers/images/other-game (1).jpg
new file mode 100644
index 0000000..540171e
Binary files /dev/null and b/DropTheNumbers/images/other-game (1).jpg differ
diff --git a/DropTheNumbers/images/other-game (1)~1.jpg b/DropTheNumbers/images/other-game (1)~1.jpg
new file mode 100644
index 0000000..af5707e
Binary files /dev/null and b/DropTheNumbers/images/other-game (1)~1.jpg differ
diff --git a/DropTheNumbers/images/other-game (2).jpg b/DropTheNumbers/images/other-game (2).jpg
new file mode 100644
index 0000000..3cbdbe4
Binary files /dev/null and b/DropTheNumbers/images/other-game (2).jpg differ
diff --git a/DropTheNumbers/images/other-game (2)~1.jpg b/DropTheNumbers/images/other-game (2)~1.jpg
new file mode 100644
index 0000000..89c44d2
Binary files /dev/null and b/DropTheNumbers/images/other-game (2)~1.jpg differ
diff --git a/DropTheNumbers/images/other-game (3).jpg b/DropTheNumbers/images/other-game (3).jpg
new file mode 100644
index 0000000..66f6abc
Binary files /dev/null and b/DropTheNumbers/images/other-game (3).jpg differ
diff --git a/DropTheNumbers/images/other-game (3)~1.jpg b/DropTheNumbers/images/other-game (3)~1.jpg
new file mode 100644
index 0000000..5788d5f
Binary files /dev/null and b/DropTheNumbers/images/other-game (3)~1.jpg differ
diff --git a/DropTheNumbers/images/pic1.jpg b/DropTheNumbers/images/pic1.jpg
new file mode 100644
index 0000000..6936e5b
Binary files /dev/null and b/DropTheNumbers/images/pic1.jpg differ
diff --git a/DropTheNumbers/images/pic11.jpg b/DropTheNumbers/images/pic11.jpg
new file mode 100644
index 0000000..31b62d3
Binary files /dev/null and b/DropTheNumbers/images/pic11.jpg differ
diff --git a/DropTheNumbers/images/pic111.jpg b/DropTheNumbers/images/pic111.jpg
new file mode 100644
index 0000000..69f4885
Binary files /dev/null and b/DropTheNumbers/images/pic111.jpg differ
diff --git a/DropTheNumbers/images/pic1111.jpg b/DropTheNumbers/images/pic1111.jpg
new file mode 100644
index 0000000..1f0081e
Binary files /dev/null and b/DropTheNumbers/images/pic1111.jpg differ
diff --git a/DropTheNumbers/images/pic2.jpg b/DropTheNumbers/images/pic2.jpg
new file mode 100644
index 0000000..7cef412
Binary files /dev/null and b/DropTheNumbers/images/pic2.jpg differ
diff --git a/DropTheNumbers/images/pic3.jpg b/DropTheNumbers/images/pic3.jpg
new file mode 100644
index 0000000..c0d7b14
Binary files /dev/null and b/DropTheNumbers/images/pic3.jpg differ
diff --git a/DropTheNumbers/images/pic4.webp b/DropTheNumbers/images/pic4.webp
new file mode 100644
index 0000000..a45ea86
Binary files /dev/null and b/DropTheNumbers/images/pic4.webp differ
diff --git a/DropTheNumbers/images/pic41.jpg b/DropTheNumbers/images/pic41.jpg
new file mode 100644
index 0000000..0f7aa6f
Binary files /dev/null and b/DropTheNumbers/images/pic41.jpg differ
diff --git a/DropTheNumbers/images/temple-run-2.jpg b/DropTheNumbers/images/temple-run-2.jpg
new file mode 100644
index 0000000..7b8056e
Binary files /dev/null and b/DropTheNumbers/images/temple-run-2.jpg differ
diff --git a/DropTheNumbers/images/ultra pixel survive 1280x720.jpg b/DropTheNumbers/images/ultra pixel survive 1280x720.jpg
new file mode 100644
index 0000000..0793629
Binary files /dev/null and b/DropTheNumbers/images/ultra pixel survive 1280x720.jpg differ
diff --git a/DropTheNumbers/images/ultra pixel survive 1280x720.webp b/DropTheNumbers/images/ultra pixel survive 1280x720.webp
new file mode 100644
index 0000000..212ce92
Binary files /dev/null and b/DropTheNumbers/images/ultra pixel survive 1280x720.webp differ
diff --git a/DropTheNumbers/images/x-icon.png b/DropTheNumbers/images/x-icon.png
new file mode 100644
index 0000000..a18a821
Binary files /dev/null and b/DropTheNumbers/images/x-icon.png differ
diff --git a/DropTheNumbers/js/game.js b/DropTheNumbers/js/game.js
new file mode 100644
index 0000000..914a0d7
--- /dev/null
+++ b/DropTheNumbers/js/game.js
@@ -0,0 +1,373 @@
+//בעזרת ה נעשה ונצליח//
+
+let isPaused = true;
+let isMuted = false;
+let highestIndex = 0;
+let score = 0;
+let row = 0;
+let maxIndex = [7, 7, 7, 7, 7];
+let col = 0;
+let ourObject;
+let intervalId;
+let rectObject = [
+ { color: "#8a8cdb", number: "2" },
+ { color: "#5f60c2", number: "4" },
+ { color: "#5255e7", number: "8" },
+ { color: "#393cf0", number: "16" },
+ { color: "#3133c0", number: "32" },
+ { color: "#0e11af", number: "64" },
+ { color: "#02047d", number: "128" },
+ { color: "#1d1d44", number: "256" },
+ { color: "#5c8dcc", number: "512" },
+ { color: "#179ee1", number: "1024" },
+ { color: "#073850", number: "2048" },
+ { color: "#1398a1", number: "4096" },
+];
+//user name
+let userName = document.getElementById("name");
+let user = JSON.parse(localStorage.getItem(localStorage.getItem("currentUser")));
+userName.innerText = "Hello " + user.firstname;
+
+//score
+let lblscore = document.getElementById("score");
+lblscore.innerText = `score: ${score}`;
+lblmaxScore = document.getElementById("maxScore");
+let maxScore = user.maxScore;
+lblmaxScore.innerText = `your high score: ${maxScore}`;
+
+let level1 = document.getElementById("stage1");
+let level2 = document.getElementById("stage2");
+let level3 = document.getElementById("stage3");
+
+//levels
+function levels(levelNumber) {
+ level1.style.backgroundColor = "white";
+ level2.style.backgroundColor = "white";
+ level3.style.backgroundColor = "white";
+ switch (levelNumber) {
+ case 1:
+ speed = 500;
+ level1.style.backgroundColor = "#070975";
+ break;
+ case 2:
+ speed = 250;
+ level2.style.backgroundColor = "#070975";
+ break;
+ case 3:
+ speed = 100;
+ level3.style.backgroundColor = "#070975";
+ break;
+
+ }
+ isPaused = false;
+ return speed;
+}
+
+//return
+let home = document.getElementById("sendHome");
+home.addEventListener("click", () => {
+ window.open("../html/home.html", "_self");
+})
+
+//start
+function start() {
+ document.addEventListener("keydown", move);
+ let pauseButton = document.getElementById("start-btn");
+ pauseButton.addEventListener("click", () => changeState(pauseButton));
+ let newGame = document.getElementById("new-game");
+ newGame.addEventListener("click", restart);
+ buildGrid();
+ speedGame();
+}
+
+function buildGrid() {
+ let grid = document.getElementsByClassName("grid-container");
+ for (let i = 0; i < 7; i++) {
+ for (let j = 0; j < 5; j++) {
+ const newDiv = document.createElement("div");
+ newDiv.classList.add("grid-item");
+ newDiv.id = `${i},${j}`;
+ grid[0].appendChild(newDiv);
+ }
+ }
+ isMuted = false;
+}
+
+function speedGame() {
+ level1.addEventListener("click", () => {
+ speed = levels(1);
+ play(speed);
+ });
+ level2.addEventListener("click", () => {
+ speed = levels(2);
+ play(speed);
+ });
+ level3.addEventListener("click", () => {
+ speed = levels(3);
+ play(speed);
+ });
+
+}
+
+
+function randomNumber(min, max) {
+ // min and max included
+ return Math.floor(Math.random() * (max - min + 1) + min);
+}
+
+function play(speed) {
+ col = randomNumber(0, 4);
+ ourObject = randomNumber(0, highestIndex);
+ intervalId = setInterval(() => {
+ if (!isPaused) changeRect(col, ourObject, speed);
+ }, speed);
+}
+
+//down rect
+function changeRect(col, ourObject, speed) {
+ //check if game over
+ let i = 0;
+ for (i; i < 5 && maxIndex[i] != 0; i++);
+ if (i != 5) {
+ gameOver("loose");
+ return;
+ }
+
+ if (row === maxIndex[col]) {
+ clearInterval(intervalId);
+ crush(col, ourObject);
+ row = 0;
+ maxIndex[col]--;
+ setTimeout(play(speed), 0);
+ return;
+ }
+
+ let ourRect = document.getElementById(`${row},${col}`);
+ ourRect.style.backgroundColor = rectObject[ourObject].color;
+ ourRect.innerText = rectObject[ourObject].number;
+ if (row !== 0) {
+ ourRect = document.getElementById(`${row - 1},${col}`);
+ ourRect.style.backgroundColor = "white";
+ ourRect.innerText = " ";
+ }
+ row++;
+}
+
+//move
+function move(event) {
+ switch (event.key) {
+ case "ArrowRight":
+ if (col != 0 && row < maxIndex[col - 1] + 1) {
+ col--;
+ ourRect = document.getElementById(`${row - 1},${col}`);
+ ourRect.style.backgroundColor = rectObject[ourObject].color;
+ ourRect.innerText = rectObject[ourObject].number;
+ ourRect = document.getElementById(`${row - 1},${col + 1}`);
+ ourRect.style.backgroundColor = "white";
+ ourRect.innerText = " ";
+ playAudio("moveAudio");
+ }
+ break;
+ case "ArrowLeft":
+ if (col != 4 && row < maxIndex[col + 1] + 1) {
+ col++;
+ ourRect = document.getElementById(`${row - 1},${col}`);
+ ourRect.style.backgroundColor = rectObject[ourObject].color;
+ ourRect.innerText = rectObject[ourObject].number;
+ ourRect = document.getElementById(`${row - 1},${col - 1}`);
+ ourRect.style.backgroundColor = "white";
+ ourRect.innerText = " ";
+ playAudio("moveAudio");
+ }
+ break;
+ }
+}
+//mute
+let mute = document.getElementById("audio")
+mute.addEventListener("click", () => {
+ if (isMuted == true) {
+ mute.innerText = "🔊";
+ isMuted = false;
+ }
+ else {
+ isMuted = true;
+ mute.innerText = "🔇";
+ }
+})
+
+//sounds
+function playAudio(id) {
+ let audio = document.getElementById(id);
+ if (isMuted === false)
+ audio.play();
+ return;
+}
+
+
+//crush
+function crush(col) {
+ row--;
+ //down
+ let downFound, rightFound, leftFound;
+ if (row != 6) {
+ downFound = checkSides(1, 0, col);
+ }
+ //right
+ if (col != 0 && !downFound) {
+ rightFound = checkSides(0, -1, col);
+ }
+ //left
+ if (col != 4 && !downFound && !rightFound) {
+ leftFound = checkSides(0, 1, col);
+ }
+ //up
+ if (row != 0 && !downFound && !rightFound && !leftFound) {
+ let upFound = checkSides(-1, 0, col);
+ }
+ //בדיקת חורים
+ findHoles();
+}
+
+//check sides
+function checkSides(rowDir, colDir, col) {
+ let currentText = document.getElementById(`${row},${col}`).innerText;
+ let sideText = document.getElementById(`${row + rowDir},${col + colDir}`).innerText;
+ if (currentText === sideText) {
+ playAudio("crushAudio");
+ let currentRect = document.getElementById(`${row},${col}`);
+ currentRect.style.backgroundColor = "white";
+ currentRect.innerText = "";
+ let i;
+ for (i = 0; i < 12; i++) {
+ if (rectObject[i].number === sideText) {
+ i++;
+ break;
+ }
+ }
+ score += Number(rectObject[i].number);
+ lblscore.innerText = `score: ${score}`;
+ user = JSON.parse(localStorage.getItem(localStorage.getItem("currentUser")));
+ maxScore = user.maxScore;
+
+ if (score > maxScore)
+ lblmaxScore.innerText = `your high score: ${score}`;
+
+ //check if win
+ if (rectObject[i].number === "512") {
+ gameOver("win");
+ return false;
+ }
+
+ if (highestIndex < 5)
+ highestIndex = Math.max(highestIndex, i);
+
+ let sideRect = document.getElementById(`${row + rowDir},${col + colDir}`);
+ sideRect.style.backgroundColor = rectObject[i].color;
+ sideRect.innerText = rectObject[i].number;
+ maxIndex[col]++;
+ row += rowDir + 1;
+ col += colDir;
+
+
+ setTimeout(crush(col), 0);
+ return true;
+ }
+ return false;
+}
+
+function findHoles() {
+ for (let i = 6; i > 0; i--) {
+ for (let j = 0; j < 5; j++) {
+ let currentText = document.getElementById(`${i},${j}`).innerText;
+ let upText = document.getElementById(`${i - 1},${j}`).innerText;
+ if (currentText === "" && upText != "") {
+ //down col
+ let downRect = document.getElementById(`${i},${j}`);
+ let upRect = document.getElementById(`${i - 1},${j}`);
+ let k = 0;
+ do {
+ k++;
+ downRect.style.backgroundColor = upRect.style.backgroundColor;
+ downRect.innerText = upRect.innerText;
+ upRect.style.backgroundColor = "white";
+ upRect.innerText = "";
+ downRect = document.getElementById(`${i - k},${j}`);
+ upRect = document.getElementById(`${i - 1 - k},${j}`);
+ } while (upRect.innerText != "");
+ }
+ }
+ }
+}
+
+//pause/resume
+function changeState(pauseButton) {
+ if (isPaused === true) {
+ isPaused = false;
+ pauseButton.innerText = "pause ▶️";
+ } else {
+ isPaused = true;
+ pauseButton.innerText = "resume ⏸️";
+ }
+ playAudio("pauseAudio");
+
+}
+
+//game over
+function gameOver(inputText) {
+ clearInterval(intervalId);
+ let gridItems = document.querySelectorAll(".grid-item");
+ for (let i = 0; i < gridItems.length; i++) {
+ gridItems[i].style.backgroundColor = "white";
+ gridItems[i].innerText = "";
+ }
+ let grid = document.querySelector(".grid-container");
+ if (inputText === "loose") {
+ grid.innerText = "GAME OVER!!! You Are A Looser😕";
+ playAudio("looseAudio1");
+ playAudio("looseAudio2");
+ }
+ else {
+ grid.innerText = "YOU WIN!!!!! congratulations🎇🎇🎇";
+ playAudio("winAudio");
+ }
+ grid.classList.add("gameOver");
+ //save max score
+ if (score > maxScore) {
+ let mail = user.mail;
+ user = localStorage.getItem(JSON.parse(mail));
+ user.maxScore = score;
+ localStorage.setItem(JSON.stringify(user));
+ }
+ return;
+}
+
+//new game
+function restart() {
+ clearInterval(intervalId);
+ mute.innerText = "🔊";
+ isMuted = false;
+ isPaused = true;
+ if (score >= maxScore) {
+ user.maxScore = score;
+ localStorage.setItem(user.mail, JSON.stringify(user));
+ }
+ score = 0;
+ lblscore.innerText = `score: ${score}`;
+ row = 0;
+ let grid = document.querySelector(".grid-container");
+ grid.innerText = "";
+ grid.classList.remove("gameOver");
+
+ buildGrid();
+ level1.style.backgroundColor = "white";
+ level2.style.backgroundColor = "white";
+ level3.style.backgroundColor = "white";
+ highestIndex = 0;
+ maxIndex = [7, 7, 7, 7, 7];
+ level1.removeEventListener("click");
+ level2.removeEventListener("click");
+ level3.removeEventListener("click");
+ speedGame();
+}
+
+start();
diff --git a/DropTheNumbers/js/home.js b/DropTheNumbers/js/home.js
new file mode 100644
index 0000000..3356bb8
--- /dev/null
+++ b/DropTheNumbers/js/home.js
@@ -0,0 +1,60 @@
+let candyCrush = document.getElementById("candyCrush");
+localStorage.setItem("candyCrush", false);
+let dropTheNumber = document.getElementById("dropTheNumber");
+localStorage.setItem("dropTheNumber", false);
+let marioKart = document.getElementById("marioKart");
+localStorage.setItem("marioKart", false);
+let pixelSurvive = document.getElementById("pixelSurvive");
+localStorage.setItem("pixelSurvive", false);
+
+candyCrush.addEventListener('click', () => {
+ localStorage.candyCrush = true;
+ openFile("candyCrush");
+
+});
+
+dropTheNumber.addEventListener('click', () => {
+ localStorage.dropTheNumber = true;
+ openFile("dropTheNumber");
+});
+
+marioKart.addEventListener('click', () => {
+ localStorage.marioKart = true;
+ openFile("marioKart");
+
+});
+
+pixelSurvive.addEventListener('click', () => {
+ localStorage.pixelSurvive = true;
+ openFile("pixelSurvive");
+
+});
+
+
+function openFile(game) {
+ if (localStorage.getItem("isConnected") === "true") {
+ switch (game) {
+ case "candyCrush":
+ window.open("https://play.google.com/store/apps/details?id=com.king.candycrushsaga&hl=en_US");
+ break;
+ case "dropTheNumber":
+ window.open("../html/game.html", "_self");
+ break;
+ case "marioKart":
+ window.open("../html/game.html", "_self");
+ break;
+ case "pixelSurvive":
+ window.open("../html/game.html", "_self");
+ break;
+ }
+ }
+ else
+ open("../html/log-in- sign-up.html", "_self");
+}
+
+
+let exit = document.getElementById("exit");
+exit.addEventListener("click", () => {
+ localStorage.setItem("currentUser", " ");
+ localStorage.setItem("isConnected", false);
+});
diff --git a/DropTheNumbers/js/log-in- sign-up.js b/DropTheNumbers/js/log-in- sign-up.js
new file mode 100644
index 0000000..497f891
--- /dev/null
+++ b/DropTheNumbers/js/log-in- sign-up.js
@@ -0,0 +1,121 @@
+// try try try
+const signUpButton = document.getElementById("signUp");
+const signInButton = document.getElementById("signIn");
+const container = document.getElementById("container");
+
+signUpButton.addEventListener("click", () => {
+ container.classList.add("right-panel-active");
+});
+signInButton.addEventListener("click", () => {
+ container.classList.remove("right-panel-active");
+});
+
+let signForm = document.getElementById("sign");
+signForm.addEventListener("submit", addUser);
+
+function addUser(event) {
+ event.preventDefault();
+ let firstName = document.querySelector("#fname").value;
+ let lastName = document.querySelector("#lname").value;
+ let mail = document.querySelector("#email1").value;
+ let password = document.querySelector("#password1").value;
+ let phone = document.querySelector("#phone").value;
+ let age = document.querySelector("#age").value;
+ isValid = isNotEmpty(firstName) && isNotEmpty(lastName) && ValidateEmail(mail) && CheckPassword(password) && isNotEmpty(password) && isNotEmpty(phone) && isNotEmpty(age);
+ let isNew = isNotExist(mail);
+ if (isValid && isNew) {
+ let user = {
+ firstname: firstName,
+ lastname: lastName,
+ mail: mail,
+ password: password,
+ phone: phone,
+ age: age,
+ maxScore: 0,
+ };
+ localStorage.setItem(mail, JSON.stringify(user));
+ container.classList.remove("right-panel-active");
+ }
+ else {
+ if (isValid)
+ alert("User Is Allredy Exist :(");
+ else
+ alert("You Didnt Insert Values");
+ }
+}
+
+
+function isNotEmpty(inputText) {
+ if (inputText === "")
+ return false;
+ return true;
+}
+
+function isNotExist(inputText) {
+ let user = localStorage.getItem(inputText);
+ if (user === null)
+ return true;
+ return false;
+}
+
+
+function ValidateEmail(inputText) {
+ let regex = new RegExp(
+ "([!#-'*+/-9=?A-Z^-~-]+(.[!#-'*+/-9=?A-Z^-~-]+)*|\"([]!#-[^-~ \t]|(\\[\t -~]))+\")@([!#-'*+/-9=?A-Z^-~-]+(.[!#-'*+/-9=?A-Z^-~-]+)*|[[\t -Z^-~]*])"
+ );
+ if (regex.test(inputText))
+ return true;
+ else {
+ alert("You have entered an invalid email address!");
+ return false;
+ }
+}
+
+function CheckPassword(inputText) {
+ let passw = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,20}$/;
+ if (inputText.match(passw)) {
+ return true;
+ }
+ else {
+ alert('please enter password between 6 to 20 characters which contain at least one numeric digit, one uppercase and one lowercase letter');
+ return false;
+ }
+}
+
+
+let logForm = document.getElementById("log");
+logForm.addEventListener('submit', linkThePage);
+
+function linkThePage() {
+
+ let mail = document.querySelector("#email2").value;
+ let password = document.querySelector("#password2").value;
+ let storageUser = JSON.parse(localStorage.getItem(mail));
+
+ if (storageUser === null || storageUser.password != password)
+ alert("user name or password is not correct!");
+ else {
+ localStorage.setItem("currentUser", mail);
+ localStorage.setItem("isConnected", true);
+ let candyCrush = localStorage.getItem("candyCrush");
+ if (candyCrush === "true") {
+ window.open("../html/game.html", "_self");
+ localStorage.setItem("candyCrush", false);
+ }
+ let dropNumbers = localStorage.getItem("dropTheNumber");
+ if (dropNumbers === "true") {
+ window.open("../html/game.html");
+ localStorage.setItem("dropTheNumber", false);
+ }
+ let marioKart = localStorage.getItem("marioKart");
+ if (marioKart === "true") {
+ window.open("../html/game.html", "_self");
+ localStorage.setItem("marioKart", false);
+ }
+ let pixelSurvive = localStorage.getItem("pixelSurvive");
+ if (localStorage.getItem("pixelSurvive") === "true") {
+ window.open("https://gameforge.com/en-US/littlegames/pixel-survival/#", "_self");
+ localStorage.setItem("pixelSurvive", false);
+ }
+ }
+}
diff --git a/index.html b/index.html
index 04c8ff5..04f7eca 100644
--- a/index.html
+++ b/index.html
@@ -100,6 +100,12 @@