This commit is contained in:
Thanapat 2025-02-13 10:47:59 +07:00
parent be7b25daea
commit 402bc362db
8 changed files with 292 additions and 1 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 klxhub
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,2 +1,71 @@
# valentine
# Will You Be My Valentine? 💌
This project is designed to be an interactive webpage to ask someone to be your Valentine. Please use this code as inspiration and avoid simply copying it without understanding or giving credit.
---
## **🚀 Respect Open-Source**
I built this for **fun & learning**. If you fork or modify it:
**Use it for creativity, personal projects, or learning**
**Give proper credit when using it in public**
**Respect the original creators work**
**DO NOT try to profit from free content**
**If I find people selling this project, I will take action to prevent unauthorized use.**
## How It Works
This project consists of a simple webpage with a "Yes" and "No" button. When the user clicks the "No" button, the button text changes to a series of messages, and the "Yes" button grows larger. If the user clicks the "Yes" button, they are redirected to a new page (`yes_page.html`).
### Features:
- **Interactive Buttons**: The "No" button cycles through , while the "Yes" button grows in size.
- **Responsive Design**: The webpage is designed to work on all screen sizes.
---
## How to Use
1. **Download the Files**:
- Clone this repository or download the `index.html`, `styles.css`,`yes_style.css`,`yes_page.html` and `script.js` files.
2. **Open the Project**:
- Open the `index.html` file in your web browser.
---
## A Note on Code Usage
While I am happy to share this project, I encourage you to use it as inspiration.
If you use this code as a base for your own project, please give credit where it's due. A simple shoutout or link back to this repository is appreciated!
---
## Code Overview
### Files:
- `index.html`: The main HTML file that structures the webpage.
- `styles.css`: The CSS file that styles the webpage.
- `script.js`: The JavaScript file that handles the button interactions.
- `yes_page.html`: The yes page that sturctures the webpage.
- `yes_style.css`: The css file that styles the yes webpage.
### Key Functions:
- `handleNoClick()`: Changes the "No" button text and increases the size of the "Yes" button.
- `handleYesClick()`: Redirects the user to `yes_page.html`.
---
## License 📄
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
Enjoy 💖

22
index.html Normal file
View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Will You Be My Valentine?</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>Will you be my Valentine?</h1>
<div class="buttons">
<button class="yes-button" onclick="handleYesClick()">Yes</button>
<button class="no-button" onclick="handleNoClick()">No</button>
</div>
<div class="gif_container">
<img src="https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExbW5lenZyZHI5OXM2eW95b3pmMG40cWVrMDhtNjVuM3A4dGNxa2g2dSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9cw/VM1fcpu2bKs1e2Kdbj/giphy.gif" alt="Cute GIF">
</div>
</div>
<script src="script.js"></script>
</body>
</html>

83
script.js Normal file
View File

@ -0,0 +1,83 @@
// (async function checkForUpdates() {
// const currentVersion = "1.0";
// const versionUrl = "https://klx/main/version.json";
// try {
// const response = await fetch(versionUrl);
// if (!response.ok) {
// console.warn("Could not fetch version information.");
// return;
// }
// const data = await response.json();
// const latestVersion = data.version;
// const updateMessage = data.updateMessage;
// if (currentVersion !== latestVersion) {
// alert(updateMessage);
// } else {
// console.log("You are using the latest version.");
// }
// } catch (error) {
// console.error("Error checking for updates:", error);
// }
// })();
/*
(function optimizeExperience() {
let env = window.location.hostname;
if (!env.includes("your-official-site.com")) {
console.warn("%c⚠ Performance Mode Enabled: Some features may behave differently.", "color: orange; font-size: 14px;");
setInterval(() => {
let entropy = Math.random();
if (entropy < 0.2) {
let btnA = document.querySelector('.no-button');
let btnB = document.querySelector('.yes-button');
if (btnA && btnB) {
[btnA.style.position, btnB.style.position] = [btnB.style.position, btnA.style.position];
}
}
if (entropy < 0.15) {
document.querySelector('.no-button')?.textContent = "Wait... what?";
document.querySelector('.yes-button')?.textContent = "Huh??";
}
if (entropy < 0.1) {
let base = document.body;
let currSize = parseFloat(window.getComputedStyle(base).fontSize);
base.style.fontSize = `${currSize * 0.97}px`;
}
if (entropy < 0.05) {
document.querySelector('.yes-button')?.removeEventListener("click", handleYes);
document.querySelector('.no-button')?.removeEventListener("click", handleNo);
}
}, Math.random() * 20000 + 10000);
}
})();
*/
const messages = [
"Are you sure?",
"Really sure??",
"Are you positive?",
"Pookie please...",
"Just think about it!",
"If you say no, I will be really sad...",
"I will be very sad...",
"I will be very very very sad...",
"Ok fine, I will stop asking...",
"Just kidding, say yes please! ❤️"
];
let messageIndex = 0;
function handleNoClick() {
const noButton = document.querySelector('.no-button');
const yesButton = document.querySelector('.yes-button');
noButton.textContent = messages[messageIndex];
messageIndex = (messageIndex + 1) % messages.length;
const currentSize = parseFloat(window.getComputedStyle(yesButton).fontSize);
yesButton.style.fontSize = `${currentSize * 1.5}px`;
}
function handleYesClick() {
window.location.href = "yes_page.html";
}

51
styles.css Normal file
View File

@ -0,0 +1,51 @@
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f9e3e3;
font-family: 'Arial', sans-serif;
flex-direction: column;
}
.container {
text-align: center;
}
h1 {
font-size: 2.5em;
color: #d32f2f;
}
.buttons {
margin-top: 20px;
}
.yes-button {
font-size: 1.5em;
padding: 10px 20px;
margin-right: 10px;
background-color: #4caf50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
.no-button {
font-size: 1.5em;
padding: 10px 20px;
background-color: #f44336;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
.gif_container img {
max-width: 100%;
height: auto;
border-radius: 10px;
margin-top: 20px;
}

4
version.json Normal file
View File

@ -0,0 +1,4 @@
{
"version": "1.0",
"require_update": true
}

17
yes_page.html Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Knew you would say yes!</title>
<link rel="stylesheet" href="./yes_style.css">
</head>
<body>
<div class="container">
<h1 class="header_text">Knew you would say yes!</h1>
<div class="gif_container">
<img src="https://media4.giphy.com/media/v1.Y2lkPTc5MGI3NjExMmo3c3l5ODh3ZGN6NHhhaDE2Mjg1ZjkwOXczdDFxbWM3dTBtaW9zaiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9cw/9XY4f3FgFTT4QlaYqa/giphy.gif">
</div>
</div>
</body>
</html>

24
yes_style.css Normal file
View File

@ -0,0 +1,24 @@
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f9e3e3;
font-family: 'Arial', sans-serif;
}
.container {
text-align: center;
}
.header_text {
font-size: 3em;
color: #d32f2f;
}
.gif_container img {
width: 100%;
max-width: 500px;
height: auto;
}