-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
129 lines (121 loc) · 4.38 KB
/
Copy pathapp.js
File metadata and controls
129 lines (121 loc) · 4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
document.addEventListener('DOMContentLoaded', () => {
const yesButton = document.getElementById('yesButton');
const noButton = document.getElementById('noButton');
const createLinkForm = document.getElementById('createLinkForm');
const linkContainer = document.getElementById('linkContainer');
const valentineMessage = document.getElementById('valentineMessage');
let noClickCount = 0;
const beggingPhrases = [
"Please reconsider!",
"Are you sure?",
"Think about it!",
"Don't say no!",
"Give it a chance!",
"Please!",
"Just one more time!",
"I beg you!",
"Pretty please!",
"Don't break my heart!",
"Please don't say no!",
"I'm begging you!",
"Please think again!",
"Don't do this!",
"Please don't!",
"Just say yes!",
"Please, please!",
"I'm on my knees!",
"Don't make me cry!",
"Please be kind!",
"I'm pleading!",
"Please be my Valentine!",
"Don't say no again!",
"Please, I'm asking nicely!",
"Just this once!",
"Please don't reject me!",
"I'm asking you!",
"Please, it's Valentine's Day!",
"Don't make me sad!",
"Please, I'm desperate!",
"Just say yes, please!",
"Please, it's important!",
"Don't say no, please!",
"Please, I'm serious!",
"Just one yes!",
"Please, I'm trying!",
"Don't make me beg!",
"Please, it's special!",
"Just this time!",
"Please, I'm hopeful!",
"Don't say no, think!",
"Please, I'm sincere!",
"Just say yes, please!",
"Please, it's a request!",
"Don't say no, please!",
"Please, I'm asking!",
"Just one yes, please!",
"Please, it's love!",
"Don't say no, please!",
"Please, I'm here!",
"Just say yes, please!",
"Please, it's a wish!",
"Don't say no, please!",
"Please, I'm waiting!",
"Just one yes, please!",
"Please, it's a dream!",
"Don't say no, please!",
"Please, I'm hoping!",
"Just say yes, please!",
"Please, it's a plea!",
"Don't say no, please!",
"Please, I'm here!",
"Just one yes, please!",
"Please, it's a hope!",
"Don't say no, please!",
"Please, I'm asking!",
"Just say yes, please!",
"Please, it's a wish!",
"Don't say no, please!",
"Please, I'm waiting!",
"Just one yes, please!",
"Please, it's a dream!",
"Don't say no, please!",
"Please, I'm hoping!",
"Just say yes, please!",
"Please, it's a plea!",
"Don't say no, please!",
"Please, I'm here!",
"Just one yes, please!",
"Please, it's a hope!"
];
createLinkForm.addEventListener('submit', (event) => {
event.preventDefault();
const name = document.getElementById('name').value;
const link = `askout_${Date.now()}.html?name=${encodeURIComponent(name)}`;
linkContainer.textContent = link;
});
yesButton.addEventListener('click', () => {
window.location.href = 'yes.html';
});
noButton.addEventListener('click', () => {
noClickCount++;
if (noClickCount >= 100) {
window.location.href = 'no.html';
return;
}
let randomX, randomY;
do {
randomX = Math.random() * (window.innerWidth - noButton.offsetWidth);
randomY = Math.random() * (window.innerHeight - noButton.offsetHeight);
} while (
(randomX < yesButton.offsetLeft + yesButton.offsetWidth && randomX + noButton.offsetWidth > yesButton.offsetLeft) ||
(randomY < yesButton.offsetTop + yesButton.offsetHeight && randomY + noButton.offsetHeight > yesButton.offsetTop) ||
(randomY < valentineMessage.offsetTop + valentineMessage.offsetHeight)
);
noButton.style.position = 'absolute';
noButton.style.left = `${randomX}px`;
noButton.style.top = `${randomY}px`;
const currentScale = parseFloat(window.getComputedStyle(yesButton).transform.split(',')[0].slice(7)) || 1;
yesButton.style.transform = `scale(${currentScale + 0.1})`;
noButton.textContent = beggingPhrases[noClickCount % beggingPhrases.length];
});
});