From 8b12547dac78d6b6df998ec804742905b28dbafd Mon Sep 17 00:00:00 2001 From: Livia020799 <146645775+Livia020799@users.noreply.github.com> Date: Sat, 10 Feb 2024 15:52:31 +0100 Subject: [PATCH] Delete script.js --- script.js | 111 ------------------------------------------------------ 1 file changed, 111 deletions(-) delete mode 100644 script.js diff --git a/script.js b/script.js deleted file mode 100644 index ded8d7b..0000000 --- a/script.js +++ /dev/null @@ -1,111 +0,0 @@ -// main.js -var noCount = 0; -var yesPressed = false; -var yesButtonSize = noCount * 20 + 16; - -var noGifs = [ -"https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExZGczazFwYmFsc2ZzNXlqMm83eTl1aTJ5N3lkeDljdDJsMXB1Ym83OCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/dJ3Fhbss0pegJE6h57/giphy.gif", - "https://media.giphy.com/media/DxGrZ1vY3I7OnA2SJp/giphy.gif", "https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExM2ZpZjVtMm4xNXFwbmF0c29wMTZpd256MDFlMnVpeDNwZW1mdDlreiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/AdqYefsn2gp2ntmn9G/giphy.gif", - "https://media.giphy.com/media/f9BU5XaqJEDONLgtAX/giphy.gif", - "https://media.giphy.com/media/Sf7VG0ODkwkQ7P9N3a/giphy.gif", - "https://media.giphy.com/media/i7Bi7uJz4SgsKNyFGP/giphy.gif", - "https://media.giphy.com/media/uQeD9Z747wHH6DvQjr/giphy.gif", "https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExeTgwbTI4cGFtcjJmbmRhZ282YWo0cDVweGEyZXY3ZGh0NDVhNmZkeCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/UzWcMXc4biOouz5PDr/giphy.gif", - //"https://media.giphy.com/media/a9a64w8UYWOvImkzdc/giphy.gif", - "https://media.giphy.com/media/NubDxhSINCrlP99WsZ/giphy.gif", - "https://media.giphy.com/media/hR0K2ihWQD63pWFlrB/giphy.gif", - "https://media.giphy.com/media/H33qhUPbaxww2AkFyz/giphy.gif", - "https://media.giphy.com/media/SDXUaQuG6cJf6JtJjs/giphy.gif", - "https://media.giphy.com/media/P9xqihIxP1BvU5BBDk/giphy.gif", "https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExNXAzMjFjNHQyb2t0ZnkzcGo2MzM0MXlvYTJzMTJwMm9qNHdtYnk5dCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/CeNuBAIjvH7CmaKzQD/giphy.gif", "https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExdTBnN3VhMjk3OHZoOGQ2MHZjcXB1NTJhc2lrbzdmeHZmZTYzcGdzeSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/bip1IyfvpRvaqSLVdp/giphy.gif", - "https://media.giphy.com/media/8MxvuVVJHvuMW86A64/giphy.gif", -]; - -function handleNoClick() { - noCount++; - yesButtonSize += noCount * 1 + 0.6; // Increase the size of the "Yes" button by 20 pixels - updateApp(); - var index = noCount % noGifs.length; // Calculate the index - var selectedGif = noGifs[index]; // Select the GIF URL based on the index - var noGifElement = document.getElementById('noGif'); // Get the GIF element - if (noGifElement) { - noGifElement.src = selectedGif; // Update the GIF source - } else { - console.error("No element with id 'noGif' found."); - } - - // Now update the text next to the "No" button - var noButtonTextElement = document.getElementById('noButtonText'); - if (noButtonTextElement) { - // Clear the existing text content before setting the new text - //noButtonTextElement.textContent = ''; - noButtonTextElement.textContent = getNoButtonText(); // Set the new text - - } else { - console.error("No element with id 'noButtonText' found."); - } -} - -// Helper function to create a text node if it doesn't exist -function createTextNode(parentElement) { - var textNode = document.createTextNode(''); - parentElement.appendChild(textNode); - return textNode; -} - - -// Event listener for the "No" button -document.getElementById('noButton').addEventListener('click', handleNoClick); - -function getNoButtonText() { - var phrases = [ - "No", - "Are you sure?", - "Really sure?", - "Think again!", - "Last chance!", - "Surely not?", - "You might regret this!", - "Give it another thought!", - "Are you absolutely certain?", - "This could be a mistake!", - "Have a heart!", - "Don't be so cold!", - "Change of heart?", - "Wouldn't you reconsider?", - "Is that your final answer?", - "You're breaking my heart 😔" - ]; - - // Check if we have reached the last phrase and reset if necessary - if (noCount >= phrases.length) { - noCount = 0; // Reset the count - yesButtonSize = 16; // Reset the button size - updateApp(); // Refresh the app state - } - return phrases[Math.min(noCount, phrases.length - 1)]; -} - -function updateApp() { - var app = document.getElementById('app'); - app.innerHTML = ''; // Clear current content - - if (yesPressed) { - app.innerHTML += '
yay 🥰🥰
'; - document.body.style.backgroundColor = "#FFCAEC"; // Set background color to #FFCAEC - } else { - app.innerHTML += `

Will you be my Valentine?

`; - var noButtonTextElement = document.getElementById('noButton'); - if (noButtonTextElement) { - noButtonTextElement.textContent = getNoButtonText(); // Set the new text - } else { - console.error("No element with id 'noButton' found."); - } - } -} - - -function setYesPressed() { - yesPressed = true; - updateApp(); -} - -updateApp(); // Initial render \ No newline at end of file